diff options
author | Christof Schmitt <cs@samba.org> | 2018-08-20 16:01:00 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-10-09 11:29:23 +0200 |
commit | bf4cd2a74c7d2d75ec57775fe721cb53b6633e39 (patch) | |
tree | d15b0b5a7cba0576beca92c7b717987b4e90f7aa /source3 | |
parent | 12afd47edcf1d1e27c67f6617483223fe04cc63a (diff) | |
download | samba-bf4cd2a74c7d2d75ec57775fe721cb53b6633e39.tar.gz |
s3:net: 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>
(backported from commit f2b659e4f518ccb06f221dd028f99883ca1a1847)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 9ee32cd6110..759d8cd442b 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -48,6 +48,7 @@ #include "../libcli/security/security.h" #include "passdb.h" #include "messages.h" +#include "cmdline_contexts.h" #ifdef WITH_FAKE_KASERVER #include "utils/net_afs.h" @@ -916,7 +917,6 @@ 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'}, @@ -1030,28 +1030,7 @@ static struct functable net_func[] = { } } - if (!lp_load_initial_only(get_dyn_CONFIGFILE())) { - d_fprintf(stderr, "Can't load %s - run testparm to debug it\n", - get_dyn_CONFIGFILE()); - exit(1); - } - - 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); - } + c->msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE()); if (!lp_load_global(get_dyn_CONFIGFILE())) { d_fprintf(stderr, "Can't load %s - run testparm to debug it\n", |