167d4b
From 6f12155432a5769e69b4b8794e332c2d0e48a9de Mon Sep 17 00:00:00 2001
167d4b
From: Andreas Schneider <asn@samba.org>
167d4b
Date: Tue, 16 Dec 2014 15:52:43 +0100
167d4b
Subject: [PATCH] smbstatus: Tell the user that smbstatus can only be run as
167d4b
 root.
167d4b
167d4b
In the meantime smbstatus tries to collection information from tdb's
167d4b
which are only accessible by root as they contain sensitive information
167d4b
like session keys and other secrets. This means smbstatus can no longer
167d4b
be executed as a user.
167d4b
167d4b
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11012
167d4b
167d4b
Signed-off-by: Andreas Schneider <asn@samba.org>
167d4b
Reviewed-by: Volker Lendecke <vl@samba.org>
167d4b
(cherry picked from commit c079ae65f45e6c19b9549084b09b83ae9118a276)
167d4b
---
167d4b
 source3/utils/status.c | 6 ++++++
167d4b
 1 file changed, 6 insertions(+)
167d4b
167d4b
diff --git a/source3/utils/status.c b/source3/utils/status.c
167d4b
index 9ce92aa..18f2749 100644
167d4b
--- a/source3/utils/status.c
167d4b
+++ b/source3/utils/status.c
167d4b
@@ -376,6 +376,12 @@ static void print_notify_recs(const char *path,
167d4b
 		goto done;
167d4b
 	}
167d4b
 
167d4b
+	if (getuid() != 0) {
167d4b
+		d_printf("smbstatus only works as root!\n");
167d4b
+		ret = 1;
167d4b
+		goto done;
167d4b
+	}
167d4b
+
167d4b
 	pc = poptGetContext(NULL, argc, (const char **) argv, long_options, 
167d4b
 			    POPT_CONTEXT_KEEP_FIRST);
167d4b
 
167d4b
-- 
167d4b
2.2.0
167d4b