summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorChristof Schmitt <cs@samba.org>2018-08-20 15:54:11 -0700
committerAndreas Schneider <asn@cryptomilk.org>2018-09-07 17:26:15 +0200
commitdd3ae2ffdc66be4707471bfccf27ef446b5599cb (patch)
treedc82d1d8790682ad33b691d4867a5fcd847d83d9 /source3/rpcclient
parentd7fa3815a83a50fd9e3d78cac0d5ef3eb79235e5 (diff)
downloadsamba-dd3ae2ffdc66be4707471bfccf27ef446b5599cb.tar.gz
rpcclient: Use cmdline_messaging_context
Use cmdline_messaging_context with its error checking instead of open coding the same steps. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/rpcclient.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index f7e196226cf..9f95f1a7a8c 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -35,6 +35,7 @@
#include "auth/gensec/gensec.h"
#include "../libcli/smb/smbXcli_base.h"
#include "messages.h"
+#include "cmdline_contexts.h"
enum pipe_auth_type_spnego {
PIPE_AUTH_TYPE_SPNEGO_NONE = 0,
@@ -950,7 +951,6 @@ 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 */
@@ -1016,30 +1016,7 @@ 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(ev_ctx,
- ev_ctx,
- &rpcclient_msg_ctx);
- if (geteuid() != 0 &&
- NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
- /*
- * Normal to fail to initialize messaging context
- * if we're not root as we don't have ability to
- * read lock directory.
- */
- DBG_NOTICE("Unable to initialize messaging context. "
- "Must be root to do that.\n");
- } else if (!NT_STATUS_IS_OK(nt_status)) {
- fprintf(stderr, "Could not init messaging context\n");
- result = 1;
- goto done;
- }
+ rpcclient_msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE());
if (!init_names()) {
result = 1;
@@ -1258,7 +1235,6 @@ done:
popt_free_cmdline_auth_info();
netlogon_creds_cli_close_global_db();
TALLOC_FREE(rpcclient_msg_ctx);
- TALLOC_FREE(ev_ctx);
TALLOC_FREE(frame);
return result;
}