s3:smb2_server: use xconn->smb2.server.max_* instead of sconn->smb2.max_*
authorStefan Metzmacher <metze@samba.org>
Fri, 23 May 2014 08:22:34 +0000 (10:22 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 6 Aug 2014 07:51:11 +0000 (09:51 +0200)
We don't need this twice...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/smbd/globals.h
source3/smbd/smb2_find.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_negprot.c
source3/smbd/smb2_notify.c
source3/smbd/smb2_read.c
source3/smbd/smb2_setinfo.c
source3/smbd/smb2_write.c

index 3dd03978f4fd9b1e6d4cfa88a76d2373a62be865..129edbe23ae7d6fa6af63c756c2b9715e3ebbd72 100644 (file)
@@ -839,9 +839,6 @@ struct smbd_server_connection {
                 */
                struct bitmap *credits_bitmap;
                bool supports_multicredit;
-               uint32_t max_trans;
-               uint32_t max_read;
-               uint32_t max_write;
        } smb2;
 
        /*
index 6bc44a51450bd5e65ae35b90992873c4f5b71612..2d310a51527eebd5dd809dacac9822cc22817eec 100644 (file)
@@ -207,6 +207,7 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
                                              uint32_t in_output_buffer_length,
                                              const char *in_file_name)
 {
+       struct smbXsrv_connection *xconn = smb2req->sconn->conn;
        struct tevent_req *req;
        struct smbd_smb2_find_state *state;
        struct smb_request *smbreq;
@@ -273,11 +274,11 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       if (in_output_buffer_length > smb2req->sconn->smb2.max_trans) {
+       if (in_output_buffer_length > xconn->smb2.server.max_trans) {
                DEBUG(2,("smbd_smb2_find_send: "
                         "client ignored max trans:%s: 0x%08X: 0x%08X\n",
                         __location__, in_output_buffer_length,
-                        smb2req->sconn->smb2.max_trans));
+                        xconn->smb2.server.max_trans));
                tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
                return tevent_req_post(req, ev);
        }
index ec6181a3b443c99fc5fe589f28dd43e2c611bda6..275792c04120d6ef161be3e6a83e160677a9a165 100644 (file)
@@ -44,6 +44,7 @@ static NTSTATUS smbd_smb2_getinfo_recv(struct tevent_req *req,
 static void smbd_smb2_request_getinfo_done(struct tevent_req *subreq);
 NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->sconn->conn;
        NTSTATUS status;
        const uint8_t *inbody;
        uint8_t in_info_type;
@@ -90,18 +91,18 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req)
        in_input_buffer.data = SMBD_SMB2_IN_DYN_PTR(req);
        in_input_buffer.length = in_input_buffer_length;
 
-       if (in_input_buffer.length > req->sconn->smb2.max_trans) {
+       if (in_input_buffer.length > xconn->smb2.server.max_trans) {
                DEBUG(2,("smbd_smb2_request_process_getinfo: "
                         "client ignored max trans: %s: 0x%08X: 0x%08X\n",
                         __location__, (unsigned)in_input_buffer.length,
-                        (unsigned)req->sconn->smb2.max_trans));
+                        (unsigned)xconn->smb2.server.max_trans));
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
-       if (in_output_buffer_length > req->sconn->smb2.max_trans) {
+       if (in_output_buffer_length > xconn->smb2.server.max_trans) {
                DEBUG(2,("smbd_smb2_request_process_getinfo: "
                         "client ignored max trans: %s: 0x%08X: 0x%08X\n",
                         __location__, in_output_buffer_length,
-                        req->sconn->smb2.max_trans));
+                        xconn->smb2.server.max_trans));
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
 
index c7d88d94c2b1021d7a57f043b895b937c946bf4d..c2e1c71ac8baafff31af3d125a39669b3848008f 100644 (file)
@@ -394,10 +394,6 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
                conn->smb2.server.max_trans = max_trans;
                conn->smb2.server.max_read  = max_read;
                conn->smb2.server.max_write = max_write;
-
-               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 7351d9f60bc0516a6f51df43f731819e98393aad..3e33d42bcee218ed149b958955496c4faba8842e 100644 (file)
@@ -48,6 +48,7 @@ static NTSTATUS smbd_smb2_notify_recv(struct tevent_req *req,
 static void smbd_smb2_request_notify_done(struct tevent_req *subreq);
 NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->sconn->conn;
        NTSTATUS status;
        const uint8_t *inbody;
        uint16_t in_flags;
@@ -74,7 +75,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 > req->sconn->smb2.max_trans) {
+       if (in_output_buffer_length > xconn->smb2.server.max_trans) {
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
 
index b68a1b6a2f15c71c132a939851d7444b2df14a87..1679944ea209abc252718afc22ceb7b4ca83fde5 100644 (file)
@@ -43,6 +43,7 @@ static NTSTATUS smbd_smb2_read_recv(struct tevent_req *req,
 static void smbd_smb2_request_read_done(struct tevent_req *subreq);
 NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->sconn->conn;
        NTSTATUS status;
        const uint8_t *inbody;
        uint32_t in_length;
@@ -68,10 +69,10 @@ 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 > req->sconn->smb2.max_read) {
+       if (in_length > xconn->smb2.server.max_read) {
                DEBUG(2,("smbd_smb2_request_process_read: "
                         "client ignored max read: %s: 0x%08X: 0x%08X\n",
-                       __location__, in_length, req->sconn->smb2.max_read));
+                       __location__, in_length, xconn->smb2.server.max_read));
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
 
index 97872dae4477ad14b695eb883c03823968bad2f4..1b5e2a8e5e171fd134e994b7f7f311273b406a02 100644 (file)
@@ -39,6 +39,7 @@ static NTSTATUS smbd_smb2_setinfo_recv(struct tevent_req *req);
 static void smbd_smb2_request_setinfo_done(struct tevent_req *subreq);
 NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->sconn->conn;
        NTSTATUS status;
        const uint8_t *inbody;
        uint8_t in_info_type;
@@ -81,11 +82,11 @@ NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req)
        in_input_buffer.data = SMBD_SMB2_IN_DYN_PTR(req);
        in_input_buffer.length = in_input_buffer_length;
 
-       if (in_input_buffer.length > req->sconn->smb2.max_trans) {
+       if (in_input_buffer.length > xconn->smb2.server.max_trans) {
                DEBUG(2,("smbd_smb2_request_process_setinfo: "
                         "client ignored max trans: %s: 0x%08X: 0x%08X\n",
                         __location__, (unsigned)in_input_buffer.length,
-                        (unsigned)req->sconn->smb2.max_trans));
+                        (unsigned)xconn->smb2.server.max_trans));
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
 
index c61254f644cd5b229cf1c0468e18af2ae2aa92cc..40a59372ee40b04297fef9c4edbe7fd9e2fcc099 100644 (file)
@@ -38,6 +38,7 @@ static NTSTATUS smbd_smb2_write_recv(struct tevent_req *req,
 static void smbd_smb2_request_write_done(struct tevent_req *subreq);
 NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->sconn->conn;
        NTSTATUS status;
        const uint8_t *inbody;
        uint16_t in_data_offset;
@@ -82,10 +83,10 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
        }
 
        /* check the max write size */
-       if (in_data_length > req->sconn->smb2.max_write) {
+       if (in_data_length > xconn->smb2.server.max_write) {
                DEBUG(2,("smbd_smb2_request_process_write : "
                        "client ignored max write :%s: 0x%08X: 0x%08X\n",
-                       __location__, in_data_length, req->sconn->smb2.max_write));
+                       __location__, in_data_length, xconn->smb2.server.max_write));
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }