smbstatus: Tell the user that smbstatus can only be run as root.
authorAndreas Schneider <asn@samba.org>
Tue, 16 Dec 2014 14:52:43 +0000 (15:52 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 16 Dec 2014 17:54:41 +0000 (18:54 +0100)
In the meantime smbstatus tries to collection information from tdb's
which are only accessible by root as they contain sensitive information
like session keys and other secrets. This means smbstatus can no longer
be executed as a user.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11012

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Dec 16 18:54:41 CET 2014 on sn-devel-104

source3/utils/status.c

index cd6a988b2faa8471db03004261c8f1bde4f7ffb0..61efa934a44996e08dd8ca8d6dea25cc2d614ede 100644 (file)
@@ -386,6 +386,13 @@ int main(int argc, const char *argv[])
                goto done;
        }
 
+       if (getuid() != 0) {
+               d_printf("smbstatus only works as root!\n");
+               ret = 1;
+               goto done;
+       }
+
+
        pc = poptGetContext(NULL, argc, argv, long_options,
                            POPT_CONTEXT_KEEP_FIRST);