diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-02-28 20:39:36 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-02-28 20:39:36 +0000 |
commit | da0a56a278232bad50ea0dd05de3b06299d66234 (patch) | |
tree | 38f0974d6caf71c698ae9d2ab2fcdace6ac8e28e /source3 | |
parent | 0fb433564c6c8959ccd788f19012348634416ec1 (diff) | |
download | samba-da0a56a278232bad50ea0dd05de3b06299d66234.tar.gz samba-da0a56a278232bad50ea0dd05de3b06299d66234.tar.bz2 samba-da0a56a278232bad50ea0dd05de3b06299d66234.zip |
Split maxxmit parameter into two : max_send (auto configured by the
connecting client, as per CIFS4) and max_recv, which can be configured
as the old maxxmit was. Fixes problems with NT directory listings when
maxxmit is set very small.
jra@cygnus.com
(This used to be commit c2d5d1040a933987a0c39545bb5bf8e2fc400a87)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/ipc.c | 10 | ||||
-rw-r--r-- | source3/smbd/pipes.c | 1 | ||||
-rw-r--r-- | source3/smbd/reply.c | 9 | ||||
-rw-r--r-- | source3/smbd/server.c | 20 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 8 |
5 files changed, 30 insertions, 18 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 1bb1322b5d..ccb2f3dd52 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -31,7 +31,7 @@ #define CHECK_TYPES 0 extern int DEBUGLEVEL; -extern int maxxmit; +extern int max_send; extern files_struct Files[]; extern connection_struct Connections[]; @@ -142,8 +142,8 @@ static void send_trans_reply(char *outbuf,char *data,char *param,uint16 *setup, int tot_data=0,tot_param=0; int align; - this_lparam = MIN(lparam,maxxmit - (500+lsetup*SIZEOFWORD)); /* hack */ - this_ldata = MIN(ldata,maxxmit - (500+lsetup*SIZEOFWORD+this_lparam)); + this_lparam = MIN(lparam,max_send - (500+lsetup*SIZEOFWORD)); /* hack */ + this_ldata = MIN(ldata,max_send - (500+lsetup*SIZEOFWORD+this_lparam)); align = (this_lparam%4); @@ -173,8 +173,8 @@ static void send_trans_reply(char *outbuf,char *data,char *param,uint16 *setup, while (tot_data < ldata || tot_param < lparam) { - this_lparam = MIN(lparam-tot_param,maxxmit - 500); /* hack */ - this_ldata = MIN(ldata-tot_data,maxxmit - (500+this_lparam)); + this_lparam = MIN(lparam-tot_param,max_send - 500); /* hack */ + this_ldata = MIN(ldata-tot_data,max_send - (500+this_lparam)); align = (this_lparam%4); diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index efa6a68b9d..06f3aeb0fb 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -35,7 +35,6 @@ /* look in server.c for some explanation of these variables */ extern int Protocol; extern int DEBUGLEVEL; -extern int maxxmit; extern int chain_fnum; extern char magic_char; extern connection_struct Connections[]; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 5dbd39f746..f532d613b4 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -30,7 +30,8 @@ /* look in server.c for some explanation of these variables */ extern int Protocol; extern int DEBUGLEVEL; -extern int maxxmit; +extern int max_send; +extern int max_recv; extern int chain_fnum; extern char magic_char; extern connection_struct Connections[]; @@ -194,7 +195,7 @@ int reply_tcon(char *inbuf,char *outbuf) return(connection_error(inbuf,outbuf,connection_num)); outsize = set_message(outbuf,2,0,True); - SSVAL(outbuf,smb_vwv0,maxxmit); + SSVAL(outbuf,smb_vwv0,max_recv); SSVAL(outbuf,smb_vwv1,connection_num); SSVAL(outbuf,smb_tid,connection_num); @@ -509,7 +510,9 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize) SSVAL(inbuf,smb_uid,sess_vuid); if (!done_sesssetup) - maxxmit = MIN(maxxmit,smb_bufsize); + max_send = MIN(max_send,smb_bufsize); + + DEBUG(0,(" Client requested max send size of %d\n", max_send)); done_sesssetup = True; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 09c8fccb5c..1abcb8089f 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -67,7 +67,17 @@ int max_file_fd_used = 0; extern int Protocol; -int maxxmit = BUFFER_SIZE; +/* + * Size of data we can send to client. Set + * by the client for all protocols above CORE. + * Set by us for CORE protocol. + */ +int max_send = BUFFER_SIZE; +/* + * Size of the data we can receive. Set by us. + * Can be modified by the max xmit parameter. + */ +int max_recv = BUFFER_SIZE; /* a fnum to use when chaining */ int chain_fnum = -1; @@ -2592,7 +2602,7 @@ int reply_lanman1(char *outbuf) } CVAL(outbuf,smb_flg) = 0x81; /* Reply, SMBlockread, SMBwritelock supported */ - SSVAL(outbuf,smb_vwv2,maxxmit); + SSVAL(outbuf,smb_vwv2,max_recv); SSVAL(outbuf,smb_vwv3,lp_maxmux()); /* maxmux */ SSVAL(outbuf,smb_vwv4,1); SSVAL(outbuf,smb_vwv5,raw); /* tell redirector we support @@ -2639,7 +2649,7 @@ int reply_lanman2(char *outbuf) } CVAL(outbuf,smb_flg) = 0x81; /* Reply, SMBlockread, SMBwritelock supported */ - SSVAL(outbuf,smb_vwv2,maxxmit); + SSVAL(outbuf,smb_vwv2,max_recv); SSVAL(outbuf,smb_vwv3,lp_maxmux()); SSVAL(outbuf,smb_vwv4,1); SSVAL(outbuf,smb_vwv5,raw); /* readbraw and/or writebraw */ @@ -3813,7 +3823,7 @@ static void process(void) if (msg_type == 0) show_msg(InBuffer); - nread = construct_reply(InBuffer,OutBuffer,nread,maxxmit); + nread = construct_reply(InBuffer,OutBuffer,nread,max_send); if(nread > 0) { if (CVAL(OutBuffer,0) == 0) @@ -4093,7 +4103,7 @@ static void usage(char *pname) /* possibly reload the services file. */ reload_services(True); - maxxmit = MIN(lp_maxxmit(),BUFFER_SIZE); + max_recv = MIN(lp_maxxmit(),BUFFER_SIZE); if (*lp_rootdir()) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ab2fe88536..2c0d5903e6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -40,13 +40,13 @@ extern int Client; static int send_trans2_replies(char *outbuf, int bufsize, char *params, int paramsize, char *pdata, int datasize) { - /* As we are using a protocol > LANMAN1 then the maxxmit + /* As we are using a protocol > LANMAN1 then the max_send variable must have been set in the sessetupX call. This takes precedence over the max_xmit field in the global struct. These different max_xmit variables should be merged as this is now too confusing */ - extern int maxxmit; + extern int max_send; int data_to_send = datasize; int params_to_send = paramsize; int useable_space; @@ -71,9 +71,9 @@ static int send_trans2_replies(char *outbuf, int bufsize, char *params, /* The alignment_offset is to align the param and data bytes on an even byte boundary. NT 4.0 Beta needs this to work correctly. */ useable_space = bufsize - ((smb_buf(outbuf)+alignment_offset) - outbuf); - /* useable_space can never be more than maxxmit minus the + /* useable_space can never be more than max_send minus the alignment offset. */ - useable_space = MIN(useable_space, maxxmit - alignment_offset); + useable_space = MIN(useable_space, max_send - alignment_offset); while( params_to_send || data_to_send) { |