diff options
author | Andreas Schneider <asn@samba.org> | 2016-11-14 09:54:53 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-11-16 00:20:06 +0100 |
commit | 233b903f3ffaae702c4d4e984ddc8a7871b47529 (patch) | |
tree | 89ff24a101d0f5da60be6fd08136caab4e620324 /source3/utils/net.c | |
parent | 4c6f7b18f6bab6b991c678b1b010dc96a0a46f01 (diff) | |
download | samba-233b903f3ffaae702c4d4e984ddc8a7871b47529.tar.gz |
s3:net: 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/utils/net.c')
-rw-r--r-- | source3/utils/net.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 3d0940d164c..beb8760bda8 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -786,6 +786,7 @@ static struct functable net_func[] = { poptContext pc; TALLOC_CTX *frame = talloc_stackframe(); struct net_context *c = talloc_zero(frame, struct net_context); + NTSTATUS status; struct poptOption long_options[] = { {"help", 'h', POPT_ARG_NONE, 0, 'h'}, @@ -905,11 +906,22 @@ static struct functable net_func[] = { exit(1); } - /* - * Failing to init the msg_ctx isn't a fatal error. Only root-level - * things (joining/leaving domains etc.) will be denied. - */ - c->msg_ctx = messaging_init(c, samba_tevent_context_init(c)); + status = messaging_init_client(c, + samba_tevent_context_init(c), + &c->msg_ctx); + if (geteuid() != 0 && + NT_STATUS_EQUAL(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(status)) { + d_fprintf(stderr, "Failed to init messaging context\n"); + exit(1); + } if (!lp_load_global(get_dyn_CONFIGFILE())) { d_fprintf(stderr, "Can't load %s - run testparm to debug it\n", |