diff --git a/source3/utils/status.c b/source3/utils/status.c index d04efedee3f..1d68219a5ac 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -48,6 +48,7 @@ #include "serverid.h" #include "status_profile.h" #include "smbd/notifyd/notifyd.h" +#include "cmdline_contexts.h" #define SMB_MAXPIDS 2048 static uid_t Ucrit_uid = 0; /* added by OH */ @@ -528,7 +529,6 @@ int main(int argc, const char *argv[]) }; TALLOC_CTX *frame = talloc_stackframe(); int ret = 0; - struct tevent_context *ev; struct messaging_context *msg_ctx = NULL; char *db_path; bool ok; @@ -607,28 +607,9 @@ int main(int argc, const char *argv[]) d_printf("using configfile = %s\n", get_dyn_CONFIGFILE()); } - if (!lp_load_initial_only(get_dyn_CONFIGFILE())) { - fprintf(stderr, "Can't load %s - run testparm to debug it\n", - get_dyn_CONFIGFILE()); - ret = -1; - goto done; - } - - - /* - * This implicitly initializes the global ctdbd connection, - * usable by the db_open() calls further down. - */ - ev = samba_tevent_context_init(NULL); - if (ev == NULL) { - fprintf(stderr, "samba_tevent_context_init failed\n"); - ret = -1; - goto done; - } - - msg_ctx = messaging_init(NULL, ev); + msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE()); if (msg_ctx == NULL) { - fprintf(stderr, "messaging_init failed\n"); + fprintf(stderr, "Could not initialize messaging, not root?\n"); ret = -1; goto done; } diff --git a/source3/wscript_build b/source3/wscript_build index 250b7f1ff52..36cfd5dada7 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1157,6 +1157,7 @@ bld.SAMBA3_BINARY('smbstatus', talloc smbconf popt_samba3 + cmdline_contexts smbd_base LOCKING PROFILE