s3:libsmb: move cli->sec_mode to cli->conn.smb1.server.security_mode
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Sep 2011 14:48:18 +0000 (16:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Sep 2011 10:12:24 +0000 (12:12 +0200)
metze

source3/include/client.h
source3/libsmb/cliconnect.c
source3/libsmb/clientgen.c

index 1e3ab5094912286c8454ef242d743c81bee1d3f5..06e3c7aa7de382259fe08fc532adb8744c0a3b12 100644 (file)
@@ -42,7 +42,6 @@ struct cli_state {
         * A list of subsidiary connections for DFS.
         */
         struct cli_state *prev, *next;
-       int sec_mode;
        int rap_error;
        NTSTATUS raw_status; /* maybe via NT_STATUS_DOS() */
 
@@ -135,6 +134,7 @@ struct cli_state {
                                uint32_t capabilities;
                                uint32_t max_xmit;
                                uint16_t max_mux;
+                               uint16_t security_mode;
                        } server;
 
                        uint32_t capabilities;
index 50014f57f7af6c45364b08e5c9981c1a9171e30f..b571d0f59ad1a2ec39f2280228c1959cb7e72703 100644 (file)
@@ -2615,6 +2615,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
        uint32_t server_max_xmit = 0;
        uint32_t max_xmit;
        uint32_t server_max_mux = 0;
+       uint16_t server_security_mode = 0;
        enum protocol_types protocol;
 
        status = cli_smb_recv(subreq, state, &inbuf, 1, &wct, &vwv,
@@ -2656,7 +2657,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
                }
 
                /* NT protocol */
-               cli->sec_mode = CVAL(vwv + 1, 0);
+               server_security_mode = CVAL(vwv + 1, 0);
                server_max_mux = SVAL(vwv + 1, 1);
                server_max_xmit = IVAL(vwv + 3, 1);
                cli->sesskey = IVAL(vwv + 7, 1);
@@ -2692,11 +2693,11 @@ static void cli_negprot_done(struct tevent_req *subreq)
                }
 
                server_signing = "not supported";
-               if (cli->sec_mode & NEGOTIATE_SECURITY_SIGNATURES_ENABLED) {
+               if (server_security_mode & NEGOTIATE_SECURITY_SIGNATURES_ENABLED) {
                        server_signing = "supported";
                        server_allowed = true;
                }
-               if (cli->sec_mode & NEGOTIATE_SECURITY_SIGNATURES_REQUIRED) {
+               if (server_security_mode & NEGOTIATE_SECURITY_SIGNATURES_REQUIRED) {
                        server_signing = "required";
                        server_mandatory = true;
                }
@@ -2718,7 +2719,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
                        return;
                }
 
-               cli->sec_mode = SVAL(vwv + 1, 0);
+               server_security_mode = SVAL(vwv + 1, 0);
                server_max_xmit = SVAL(vwv + 2, 0);
                server_max_mux = SVAL(vwv + 3, 0);
                cli->sesskey = IVAL(vwv + 6, 0);
@@ -2732,10 +2733,10 @@ static void cli_negprot_done(struct tevent_req *subreq)
                cli->secblob = data_blob(bytes, num_bytes);
        } else {
                /* the old core protocol */
-               cli->sec_mode = 0;
                cli->serverzone = get_time_zone(time(NULL));
                server_max_xmit = 1024;
                server_max_mux = 1;
+               server_security_mode = 0;
        }
 
        if (server_max_xmit < 1024) {
@@ -2772,6 +2773,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
 
        cli->conn.smb1.server.max_mux = server_max_mux;
 
+       cli->conn.smb1.server.security_mode = server_security_mode;
+
        tevent_req_done(req);
 }
 
index aef31b5aa0a1983f2caa1b58999ba009b38449dd..34826b0beae2f0b5f9563812785a87811cb9e356 100644 (file)
@@ -568,7 +568,7 @@ uint16_t cli_state_max_requests(struct cli_state *cli)
 
 uint16_t cli_state_security_mode(struct cli_state *cli)
 {
-       return cli->sec_mode;
+       return cli->conn.smb1.server.security_mode;
 }
 
 int cli_state_server_time_zone(struct cli_state *cli)