diff options
author | Jeremy Allison <jra@samba.org> | 2010-04-06 15:43:35 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-04-06 15:43:35 -0700 |
commit | 9c410118cb8b53a6a7194b6768f433cac056e4d2 (patch) | |
tree | da4bbc2c88538adf1ed265684ca140dfa1021d94 /source3 | |
parent | 027adf88eaf8c3a7375da7c0f9c0397db46668e6 (diff) | |
download | samba-9c410118cb8b53a6a7194b6768f433cac056e4d2.tar.gz samba-9c410118cb8b53a6a7194b6768f433cac056e4d2.tar.bz2 samba-9c410118cb8b53a6a7194b6768f433cac056e4d2.zip |
Parameterize "smb2 max read", "smb2 max write", "smb2 max trans".
Set to 64k by default.
Jeremy.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/param/loadparm.c | 37 | ||||
-rw-r--r-- | source3/smbd/smb2_negprot.c | 6 | ||||
-rw-r--r-- | source3/smbd/smb2_notify.c | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_read.c | 4 | ||||
-rw-r--r-- | source3/smbd/smb2_write.c | 4 |
6 files changed, 48 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 7e45fed76c..7dcdeacb00 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4113,6 +4113,9 @@ int lp_lock_spin_time(void); int lp_usershare_max_shares(void); const char *lp_socket_options(void); int lp_config_backend(void); +int lp_smb2_max_read(void); +int lp_smb2_max_write(void); +int lp_smb2_max_trans(void); char *lp_preexec(int ); char *lp_postexec(int ); char *lp_rootpreexec(int ); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b0f78f98a0..077fc6355f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -362,6 +362,9 @@ struct global { char *szSMBPerfcountModule; bool bMapUntrustedToDomain; bool bAsyncSMBEchoHandler; + int ismb2_max_read; + int ismb2_max_write; + int ismb2_max_trans; }; static struct global Globals; @@ -2587,6 +2590,33 @@ static struct parm_struct parm_table[] = { .enum_list = NULL, .flags = FLAG_ADVANCED | FLAG_GLOBAL, }, + { + .label = "smb2 max read", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_read, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, + { + .label = "smb2 max write", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_write, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, + { + .label = "smb2 max trans", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_trans, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, {N_("Printing Options"), P_SEP, P_SEPARATOR}, @@ -5250,6 +5280,10 @@ static void init_globals(bool first_time_only) Globals.iminreceivefile = 0; Globals.bMapUntrustedToDomain = false; + + Globals.ismb2_max_read = 64*1024; + Globals.ismb2_max_write = 64*1024; + Globals.ismb2_max_trans = 64*1024; } /******************************************************************* @@ -5612,6 +5646,9 @@ FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime) FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares) FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions) FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend) +FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read) +FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write) +FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans) FN_LOCAL_STRING(lp_preexec, szPreExec) FN_LOCAL_STRING(lp_postexec, szPostExec) diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c index 5b97c65d79..5a216b27e4 100644 --- a/source3/smbd/smb2_negprot.c +++ b/source3/smbd/smb2_negprot.c @@ -164,9 +164,9 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req) negprot_spnego_blob.data, 16); /* server guid */ SIVAL(outbody.data, 0x18, capabilities); /* capabilities */ - SIVAL(outbody.data, 0x1C, 0x00010000); /* max transact size */ - SIVAL(outbody.data, 0x20, 0x00010000); /* max read size */ - SIVAL(outbody.data, 0x24, 0x00010000); /* max write size */ + SIVAL(outbody.data, 0x1C, lp_smb2_max_trans()); /* max transact size */ + SIVAL(outbody.data, 0x20, lp_smb2_max_read()); /* max read size */ + SIVAL(outbody.data, 0x24, lp_smb2_max_write()); /* max write size */ SBVAL(outbody.data, 0x28, 0); /* system time */ SBVAL(outbody.data, 0x30, 0); /* server start time */ SSVAL(outbody.data, 0x38, diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index fb465abff9..8fa0744319 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -70,7 +70,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req) * 0x00010000 is what Windows 7 uses, * Windows 2008 uses 0x00080000 */ - if (in_output_buffer_length > 0x00010000) { + if (in_output_buffer_length > lp_smb2_max_trans()) { return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 674fa2b71f..aa2805d66a 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -75,9 +75,9 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req) in_remaining_bytes = IVAL(inbody, 0x28); /* check the max read size */ - if (in_length > 0x00010000) { + if (in_length > lp_smb2_max_read()) { DEBUG(0,("here:%s: 0x%08X: 0x%08X\n", - __location__, in_length, 0x00010000)); + __location__, in_length, lp_smb2_max_read())); return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 17d562affa..608cf09e45 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -81,9 +81,9 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req) } /* check the max write size */ - if (in_data_length > 0x00010000) { + if (in_data_length > lp_smb2_max_write()) { DEBUG(0,("here:%s: 0x%08X: 0x%08X\n", - __location__, in_data_length, 0x00010000)); + __location__, in_data_length, lp_smb2_max_write())); return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } |