summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-06 12:01:44 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-06 16:37:22 +0100
commit3f3e15ab91373597390320269f5cd701d3f07a3b (patch)
tree3b40922aefc9d3f58d9cdbb4c02e241e0c9fd7b8
parent6e572d40a913f788f06e4bc7a7047129bc22ad5a (diff)
downloadsamba-3f3e15ab91373597390320269f5cd701d3f07a3b.tar.gz
samba-3f3e15ab91373597390320269f5cd701d3f07a3b.tar.bz2
samba-3f3e15ab91373597390320269f5cd701d3f07a3b.zip
s3:libsmb: merge cli_setup_signing_state() into cli_initialise_ex()
metze
-rw-r--r--source3/libsmb/clientgen.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 41b1fe8859..2983f7771a 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -425,33 +425,15 @@ void cli_init_creds(struct cli_state *cli, const char *username, const char *dom
}
/****************************************************************************
- Set the signing state (used from the command line).
-****************************************************************************/
-
-static void cli_setup_signing_state(struct cli_state *cli, int signing_state)
-{
- if (signing_state == Undefined)
- return;
-
- if (signing_state == false) {
- cli->sign_info.allow_smb_signing = false;
- cli->sign_info.mandatory_signing = false;
- return;
- }
-
- cli->sign_info.allow_smb_signing = true;
-
- if (signing_state == Required)
- cli->sign_info.mandatory_signing = true;
-}
-
-/****************************************************************************
Initialise a client structure. Always returns a malloc'ed struct.
+ Set the signing state (used from the command line).
****************************************************************************/
struct cli_state *cli_initialise_ex(int signing_state)
{
struct cli_state *cli = NULL;
+ bool allow_smb_signing = false;
+ bool mandatory_signing = false;
/* Check the effective uid - make sure we are not setuid */
if (is_setuid_root()) {
@@ -490,12 +472,27 @@ struct cli_state *cli_initialise_ex(int signing_state)
if (getenv("CLI_FORCE_DOSERR"))
cli->force_dos_errors = true;
- if (lp_client_signing())
- cli->sign_info.allow_smb_signing = true;
+ if (lp_client_signing()) {
+ allow_smb_signing = true;
+ }
+
+ if (lp_client_signing() == Required) {
+ mandatory_signing = true;
+ }
+
+ if (signing_state != Undefined) {
+ allow_smb_signing = true;
+ }
+
+ if (signing_state == false) {
+ allow_smb_signing = false;
+ mandatory_signing = false;
+ }
+
+ if (signing_state == Required) {
+ mandatory_signing = true;
+ }
- if (lp_client_signing() == Required)
- cli->sign_info.mandatory_signing = true;
-
if (!cli->outbuf || !cli->inbuf)
goto error;
@@ -510,8 +507,9 @@ struct cli_state *cli_initialise_ex(int signing_state)
#endif
/* initialise signing */
+ cli->sign_info.allow_smb_signing = allow_smb_signing;
+ cli->sign_info.mandatory_signing = mandatory_signing;
cli_null_set_signing(cli);
- cli_setup_signing_state(cli, signing_state);
cli->initialised = 1;