summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2016-10-05 08:39:20 +0200
committerJeremy Allison <jra@samba.org>2016-10-06 02:30:17 +0200
commitfb155a946d995de2c518d22bdb44f3d7f0b8dca3 (patch)
treebb0affb9e6cad0e0ff593a5266726d62cac6f186 /source3/rpcclient
parent5148d3f4fa57ed040285ba38523e5fda7d6e3520 (diff)
downloadsamba-fb155a946d995de2c518d22bdb44f3d7f0b8dca3.tar.gz
s3-rpcclient: Fix initializing rpcclient
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/rpcclient.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 74ae7082030..3f7a8b7be38 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -905,6 +905,7 @@ out_free:
char *user, *domain, *q;
const char *host;
int signing_state = SMB_SIGNING_IPC_DEFAULT;
+ bool ok;
/* make sure the vars that get altered (4th field) are in
a fixed location or certain compilers complain */
@@ -976,21 +977,32 @@ out_free:
poptFreeContext(pc);
popt_burn_cmdline_password(argc, argv);
- if (!init_names()) {
+ /* Load smb.conf file */
+
+ ok = lp_load_global(get_dyn_CONFIGFILE());
+ if (!ok) {
+ fprintf(stderr,
+ "Can't load %s - run testparm to debug it\n",
+ get_dyn_CONFIGFILE());
result = 1;
goto done;
}
- /* Load smb.conf file */
-
- if (!lp_load_global(get_dyn_CONFIGFILE()))
- fprintf(stderr, "Can't load %s\n", get_dyn_CONFIGFILE());
+ rpcclient_msg_ctx = messaging_init(talloc_autofree_context(),
+ samba_tevent_context_init(talloc_autofree_context()));
+ if (rpcclient_msg_ctx == NULL) {
+ fprintf(stderr, "Could not init messaging context\n");
+ result = 1;
+ goto done;
+ }
/* We must load interfaces after we load the smb.conf */
load_interfaces();
- rpcclient_msg_ctx = messaging_init(talloc_autofree_context(),
- samba_tevent_context_init(talloc_autofree_context()));
+ if (!init_names()) {
+ result = 1;
+ goto done;
+ }
/*
* Get password