summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2016-11-14 09:51:52 +0100
committerJeremy Allison <jra@samba.org>2016-11-16 00:20:06 +0100
commit4c6f7b18f6bab6b991c678b1b010dc96a0a46f01 (patch)
tree236988ce0c132175496d0c37ca71ba0c10ceaf5d /source3/rpcclient
parentacf2e77473ba69ee74cf42527cacad06bb588cdf (diff)
downloadsamba-4c6f7b18f6bab6b991c678b1b010dc96a0a46f01.tar.gz
s3:rpcclient: Use messaging_init_client()
Pair-Programmed-With: Jeremy Allison <jra@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/rpcclient.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 6cc17d15f6f..35f17bb7bd6 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -1025,9 +1025,19 @@ out_free:
goto done;
}
- rpcclient_msg_ctx = messaging_init(talloc_autofree_context(),
- samba_tevent_context_init(talloc_autofree_context()));
- if (rpcclient_msg_ctx == NULL) {
+ nt_status = messaging_init_client(talloc_autofree_context(),
+ samba_tevent_context_init(talloc_autofree_context()),
+ &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;