summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-08-16 21:27:26 +0000
committerJeremy Allison <jra@samba.org>2004-08-16 21:27:26 +0000
commit3a84ced891afac0e8cad8f699349bba5362aef68 (patch)
tree9468c377602a226e7c5828a2b41f5a53a029f741
parent3150d5c24fe15f6673d147d899e10983c66bddfc (diff)
downloadsamba-3a84ced891afac0e8cad8f699349bba5362aef68.tar.gz
samba-3a84ced891afac0e8cad8f699349bba5362aef68.tar.xz
samba-3a84ced891afac0e8cad8f699349bba5362aef68.zip
r1841: 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.
-rw-r--r--source/param/loadparm.c5
-rw-r--r--source/smbd/reply.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 4150f57e55d..2750cc7edab 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -4320,6 +4320,11 @@ int lp_maxprintjobs(int snum)
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());
}
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 4125d71b840..74872eeea9f 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -1735,7 +1735,7 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st
* 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);
@@ -2075,7 +2075,7 @@ int send_file_readX(connection_struct *conn, char *inbuf,char *outbuf,int length
* 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;