s3-sessionid: move sessionid init call to the only function where it is needed.
authorGünther Deschner <gd@samba.org>
Fri, 6 Sep 2013 16:08:23 +0000 (18:08 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 18 Sep 2013 08:41:23 +0000 (10:41 +0200)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
(cherry picked from commit 4b8b385042ace68c4ec59fea81bf8b284b34c356)

source3/utils/net_serverid.c

index 01109b9ffad85153a617228e089d6a8712301c84..7d50ab1d9dea66263fa8e0f19139d33839f63784 100644 (file)
@@ -113,6 +113,11 @@ static int net_serverid_wipedbs_sessionid(struct db_record *rec,
 static int net_serverid_wipedbs(struct net_context *c, int argc,
                                const char **argv)
 {
+       if (!sessionid_init()) {
+               d_printf("failed to open sessionid.tdb\n");
+               return -1;
+       };
+
        connections_forall(net_serverid_wipedbs_conn, NULL);
        sessionid_traverse(net_serverid_wipedbs_sessionid, NULL);
        return 0;
@@ -150,10 +155,5 @@ int net_serverid(struct net_context *c, int argc, const char **argv)
                {NULL, NULL, 0, NULL, NULL}
        };
 
-       if (!sessionid_init()) {
-               d_printf("failed to open sessionid.tdb\n");
-               return -1;
-       };
-
        return net_run_function(c, argc, argv, "net serverid", func);
 }