From 37d29db0bdb68d4dcf07ba62a39fd8b72e0f169f Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Mon, 20 Aug 2018 15:46:27 -0700 Subject: [PATCH] s3:smbstatus: Use cmdline_messaging_context Use cmdline_messaging_context to initialize a messaging context instead of open coding the same steps. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465 Signed-off-by: Christof Schmitt Reviewed-by: Ralph Boehme (backported from commit d7fa3815a83a50fd9e3d78cac0d5ef3eb79235e5) --- source3/utils/status.c | 17 +++-------------- source3/wscript_build | 1 + 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/source3/utils/status.c b/source3/utils/status.c index dfb1d921a42..4756b971697 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 */ @@ -605,21 +606,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. - */ - msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL)); + 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 fb61f3236df..5a8380906ae 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1146,6 +1146,7 @@ bld.SAMBA3_BINARY('smbstatus', talloc smbconf popt_samba3 + cmdline_contexts smbd_base LOCKING PROFILE -- 2.47.2