]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbstatus: Use cmdline_messaging_context
authorChristof Schmitt <cs@samba.org>
Mon, 20 Aug 2018 22:46:27 +0000 (15:46 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 Oct 2018 09:29:23 +0000 (11:29 +0200)
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 <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(backported from commit d7fa3815a83a50fd9e3d78cac0d5ef3eb79235e5)

source3/utils/status.c
source3/wscript_build

index dfb1d921a4230f4af0a2c67c1c4186aa2b81398b..4756b971697e5cd7ff42c49041b24b9284937619 100644 (file)
@@ -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;
        }
index fb61f3236df8fc9a94070397baf261eda455cd78..5a8380906aef3f93af8e64b23ef74fb2417e633e 100644 (file)
@@ -1146,6 +1146,7 @@ bld.SAMBA3_BINARY('smbstatus',
                       talloc
                       smbconf
                       popt_samba3
+                      cmdline_contexts
                       smbd_base
                       LOCKING
                       PROFILE