diff options
author | Jeremy Allison <jra@samba.org> | 2017-07-24 13:10:30 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-07-26 21:35:22 +0200 |
commit | 1d6b98cdab4f0a400673cf967225214e858ab1ee (patch) | |
tree | 31f5cff81a26e3c589ba257b639bd4d99b8b03c4 /source3/rpcclient | |
parent | 1fb46b76dbcf28d8c71ff1096c402953a90bcf5f (diff) | |
download | samba-1d6b98cdab4f0a400673cf967225214e858ab1ee.tar.gz |
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>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/rpcclient.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index be7769672c0..835b288ee20 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -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; } |