s3:smb2_server: remember the max_{trans,read,write} sizes we negotiated (bug #8473)
authorStefan Metzmacher <metze@samba.org>
Fri, 23 Sep 2011 15:18:14 +0000 (17:18 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 12 Oct 2011 23:59:05 +0000 (01:59 +0200)
We should enforce the negotiated max sizes instead of the
lp_smb2_max_*() sizes.

metze

source3/smbd/globals.h
source3/smbd/smb2_find.c
source3/smbd/smb2_negprot.c
source3/smbd/smb2_notify.c
source3/smbd/smb2_read.c
source3/smbd/smb2_write.c

index 4d954534dc393d254a49b915fcc79615c87c49b5..7095790b7ca565b968768fa22eb6176b07b4e8e8 100644 (file)
@@ -610,6 +610,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;
index 509b9d6ecd9089b8b0f3e556ee0680a115017518..e64db24d02be477b371227bc06a0e23a7c7eccb2 100644 (file)
@@ -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);
        }
index c5ac2d553aec7694bc2b3e34313a503cecb99e82..1733728c5f0661bd78de55633c484cf8c979ca1b 100644 (file)
@@ -101,7 +101,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);
@@ -245,6 +244,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);
 }
index a8b1eb433ab852bd713b899e7d477e12c5c03566..49c6a5449722484d562d53d3f23d7a5a27cff232 100644 (file)
@@ -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);
        }
 
index 99f6e7a91f3b4534813adb37769394b8e32615af..405e82d0f7f78812649982d00e84b7777abb6b02 100644 (file)
@@ -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);
        }
 
index b47f8a02a1c4ce5da802d293d91d9a7f4dd9d80e..e95b9676087ea4bd46bd15235dce5c0f421cdb3a 100644 (file)
@@ -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