lib/param: Normalise "read raw" and "write raw" parameters
authorAndrew Bartlett <abartlet@samba.org>
Wed, 15 Jan 2014 01:48:40 +0000 (14:48 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 12 Feb 2014 00:17:13 +0000 (13:17 +1300)
They have been changed to function like normal parameters,
removing a special case in the loadparm system.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Michael Adam <obnox@samba.org>
docs-xml/smbdotconf/protocol/readraw.xml
docs-xml/smbdotconf/protocol/writeraw.xml
lib/param/loadparm.c
lib/param/param_table.c
source3/include/proto.h
source3/param/loadparm.c
source3/smbd/negprot.c
source4/smb_server/smb/negprot.c

index 3ff250c1a5a4c0beb5d4691e14aa7a6dd743e8f7..fb54cc0c000a2ec54ad1ac80a1e3369fa00ea540 100644 (file)
@@ -2,15 +2,13 @@
                  context="G"
                                 type="boolean"
                  developer="1"
-                 generated_function="0"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
-    <para>This parameter controls whether or not the server 
-    will support the raw read SMB requests when transferring data 
-    to clients.</para>
+    <para>This is ignored if <smbconfoption name="async echo handler"/> is set,
+    because this feature is incompatible with raw read SMB requests</para>
 
     <para>If enabled, raw reads allow reads of 65535 bytes in 
-    one packet. This typically provides a major performance benefit.
+    one packet. This typically provides a major performance benefit for some very, very old clients.
     </para>
 
     <para>However, some clients either negotiate the allowable 
@@ -24,4 +22,5 @@
 <value type="default">yes</value>
 
 <related>write raw</related>
+<related>async echo handler</related>
 </samba:parameter>
index 963803f62aeb07bd125e295a6a02832e61bf8575..fb9e386b7d1e2e773e54b97f17da05198d8caaa1 100644 (file)
@@ -2,13 +2,25 @@
                  context="G"
                                 type="boolean"
                  developer="1"
-                 generated_function="0"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
-    <para>This parameter controls whether or not the server 
-    will support raw write SMB's when transferring data from clients. 
-    You should never need to change this parameter.</para>
+    <para>This is ignored if <smbconfoption name="async echo handler"/> is set, 
+    because this feature is incompatible with raw write SMB requests</para>
+
+    <para>If enabled, raw writes allow writes of 65535 bytes in 
+    one packet. This typically provides a major performance benefit for some very, very old clients.
+    </para>
+
+    <para>However, some clients either negotiate the allowable 
+    block size incorrectly or are incapable of supporting larger block 
+       sizes, and for these clients you may need to disable raw writes.</para>
+
+<para>In general this parameter should be viewed as a system tuning 
+       tool and left severely alone.</para>
 </description>
 
 <value type="default">yes</value>
+
+<related>read raw</related>
+<related>async echo handler</related>
 </samba:parameter>
index fedabad77597e57e9310419f3839bd35f906ad53..17ac2d5fda7cdeb509366f77eb3ef7485f12add2 100644 (file)
@@ -319,8 +319,6 @@ static struct loadparm_context *global_loadparm_context;
 #include "lib/param/param_functions.c"
 
 /* These functions remain only in lib/param for now */
-FN_GLOBAL_BOOL(readraw, bReadRaw)
-FN_GLOBAL_BOOL(writeraw, bWriteRaw)
 FN_GLOBAL_CONST_STRING(cachedir, szCacheDir)
 FN_GLOBAL_CONST_STRING(statedir, szStateDir)
 
index 09e041bbeaa91ebfb8a79fcc18424486105465b9..713db9016ebf120442885322dd7203f5f223ddae 100644 (file)
@@ -1402,7 +1402,7 @@ static struct parm_struct parm_table[] = {
                .label          = "read raw",
                .type           = P_BOOL,
                .p_class        = P_GLOBAL,
-               .offset         = GLOBAL_VAR(bReadRaw),
+               .offset         = GLOBAL_VAR(read_raw),
                .special        = NULL,
                .enum_list      = NULL,
                .flags          = FLAG_ADVANCED,
@@ -1411,7 +1411,7 @@ static struct parm_struct parm_table[] = {
                .label          = "write raw",
                .type           = P_BOOL,
                .p_class        = P_GLOBAL,
-               .offset         = GLOBAL_VAR(bWriteRaw),
+               .offset         = GLOBAL_VAR(write_raw),
                .special        = NULL,
                .enum_list      = NULL,
                .flags          = FLAG_ADVANCED,
index 9024f6b3b857c089fb91885be1bb3490000bfb57..3f5abd07a830bb193ba3e684234cd8023ab643dd 100644 (file)
@@ -994,8 +994,6 @@ bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high);
 bool lp_idmap_default_range(uint32_t *low, uint32_t *high);
 const char *lp_idmap_backend(const char *domain_name);
 const char *lp_idmap_default_backend (void);
-bool lp_readraw(void);
-bool lp_writeraw(void);
 int lp_security(void);
 int lp_smb2_max_credits(void);
 int lp_cups_encrypt(void);
index b4b79aaa29d9cb3b0d13c218e7e66cab15e96065..0fce5399685f2214c482aa1d77722f5feac2337f 100644 (file)
@@ -827,8 +827,8 @@ static void init_globals(bool reinit_globals)
        Globals.winbind_sealed_pipes = true;
        Globals.require_strong_key = true;
        Globals.server_schannel = Auto;
-       Globals.bReadRaw = true;
-       Globals.bWriteRaw = true;
+       Globals.read_raw = true;
+       Globals.write_raw = true;
        Globals.null_passwords = false;
        Globals.obey_pam_restrictions = false;
        Globals.syslog = 1;
@@ -1165,9 +1165,6 @@ char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK
  char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
 
 
-static FN_GLOBAL_BOOL(_readraw, bReadRaw)
-static FN_GLOBAL_BOOL(_writeraw, bWriteRaw)
-
 /* If lp_statedir() and lp_cachedir() are explicitely set during the
  * build process or in smb.conf, we use that value.  Otherwise they
  * default to the value of lp_lock_directory(). */
@@ -5301,22 +5298,6 @@ bool lp_widelinks(int snum)
        return lp_widelinks_internal(snum);
 }
 
-bool lp_writeraw(void)
-{
-       if (lp_async_smb_echo_handler()) {
-               return false;
-       }
-       return lp__writeraw();
-}
-
-bool lp_readraw(void)
-{
-       if (lp_async_smb_echo_handler()) {
-               return false;
-       }
-       return lp__readraw();
-}
-
 int lp_server_role(void)
 {
        return lp_find_server_role(lp__server_role(),
index 1ba363dedac146c000a50c51d62085cbd296e4fd..bd7df2231e89564a74634c223b8e66a147f8b4c6 100644 (file)
@@ -62,10 +62,15 @@ static void get_challenge(struct smbd_server_connection *sconn, uint8 buff[8])
 
 static void reply_lanman1(struct smb_request *req, uint16 choice)
 {
-       int raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0);
        int secword=0;
        time_t t = time(NULL);
        struct smbd_server_connection *sconn = req->sconn;
+       uint16_t raw;
+       if (lp_async_smb_echo_handler()) {
+               raw = 0;
+       } else {
+               raw = (lp_read_raw()?1:0) | (lp_write_raw()?2:0);
+       }
 
        sconn->smb1.negprot.encrypted_passwords = lp_encrypt_passwords();
 
@@ -107,10 +112,15 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
 
 static void reply_lanman2(struct smb_request *req, uint16 choice)
 {
-       int raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0);
        int secword=0;
        time_t t = time(NULL);
        struct smbd_server_connection *sconn = req->sconn;
+       uint16_t raw;
+       if (lp_async_smb_echo_handler()) {
+               raw = 0;
+       } else {
+               raw = (lp_read_raw()?1:0) | (lp_write_raw()?2:0);
+       }
 
        sconn->smb1.negprot.encrypted_passwords = lp_encrypt_passwords();
 
@@ -289,7 +299,7 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
 
        capabilities |= CAP_LARGE_FILES;
 
-       if (lp_readraw() && lp_writeraw())
+       if (!lp_async_smb_echo_handler() && lp_read_raw() && lp_write_raw())
                capabilities |= CAP_RAW_MODE;
 
        if (lp_nt_status_support())
index a2d04446e40ce50d8dad76d70d6f5ed9e1d64d45..d4a1dc9c084f09abcf352ce000f37aafffc73922 100644 (file)
@@ -88,7 +88,13 @@ this any more it probably doesn't matter
 ****************************************************************************/
 static void reply_coreplus(struct smbsrv_request *req, uint16_t choice)
 {
-       uint16_t raw = (lpcfg_readraw(req->smb_conn->lp_ctx)?1:0) | (lpcfg_writeraw(req->smb_conn->lp_ctx)?2:0);
+       uint16_t raw;
+       if (lpcfg_async_smb_echo_handler(req->smb_conn->lp_ctx)) {
+               raw = 0;
+       } else {
+               raw = (lpcfg_read_raw(req->smb_conn->lp_ctx)?1:0) |
+                     (lpcfg_write_raw(req->smb_conn->lp_ctx)?2:0);
+       }
 
        smbsrv_setup_reply(req, 13, 0);
 
@@ -119,7 +125,13 @@ static void reply_coreplus(struct smbsrv_request *req, uint16_t choice)
 ****************************************************************************/
 static void reply_lanman1(struct smbsrv_request *req, uint16_t choice)
 {
-       int raw = (lpcfg_readraw(req->smb_conn->lp_ctx)?1:0) | (lpcfg_writeraw(req->smb_conn->lp_ctx)?2:0);
+       uint16_t raw;
+       if (lpcfg_async_smb_echo_handler(req->smb_conn->lp_ctx)) {
+               raw = 0;
+       } else {
+               raw = (lpcfg_read_raw(req->smb_conn->lp_ctx)?1:0) |
+                     (lpcfg_write_raw(req->smb_conn->lp_ctx)?2:0);
+       }
        int secword=0;
        time_t t = req->request_time.tv_sec;
 
@@ -174,9 +186,15 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice)
 ****************************************************************************/
 static void reply_lanman2(struct smbsrv_request *req, uint16_t choice)
 {
-       int raw = (lpcfg_readraw(req->smb_conn->lp_ctx)?1:0) | (lpcfg_writeraw(req->smb_conn->lp_ctx)?2:0);
        int secword=0;
        time_t t = req->request_time.tv_sec;
+       uint16_t raw;
+       if (lpcfg_async_smb_echo_handler(req->smb_conn->lp_ctx)) {
+               raw = 0;
+       } else {
+               raw = (lpcfg_read_raw(req->smb_conn->lp_ctx)?1:0) |
+                     (lpcfg_write_raw(req->smb_conn->lp_ctx)?2:0);
+       }
 
        req->smb_conn->negotiate.encrypted_passwords = lpcfg_encrypt_passwords(req->smb_conn->lp_ctx);
   
@@ -272,8 +290,9 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
                capabilities |= CAP_LARGE_FILES;
        }
 
-       if (lpcfg_readraw(req->smb_conn->lp_ctx) &&
-           lpcfg_writeraw(req->smb_conn->lp_ctx)) {
+       if (!lpcfg_async_smb_echo_handler(req->smb_conn->lp_ctx) &&
+           lpcfg_read_raw(req->smb_conn->lp_ctx) &&
+           lpcfg_write_raw(req->smb_conn->lp_ctx)) {
                capabilities |= CAP_RAW_MODE;
        }