s3:libsmb/cli*: make use of cli_state_protocol()
authorStefan Metzmacher <metze@samba.org>
Mon, 1 Aug 2011 15:01:42 +0000 (17:01 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 2 Aug 2011 02:54:29 +0000 (04:54 +0200)
metze

source3/libsmb/cliconnect.c
source3/libsmb/clidfs.c
source3/libsmb/clientgen.c
source3/libsmb/clilist.c

index 1547a241be20562f76c829694d556294225672f9..d91d241eaff73cf8e427821485a7c13e8d2c4687 100644 (file)
@@ -1995,7 +1995,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
                workgroup = user2;
        }
 
-       if (cli->protocol < PROTOCOL_LANMAN1) {
+       if (cli_state_protocol(cli) < PROTOCOL_LANMAN1) {
                return NT_STATUS_OK;
        }
 
@@ -2005,7 +2005,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 
        /* if its an older server then we have to use the older request format */
 
-       if (cli->protocol < PROTOCOL_NT1) {
+       if (cli_state_protocol(cli) < PROTOCOL_NT1) {
                if (!lp_client_lanman_auth() && passlen != 24 && (*pass)) {
                        DEBUG(1, ("Server requested LM password but 'client lanman auth = no'"
                                  " or 'client ntlmv2 auth = yes'\n"));
@@ -2390,7 +2390,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
                }
        }
 
-       if ((cli->protocol >= PROTOCOL_NT1) && (num_bytes == 3)) {
+       if ((cli_state_protocol(cli) >= PROTOCOL_NT1) && (num_bytes == 3)) {
                /* almost certainly win95 - enable bug fixes */
                cli->win95 = True;
        }
@@ -2402,7 +2402,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
 
        cli->dfsroot = false;
 
-       if ((wct > 2) && (cli->protocol >= PROTOCOL_LANMAN2)) {
+       if ((wct > 2) && (cli_state_protocol(cli) >= PROTOCOL_LANMAN2)) {
                cli->dfsroot = ((SVAL(vwv+2, 0) & SMB_SHARE_IN_DFS) != 0);
        }
 
@@ -2559,13 +2559,13 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
        }
        state->cli = cli;
 
-       if (cli->protocol < PROTOCOL_NT1)
+       if (cli_state_protocol(cli) < PROTOCOL_NT1)
                cli->use_spnego = False;
 
        /* setup the protocol strings */
        for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) {
                uint8_t c = 2;
-               if (prots[numprots].prot > cli->protocol) {
+               if (prots[numprots].prot > cli_state_protocol(cli)) {
                        break;
                }
                bytes = (uint8_t *)talloc_append_blob(
@@ -2618,21 +2618,21 @@ static void cli_negprot_done(struct tevent_req *subreq)
        protnum = SVAL(vwv, 0);
 
        if ((protnum >= ARRAY_SIZE(prots))
-           || (prots[protnum].prot > cli->protocol)) {
+           || (prots[protnum].prot > cli_state_protocol(cli))) {
                tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
                return;
        }
 
        cli->protocol = prots[protnum].prot;
 
-       if ((cli->protocol < PROTOCOL_NT1) &&
+       if ((cli_state_protocol(cli) < PROTOCOL_NT1) &&
            client_is_signing_mandatory(cli)) {
                DEBUG(0,("cli_negprot: SMB signing is mandatory and the selected protocol level doesn't support it.\n"));
                tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
                return;
        }
 
-       if (cli->protocol >= PROTOCOL_NT1) {    
+       if (cli_state_protocol(cli) >= PROTOCOL_NT1) {
                struct timespec ts;
                bool negotiated_smb_signing = false;
 
@@ -2695,7 +2695,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
                        cli_set_signing_negotiated(cli);
                }
 
-       } else if (cli->protocol >= PROTOCOL_LANMAN1) {
+       } else if (cli_state_protocol(cli) >= PROTOCOL_LANMAN1) {
                cli->use_spnego = False;
                cli->sec_mode = SVAL(vwv + 1, 0);
                cli->max_xmit = SVAL(vwv + 2, 0);
index 514ff8069578cd6e9c9a739829ab72f81ab1d5a2..e54da6fe8950271b0b210ea7549a1c4ee57bbb51 100644 (file)
@@ -858,7 +858,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
                             dfs_auth_info,
                             false,
                             (rootcli->trans_enc_state != NULL),
-                            rootcli->protocol,
+                            cli_state_protocol(rootcli),
                             0,
                             0x20,
                             &cli_ipc);
@@ -909,7 +909,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
                             dfs_auth_info,
                             false,
                             (rootcli->trans_enc_state != NULL),
-                            rootcli->protocol,
+                            cli_state_protocol(rootcli),
                             0,
                             0x20,
                             targetcli);
index 2e45044e1432e440a155dc708bde80149a95ba25..f9bb7819805d903f52b4b6aa79f30cc44f76b506 100644 (file)
@@ -73,7 +73,7 @@ void cli_setup_packet_buf(struct cli_state *cli, char *buf)
        SSVAL(buf,smb_uid, cli_state_get_uid(cli));
        SSVAL(buf,smb_mid,cli->smb1.mid);
 
-       if (cli->protocol <= PROTOCOL_CORE) {
+       if (cli_state_protocol(cli) <= PROTOCOL_CORE) {
                return;
        }
 
index e9a3355b6901404b01283f70e404285316ad5013..ba3dd2b2b5ea79e968f839906c811eecca7128bf 100644 (file)
@@ -875,7 +875,7 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       if (cli->protocol <= PROTOCOL_LANMAN1) {
+       if (cli_state_protocol(cli) <= PROTOCOL_LANMAN1) {
                subreq = cli_list_old_send(state, ev, cli, mask, attribute);
                state->recv_fn = cli_list_old_recv;
        } else {