net: Let get*sid return error from passdb init
authorChristof Schmitt <christof.schmitt@us.ibm.com>
Tue, 24 Apr 2012 21:33:46 +0000 (14:33 -0700)
committerVolker Lendecke <vl@samba.org>
Mon, 30 Apr 2012 11:07:20 +0000 (13:07 +0200)
When initialize_password_db returns an error this means that the SID
stored in the backend cannot be read. Return this error directly
instead of creating a random SID through get_global_sam_sid.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Mon Apr 30 13:07:20 CEST 2012 on sn-devel-104

source3/utils/net.c

index 70ed0aa47a74a776380280c2532881aaa94b9fe8..1ce5ee658232aa99f6d8f9e1a645c7cbadb4adda 100644 (file)
@@ -247,8 +247,8 @@ static int net_getlocalsid(struct net_context *c, int argc, const char **argv)
        }
 
        if(!initialize_password_db(false, NULL)) {
-               DEBUG(0, ("WARNING: Could not open passdb - local sid may not reflect passdb\n"
-                         "backend knowledge (such as the sid stored in LDAP)\n"));
+               d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
+               return 1;
        }
 
        /* first check to see if we can even access secrets, so we don't
@@ -327,10 +327,8 @@ static int net_getdomainsid(struct net_context *c, int argc, const char **argv)
        }
 
        if(!initialize_password_db(false, NULL)) {
-               DEBUG(0, ("WARNING: Could not open passdb - domain SID may "
-                         "not reflect passdb\n"
-                         "backend knowledge (such as the SID stored in "
-                         "LDAP)\n"));
+               d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
+               return 1;
        }
 
        /* first check to see if we can even access secrets, so we don't