s3-serverid: call serverid_init_readonly() from commandline tools.
authorGünther Deschner <gd@samba.org>
Fri, 6 Sep 2013 16:08:45 +0000 (18:08 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 9 Sep 2013 08:08:25 +0000 (10:08 +0200)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
The last 4 patches are follow-up patches for bug #10127 - smbstatus stopped
working as non-root user.

source3/utils/net_serverid.c
source3/utils/status.c

index 7d50ab1d9dea66263fa8e0f19139d33839f63784..5e61f11473829ece768327d7c9b2b02043b8f79c 100644 (file)
@@ -36,6 +36,10 @@ static int net_serverid_list_fn(const struct server_id *id,
 static int net_serverid_list(struct net_context *c, int argc,
                             const char **argv)
 {
+       if (!serverid_init_readonly(c)) {
+               d_printf("failed to open serverid.tdb\n");
+               return -1;
+       }
        d_printf("pid unique_id msg_flags\n");
        return serverid_traverse_read(net_serverid_list_fn, NULL) ? 0 : -1;
 }
index dc0509673a0117d836969fdb108553c5bfe9e648..b89a77920f4eb3e3aae43a649b1a3a87424b7280 100644 (file)
@@ -38,6 +38,7 @@
 #include "session.h"
 #include "locking/proto.h"
 #include "messages.h"
+#include "serverid.h"
 
 #define SMB_MAXPIDS            2048
 static uid_t           Ucrit_uid = 0;               /* added by OH */
@@ -476,6 +477,11 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
                        goto done;
                }
 
+               if (!serverid_init_readonly(frame)) {
+                       d_printf("Can't initialise serverid tdb - exiting\n");
+                       ret = 1;
+                       goto done;
+               }
                result = share_mode_forall(print_share_mode, NULL);
 
                if (result == 0) {