s3:libsmb: use local variables in cli_state_create()
authorStefan Metzmacher <metze@samba.org>
Thu, 8 Sep 2011 15:29:58 +0000 (17:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Sep 2011 08:12:17 +0000 (10:12 +0200)
We don't need to keep use_spnego, use_level_II_oplocks, force_dos_errors
and force_ascii within struct cli_state.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Sep 15 10:12:17 CEST 2011 on sn-devel-104

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

index 37dbf028a163d7c43510160ede1dfdd22f0559fc..8a26e73c155c03c7e17cd48a12f07afcc992af8a 100644 (file)
@@ -96,15 +96,11 @@ struct cli_state {
 
        bool use_kerberos;
        bool fallback_after_kerberos;
-       bool use_spnego;
        bool use_ccache;
        bool got_kerberos_mechanism; /* Server supports krb5 in SPNEGO. */
 
        bool use_oplocks; /* should we use oplocks? */
-       bool use_level_II_oplocks; /* should we use level II oplocks? */
 
-       bool force_dos_errors;
-       bool force_ascii;
        bool case_sensitive; /* False by default. */
 
        /* Where (if anywhere) this is mounted under DFS. */
index 24af427d1fea5fe0c7f3e4d99301cebde3fb4ce6..b896f28b0ef60142094bb610a7145a5248396adf 100644 (file)
@@ -2557,9 +2557,6 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
        }
        state->cli = cli;
 
-       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;
@@ -2708,7 +2705,6 @@ static void cli_negprot_done(struct tevent_req *subreq)
                        return;
                }
 
-               cli->use_spnego = False;
                cli->sec_mode = SVAL(vwv + 1, 0);
                cli->max_xmit = SVAL(vwv + 2, 0);
                cli->max_mux = SVAL(vwv + 3, 0);
@@ -2723,7 +2719,6 @@ static void cli_negprot_done(struct tevent_req *subreq)
                cli->secblob = data_blob(bytes, num_bytes);
        } else {
                /* the old core protocol */
-               cli->use_spnego = False;
                cli->sec_mode = 0;
                cli->serverzone = get_time_zone(time(NULL));
                cli->max_xmit = 1024;
index 3198c7a7336a90d6b2e8a6bb2c1887a45a474e9d..05f95489ad496759d8c1b94d12410e43ab7aa627 100644 (file)
@@ -173,6 +173,10 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
        bool mandatory_signing;
        socklen_t ss_length;
        int ret;
+       bool use_spnego = lp_client_use_spnego();
+       bool force_dos_errors = false;
+       bool force_ascii = false;
+       bool use_level_II_oplocks = false;
 
        /* Check the effective uid - make sure we are not setuid */
        if (is_setuid_root()) {
@@ -195,27 +199,25 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
        cli->max_xmit = CLI_BUFFER_SIZE+4;
        cli->case_sensitive = false;
 
-       cli->use_spnego = lp_client_use_spnego();
-
        /* Set the CLI_FORCE_DOSERR environment variable to test
           client routines using DOS errors instead of STATUS32
           ones.  This intended only as a temporary hack. */    
        if (getenv("CLI_FORCE_DOSERR")) {
-               cli->force_dos_errors = true;
+               force_dos_errors = true;
        }
        if (flags & CLI_FULL_CONNECTION_FORCE_DOS_ERRORS) {
-               cli->force_dos_errors = true;
+               force_dos_errors = true;
        }
 
        if (getenv("CLI_FORCE_ASCII")) {
-               cli->force_ascii = true;
+               force_ascii = true;
        }
        if (flags & CLI_FULL_CONNECTION_FORCE_ASCII) {
-               cli->force_ascii = true;
+               force_ascii = true;
        }
 
        if (flags & CLI_FULL_CONNECTION_DONT_SPNEGO) {
-               cli->use_spnego = false;
+               use_spnego = false;
        } else if (flags & CLI_FULL_CONNECTION_USE_KERBEROS) {
                cli->use_kerberos = true;
        }
@@ -232,7 +234,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                cli->use_oplocks = true;
        }
        if (flags & CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS) {
-               cli->use_level_II_oplocks = true;
+               use_level_II_oplocks = true;
        }
 
        if (signing_state == Undefined) {
@@ -285,19 +287,19 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
        cli->capabilities |= CAP_LARGE_READX|CAP_LARGE_WRITEX;
        cli->capabilities |= CAP_LWIO;
 
-       if (!cli->force_dos_errors) {
+       if (!force_dos_errors) {
                cli->capabilities |= CAP_STATUS32;
        }
 
-       if (!cli->force_ascii) {
+       if (!force_ascii) {
                cli->capabilities |= CAP_UNICODE;
        }
 
-       if (cli->use_spnego) {
+       if (use_spnego) {
                cli->capabilities |= CAP_EXTENDED_SECURITY;
        }
 
-       if (cli->use_level_II_oplocks) {
+       if (use_level_II_oplocks) {
                cli->capabilities |= CAP_LEVEL_II_OPLOCKS;
        }