summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-23 17:18:14 +0200
committerKarolin Seeger <kseeger@samba.org>2011-10-15 20:49:04 +0200
commite34912e06f53dd8844b5ccde8f20ad962c52cc0f (patch)
treebb898a3b4579a88d7fe75ac365ba6759dd488659
parent9bfd1fe1f445f8e167a38f8ff3f9c039d729f78b (diff)
downloadsamba-e34912e06f53dd8844b5ccde8f20ad962c52cc0f.tar.gz
samba-e34912e06f53dd8844b5ccde8f20ad962c52cc0f.tar.xz
samba-e34912e06f53dd8844b5ccde8f20ad962c52cc0f.zip
s3:smb2_server: remember the max_{trans,read,write} sizes we negotiated (bug #8473)
We should enforce the negotiated max sizes instead of the lp_smb2_max_*() sizes. metze (cherry picked from commit 40ea66c5dda91ba3f74bed7db1ce02f6c8b4ffeb) (cherry picked from commit 9c0650a066812dd6306463738c3d5a3823938c2c)
-rw-r--r--source3/smbd/globals.h3
-rw-r--r--source3/smbd/smb2_find.c2
-rw-r--r--source3/smbd/smb2_negprot.c4
-rw-r--r--source3/smbd/smb2_notify.c2
-rw-r--r--source3/smbd/smb2_read.c4
-rw-r--r--source3/smbd/smb2_write.c5
6 files changed, 12 insertions, 8 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 70338489402..9304a43cdd3 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -604,6 +604,9 @@ struct smbd_server_connection {
uint64_t seqnum_low;
uint32_t credits_granted;
uint32_t max_credits;
+ uint32_t max_trans;
+ uint32_t max_read;
+ uint32_t max_write;
struct bitmap *credits_bitmap;
bool compound_related_in_progress;
} smb2;
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index 4a49f2a7a47..3dcc76862b0 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -281,7 +281,7 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
- if (in_output_buffer_length > lp_smb2_max_trans()) {
+ if (in_output_buffer_length > smb2req->sconn->smb2.max_trans) {
tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
return tevent_req_post(req, ev);
}
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index a9d432ac76d..2f45b8c756a 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -81,7 +81,6 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
uint32_t max_read = lp_smb2_max_read();
uint32_t max_write = lp_smb2_max_write();
-
status = smbd_smb2_request_verify_sizes(req, 0x24);
if (!NT_STATUS_IS_OK(status)) {
return smbd_smb2_request_error(req, status);
@@ -185,6 +184,9 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
outdyn = security_buffer;
req->sconn->using_smb2 = true;
+ req->sconn->smb2.max_trans = max_trans;
+ req->sconn->smb2.max_read = max_read;
+ req->sconn->smb2.max_write = max_write;
return smbd_smb2_request_done(req, outbody, &outdyn);
}
diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c
index a8b1eb433ab..49c6a544972 100644
--- a/source3/smbd/smb2_notify.c
+++ b/source3/smbd/smb2_notify.c
@@ -73,7 +73,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 > lp_smb2_max_trans()) {
+ if (in_output_buffer_length > req->sconn->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 89fc420cd32..21082e67cd8 100644
--- a/source3/smbd/smb2_read.c
+++ b/source3/smbd/smb2_read.c
@@ -74,9 +74,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 > lp_smb2_max_read()) {
+ if (in_length > req->sconn->smb2.max_read) {
DEBUG(0,("here:%s: 0x%08X: 0x%08X\n",
- __location__, in_length, lp_smb2_max_read()));
+ __location__, in_length, req->sconn->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 020209892b1..3a6ea9bfdbf 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -78,11 +78,10 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
}
/* check the max write size */
- if (in_data_length > lp_smb2_max_write()) {
- /* This is a warning. */
+ if (in_data_length > req->sconn->smb2.max_write) {
DEBUG(2,("smbd_smb2_request_process_write : "
"client ignored max write :%s: 0x%08X: 0x%08X\n",
- __location__, in_data_length, lp_smb2_max_write()));
+ __location__, in_data_length, req->sconn->smb2.max_write));
#if 0
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
#endif