From: Andreas Schneider Date: Tue, 1 Dec 2020 12:50:16 +0000 (+0100) Subject: s3:rpcclient: Pass cli_credentials to process_cmd() X-Git-Tag: tevent-0.11.0~792 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f9c07c021280c41cc71abe8175ae35bcd5cd651;p=thirdparty%2Fsamba.git s3:rpcclient: Pass cli_credentials to process_cmd() Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 90fa0346248..a7a9748968d 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -1048,7 +1048,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, * * @returns The NTSTATUS from running the command. **/ -static NTSTATUS process_cmd(struct user_auth_info *auth_info, +static NTSTATUS process_cmd(struct cli_credentials *creds, struct cli_state *cli, struct dcerpc_binding *binding, char *cmd) @@ -1058,8 +1058,6 @@ static NTSTATUS process_cmd(struct user_auth_info *auth_info, int ret; int argc; const char **argv = NULL; - struct cli_credentials *creds = - get_cmdline_auth_info_creds(auth_info); if ((ret = poptParseArgvString(cmd, &argc, &argv)) != 0) { fprintf(stderr, "rpcclient: %s\n", poptStrerror(ret)); @@ -1136,6 +1134,7 @@ out_free: const char *binding_string = NULL; const char *host; int signing_state = SMB_SIGNING_IPC_DEFAULT; + struct cli_credentials *creds = NULL; /* make sure the vars that get altered (4th field) are in a fixed location or certain compilers complain */ @@ -1204,6 +1203,7 @@ out_free: popt_burn_cmdline_password(argc, argv); rpcclient_msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE()); + creds = get_cmdline_auth_info_creds(popt_get_cmdline_auth_info()); /* * Get password @@ -1309,9 +1309,10 @@ out_free: result = 0; while((cmd=next_command(&p)) != NULL) { - NTSTATUS cmd_result = process_cmd( - popt_get_cmdline_auth_info(), - cli, binding, cmd); + NTSTATUS cmd_result = process_cmd(creds, + cli, + binding, + cmd); SAFE_FREE(cmd); result = NT_STATUS_IS_ERR(cmd_result); } @@ -1332,8 +1333,10 @@ out_free: } if (line[0] != '\n') - process_cmd(popt_get_cmdline_auth_info(), cli, - binding, line); + process_cmd(creds, + cli, + binding, + line); SAFE_FREE(line); }