mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
s3:libsmb: Remove unused password copy stored in cli_state
Change-Id: Ia6b33a25628ae08be8a8c6baeb71ce390315cb45 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user