s3:libsmb: Remove unused password copy stored in cli_state
authorAndrew Bartlett <abartlet@samba.org>
Tue, 23 Sep 2014 21:19:35 +0000 (14:19 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 17 Oct 2014 10:57:07 +0000 (12:57 +0200)
Change-Id: Ia6b33a25628ae08be8a8c6baeb71ce390315cb45
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/include/client.h
source3/lib/netapi/cm.c
source3/libsmb/cliconnect.c
source3/libsmb/clidfs.c
source3/libsmb/clientgen.c
source3/libsmb/libsmb_server.c
source3/libsmb/passchange.c
source3/libsmb/proto.h
source3/winbindd/winbindd_cm.c

index 59fb104cae518f376451365b41f8b203af0ea217..c19a7755c411bdb90ea2beceae51768c545ff3f0 100644 (file)
@@ -55,7 +55,6 @@ struct cli_state {
        /* The credentials used to open the cli_state connection. */
        char *domain;
        char *user_name;
-       char *password; /* Can be null to force use of zero NTLMSSP session key. */
 
        /*
         * The following strings are the
index 801e61f4a4542ca68308fa437b2650c61f70337f..cad84aa18d264dc8019b52923dcb93a267c3956b 100644 (file)
@@ -115,7 +115,6 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
                             0, 0x20, &cli_ipc);
        if (NT_STATUS_IS_OK(status)) {
                cli_set_username(cli_ipc, ctx->username);
-               cli_set_password(cli_ipc, ctx->password);
                cli_set_domain(cli_ipc, ctx->workgroup);
        } else {
                cli_ipc = NULL;
index e1fc4e903cc0716cabdc40f02dc5c4e15907eefb..1960fe7e60b2c29cb65df5ccf20ffd4038980c3d 100644 (file)
@@ -3389,8 +3389,7 @@ static void cli_full_connection_sess_set_up(struct tevent_req *subreq)
                return;
        }
 
-       status = cli_init_creds(state->cli, state->user, state->domain,
-                               state->password);
+       status = cli_init_creds(state->cli, state->user, state->domain);
        if (tevent_req_nterror(req, status)) {
                return;
        }
@@ -3410,8 +3409,7 @@ static void cli_full_connection_done(struct tevent_req *subreq)
        if (tevent_req_nterror(req, status)) {
                return;
        }
-       status = cli_init_creds(state->cli, state->user, state->domain,
-                               state->password);
+       status = cli_init_creds(state->cli, state->user, state->domain);
        if (tevent_req_nterror(req, status)) {
                return;
        }
index 93f04c50746b549aa48133eb54d454412175a13d..e679d9dbd8e0602cbab9d01846a8e9b3b29e4179 100644 (file)
@@ -207,9 +207,9 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
                        return status;
                }
                d_printf("Anonymous login successful\n");
-               status = cli_init_creds(c, "", lp_workgroup(), "");
+               status = cli_init_creds(c, "", lp_workgroup());
        } else {
-               status = cli_init_creds(c, username, lp_workgroup(), password);
+               status = cli_init_creds(c, username, lp_workgroup());
        }
 
        if (!NT_STATUS_IS_OK(status)) {
index 71ec1dcc99a11992e2f6212631e589d398b051cf..1f03560f8a63ea0716e796d82a14ae3e0ae48cfe 100644 (file)
@@ -89,29 +89,11 @@ NTSTATUS cli_set_username(struct cli_state *cli, const char *username)
        return NT_STATUS_OK;
 }
 
-NTSTATUS cli_set_password(struct cli_state *cli, const char *password)
-{
-       TALLOC_FREE(cli->password);
-
-       /* Password can be NULL. */
-       if (password) {
-               cli->password = talloc_strdup(cli, password);
-               if (cli->password == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-       } else {
-               /* Use zero NTLMSSP hashes and session key. */
-               cli->password = NULL;
-       }
-
-       return NT_STATUS_OK;
-}
-
 /****************************************************************************
  Initialise credentials of a client structure.
 ****************************************************************************/
 
-NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password)
+NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain)
 {
        NTSTATUS status = cli_set_username(cli, username);
        if (!NT_STATUS_IS_OK(status)) {
@@ -123,7 +105,7 @@ NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char
        }
        DEBUG(10,("cli_init_creds: user %s domain %s\n", cli->user_name, cli->domain));
 
-       return cli_set_password(cli, password);
+       return NT_STATUS_OK;
 }
 
 /****************************************************************************
index d89b9ec9dc3f3ad36c4dcb8127e53d4990d4e70c..2d8eebbb339b19f90ab1015896195bc8092290be 100644 (file)
@@ -489,7 +489,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
        }
 
        status = cli_init_creds(c, username_used,
-                               *pp_workgroup, *pp_password);
+                               *pp_workgroup);
        if (!NT_STATUS_IS_OK(status)) {
                errno = map_errno_from_nt_status(status);
                cli_shutdown(c);
index 8acd432cc34fca72d15191dd540829bb8e81dc40..344f2a4aa3536c486e86dda617f9c27f9b9ce8db 100644 (file)
@@ -123,13 +123,13 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
                        return result;
                }
 
-               result = cli_init_creds(cli, "", "", NULL);
+               result = cli_init_creds(cli, "", "");
                if (!NT_STATUS_IS_OK(result)) {
                        cli_shutdown(cli);
                        return result;
                }
        } else {
-               result = cli_init_creds(cli, user, domain, old_passwd);
+               result = cli_init_creds(cli, user, domain);
                if (!NT_STATUS_IS_OK(result)) {
                        cli_shutdown(cli);
                        return result;
@@ -222,7 +222,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
        TALLOC_FREE(pipe_hnd);
 
        /* Try anonymous NTLMSSP... */
-       result = cli_init_creds(cli, "", "", NULL);
+       result = cli_init_creds(cli, "", "");
        if (!NT_STATUS_IS_OK(result)) {
                cli_shutdown(cli);
                return result;
index 2efb20839820327dccd3df59ecf091790d92e3af..7693106101f81042e67511ef8745cb4c12f6acf4 100644 (file)
@@ -163,8 +163,7 @@ bool cli_set_backup_intent(struct cli_state *cli, bool flag);
 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
-NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
-NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
+NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain);
 extern struct GUID cli_state_client_guid;
 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                                   int fd,
index 7c466820d915b5fdf35b655671dd2811de9e3932..8d1af8967e31af323557479978a5032cabfd9b9c 100644 (file)
@@ -1116,7 +1116,7 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
                if (NT_STATUS_IS_OK(result)) {
                        if (krb5_state != CRED_MUST_USE_KERBEROS) {
                                /* Ensure creds are stored for NTLMSSP authenticated pipe access. */
-                               result = cli_init_creds(*cli, machine_account, machine_domain, machine_password);
+                               result = cli_init_creds(*cli, machine_account, machine_domain);
                                if (!NT_STATUS_IS_OK(result)) {
                                        goto done;
                                }
@@ -1215,7 +1215,7 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 
        if (NT_STATUS_IS_OK(result)) {
                /* Ensure creds are stored for NTLMSSP authenticated pipe access. */
-               result = cli_init_creds(*cli, machine_account, machine_domain, machine_password);
+               result = cli_init_creds(*cli, machine_account, machine_domain);
                if (!NT_STATUS_IS_OK(result)) {
                        goto done;
                }