1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: rpcclient: Split out initialization and free of event context.

Allows us to control shutdown.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jeremy Allison 2017-07-24 13:10:30 -07:00
parent 1fb46b76db
commit 1d6b98cdab

View File

@ -948,6 +948,7 @@ out_free:
const char *binding_string = NULL;
const char *host;
int signing_state = SMB_SIGNING_IPC_DEFAULT;
struct tevent_context *ev_ctx = NULL;
/* make sure the vars that get altered (4th field) are in
a fixed location or certain compilers complain */
@ -1013,8 +1014,15 @@ out_free:
poptFreeContext(pc);
popt_burn_cmdline_password(argc, argv);
ev_ctx = samba_tevent_context_init(frame);
if (ev_ctx == NULL) {
fprintf(stderr, "Could not init event context\n");
result = 1;
goto done;
}
nt_status = messaging_init_client(talloc_autofree_context(),
samba_tevent_context_init(talloc_autofree_context()),
ev_ctx,
&rpcclient_msg_ctx);
if (geteuid() != 0 &&
NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
@ -1246,6 +1254,7 @@ done:
cli_shutdown(cli);
}
popt_free_cmdline_auth_info();
TALLOC_FREE(ev_ctx);
TALLOC_FREE(frame);
return result;
}