@@ -1730,6 +1730,10 @@ process_extended(u_int32_t id)
1730
1730
1731
1731
/* stolen from ssh-agent */
1732
1732
1733
+ #ifdef WIN32_FIXME
1734
+ int readsomemore = 0 ;
1735
+ #endif
1736
+
1733
1737
static void
1734
1738
process (void )
1735
1739
{
@@ -1741,18 +1745,31 @@ process(void)
1741
1745
int i , r ;
1742
1746
u_int32_t id ;
1743
1747
1748
+ #ifdef WIN32_FIXME
1749
+ // we use to tell our caller to read more data if a message is not complete
1750
+ readsomemore = 0 ;
1751
+ #endif
1752
+
1744
1753
buf_len = sshbuf_len (iqueue );
1745
- if (buf_len < 5 )
1754
+ if (buf_len < 5 ) {
1755
+ #ifdef WIN32_FIXME
1756
+ readsomemore = 1 ;
1757
+ #endif
1746
1758
return ; /* Incomplete message. */
1759
+ }
1747
1760
cp = sshbuf_ptr (iqueue );
1748
1761
msg_len = get_u32 (cp );
1749
1762
if (msg_len > SFTP_MAX_MSG_LENGTH ) {
1750
1763
error ("bad message from %s local user %s" ,
1751
1764
client_addr , pw -> pw_name );
1752
1765
sftp_server_cleanup_exit (11 );
1753
1766
}
1754
- if (buf_len < msg_len + 4 )
1767
+ if (buf_len < msg_len + 4 ) {
1768
+ #ifdef WIN32_FIXME
1769
+ readsomemore = 1 ;
1770
+ #endif
1755
1771
return ;
1772
+ }
1756
1773
if ((r = sshbuf_consume (iqueue , 4 )) != 0 )
1757
1774
fatal ("%s: buffer error: %s" , __func__ , ssh_err (r ));
1758
1775
buf_len -= 4 ;
@@ -1834,9 +1851,13 @@ sftp_server_usage(void)
1834
1851
#ifdef WIN32_FIXME
1835
1852
DWORD select_in_handle ( HANDLE in_handle )
1836
1853
{
1837
- DWORD bytesavail = 0 ;
1838
- //rc = WaitForSingleObject (in_handle, 0);
1854
+ //DWORD rc = WaitForSingleObject (in_handle, 0);
1855
+ //if (rc == WAIT_OBJECT_0)
1856
+ // return 1;
1857
+ //else
1858
+ // return 0;
1839
1859
1860
+ DWORD bytesavail = 0 ;
1840
1861
PeekNamedPipe (in_handle , NULL ,0 , NULL , & bytesavail , NULL );
1841
1862
return bytesavail ;
1842
1863
}
@@ -2098,7 +2119,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
2098
2119
2099
2120
/* copy stdin to iqueue */
2100
2121
if ( select_read ) {
2101
- if ( select_in_handle ( in_handle ) || ( sshbuf_len (iqueue ) <= 0 )) {
2122
+ if ( readsomemore || ( sshbuf_len (iqueue ) <= 0 )) {
2102
2123
len = _read (in , buf , sizeof buf );
2103
2124
if (len == 0 ) {
2104
2125
debug ("read eof" );
0 commit comments