mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +03:00
s3:smbcontrol: Use cmdline_messaging_context
Initialize the messaging context through cmdline_messaging_context to allow access to config in clustered Samba. 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>
This commit is contained in:
parent
7eeff96b82
commit
de040eafbd
@ -35,6 +35,7 @@
|
|||||||
#include "util_tdb.h"
|
#include "util_tdb.h"
|
||||||
#include "../lib/util/pidfile.h"
|
#include "../lib/util/pidfile.h"
|
||||||
#include "serverid.h"
|
#include "serverid.h"
|
||||||
|
#include "cmdline_contexts.h"
|
||||||
|
|
||||||
#if HAVE_LIBUNWIND_H
|
#if HAVE_LIBUNWIND_H
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
@ -1609,21 +1610,23 @@ int main(int argc, const char **argv)
|
|||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
usage(pc);
|
usage(pc);
|
||||||
|
|
||||||
|
msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE());
|
||||||
|
if (msg_ctx == NULL) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Could not init messaging context, not root?\n");
|
||||||
|
TALLOC_FREE(frame);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
evt_ctx = server_event_context();
|
||||||
|
|
||||||
lp_load_global(get_dyn_CONFIGFILE());
|
lp_load_global(get_dyn_CONFIGFILE());
|
||||||
|
|
||||||
/* Need to invert sense of return code -- samba
|
/* Need to invert sense of return code -- samba
|
||||||
* routines mostly return True==1 for success, but
|
* routines mostly return True==1 for success, but
|
||||||
* shell needs 0. */
|
* shell needs 0. */
|
||||||
|
|
||||||
if (!(evt_ctx = samba_tevent_context_init(NULL)) ||
|
|
||||||
!(msg_ctx = messaging_init(NULL, evt_ctx))) {
|
|
||||||
fprintf(stderr, "could not init messaging context\n");
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = !do_command(evt_ctx, msg_ctx, argc, argv);
|
ret = !do_command(evt_ctx, msg_ctx, argc, argv);
|
||||||
TALLOC_FREE(msg_ctx);
|
|
||||||
TALLOC_FREE(frame);
|
TALLOC_FREE(frame);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ bld.SAMBA3_BINARY('smbcontrol',
|
|||||||
talloc
|
talloc
|
||||||
smbconf
|
smbconf
|
||||||
popt_samba3
|
popt_samba3
|
||||||
|
cmdline_contexts
|
||||||
PRINTBASE''')
|
PRINTBASE''')
|
||||||
|
|
||||||
bld.SAMBA3_BINARY('smbtree',
|
bld.SAMBA3_BINARY('smbtree',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user