s3:smbstatus: Fix bug 6703, allow smbstatus as non-root
authorVolker Lendecke <vl@samba.org>
Fri, 18 Sep 2009 16:27:16 +0000 (18:27 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 18 Sep 2009 16:32:25 +0000 (18:32 +0200)
We only require a ctdb connection when clustering is enabled. This limits the
restriction for only-root smbstatus to the clustering case.

source3/utils/status.c

index f7a6155be2a6a5f8dcf794faf659bb7521f5d0d7..6d616149d708529f80d7662810ab4cfe509ffd2b 100644 (file)
@@ -377,18 +377,20 @@ static int traverse_sessionid(struct db_record *db, void *state)
                goto done;
        }
 
-       /*
-        * This implicitly initializes the global ctdbd connection, usable by
-        * the db_open() calls further down.
-        */
 
-       msg_ctx = messaging_init(NULL, procid_self(),
-                                event_context_init(NULL));
-
-       if (msg_ctx == NULL) {
-               fprintf(stderr, "messaging_init failed\n");
-               ret = -1;
-               goto done;
+       if (lp_clustering()) {
+               /*
+                * This implicitly initializes the global ctdbd
+                * connection, usable by the db_open() calls further
+                * down.
+                */
+               msg_ctx = messaging_init(NULL, procid_self(),
+                                        event_context_init(NULL));
+               if (msg_ctx == NULL) {
+                       fprintf(stderr, "messaging_init failed\n");
+                       ret = -1;
+                       goto done;
+               }
        }
 
        if (!lp_load(get_dyn_CONFIGFILE(),False,False,False,True)) {