From 7f40b606c497c56d05c376c6af82f1c3e4504529 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 Sep 2011 17:29:58 +0200 Subject: s3:libsmb: use local variables in cli_state_create() 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 Autobuild-Date: Thu Sep 15 10:12:17 CEST 2011 on sn-devel-104 --- source3/include/client.h | 4 ---- source3/libsmb/cliconnect.c | 5 ----- source3/libsmb/clientgen.c | 26 ++++++++++++++------------ 3 files changed, 14 insertions(+), 21 deletions(-) (limited to 'source3') diff --git a/source3/include/client.h b/source3/include/client.h index 37dbf028a1..8a26e73c15 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -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. */ diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 24af427d1f..b896f28b0e 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -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; diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 3198c7a733..05f95489ad 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -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; } -- cgit