Author: jra Date: 2004-08-16 21:27:22 +0000 (Mon, 16 Aug 2004) New Revision: 1840
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source&rev=1840&nolog=1 Log: Fix for #1606, can't launch dos exe's. 2 related problems - 1). DOS uses chained commands - when we are replying with sendfile we neglect to send the chained header. 2). Win9x and DOS TCP stacks blow up when getting data back from a Linux sendfile - "The engines canna take the strain cap'n". Don't use sendfile for anything less than NT1. Jeremy. Modified: trunk/source/param/loadparm.c trunk/source/smbd/reply.c Changeset: Modified: trunk/source/param/loadparm.c =================================================================== --- trunk/source/param/loadparm.c 2004-08-16 21:07:01 UTC (rev 1839) +++ trunk/source/param/loadparm.c 2004-08-16 21:27:22 UTC (rev 1840) @@ -4332,6 +4332,11 @@ BOOL lp_use_sendfile(int snum) { + extern int Protocol; + /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */ + if (Protocol < PROTOCOL_NT1) { + return False; + } return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active()); } Modified: trunk/source/smbd/reply.c =================================================================== --- trunk/source/smbd/reply.c 2004-08-16 21:07:01 UTC (rev 1839) +++ trunk/source/smbd/reply.c 2004-08-16 21:27:22 UTC (rev 1840) @@ -1733,7 +1733,7 @@ * reply_readbraw has already checked the length. */ - if ((nread > 0) && (lp_write_cache_size(SNUM(conn)) == 0) && lp_use_sendfile(SNUM(conn)) ) { + if (chain_size ==0 && (nread > 0) && (lp_write_cache_size(SNUM(conn)) == 0) && lp_use_sendfile(SNUM(conn)) ) { DATA_BLOB header; _smb_setlen(outbuf,nread); @@ -2073,7 +2073,7 @@ * on a train in Germany :-). JRA. */ - if ((CVAL(inbuf,smb_vwv0) == 0xFF) && lp_use_sendfile(SNUM(conn)) && + if (chain_size ==0 && (CVAL(inbuf,smb_vwv0) == 0xFF) && lp_use_sendfile(SNUM(conn)) && (lp_write_cache_size(SNUM(conn)) == 0) ) { SMB_STRUCT_STAT sbuf; DATA_BLOB header;
