[PATCH] s3:smbstatus: Fix bug 6703, allow smbstatus as non-root

Volker Lendecke vl at samba.org
Fri Sep 18 10:27:16 MDT 2009


We only require a ctdb connection when clustering is enabled. This limits the
restriction for only-root smbstatus to the clustering case.
---
 source/utils/status.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/source/utils/status.c b/source/utils/status.c
index 1a66af9..58cc349 100644
--- a/source/utils/status.c
+++ b/source/utils/status.c
@@ -367,18 +367,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)) {
-- 
1.6.0.4



More information about the samba mailing list