Split maxxmit parameter into two : max_send (auto configured by the
authorSamba Release Account <samba-bugs@samba.org>
Fri, 28 Feb 1997 20:39:36 +0000 (20:39 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Fri, 28 Feb 1997 20:39:36 +0000 (20:39 +0000)
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)

source3/smbd/ipc.c
source3/smbd/pipes.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/trans2.c

index 1bb1322b5dbe28a0c4eb6b9bcda7728405da2523..ccb2f3dd52df2b96290e46ab71b50404d829698c 100644 (file)
@@ -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);
 
index efa6a68b9d736eaad7406b704b7d4b1e8502df9a..06f3aeb0fb0a4a9d3f359b105c439c72695aa161 100644 (file)
@@ -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[];
index 5dbd39f746395b05d471d583a0235b2b40346826..f532d613b4ab9bf812115dad0388462e0f7309ea 100644 (file)
@@ -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;
 
index 09c8fccb5c4fa4dac836cb9b9ce4c38c009eafc9..1abcb8089f4ee3abe7c53fa2962c41bd3078e3d3 100644 (file)
@@ -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())
     {
index ab2fe8853645f149bc6d13ca183e2b3d43e3c606..2c0d5903e61e54de57211cfbd8845426ab954aed 100644 (file)
@@ -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)
     {