]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Prevent net getdomainsid from panicing when called as non-root.
authorMichael Adam <obnox@samba.org>
Fri, 30 Nov 2007 15:10:32 +0000 (16:10 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 30 Nov 2007 15:10:32 +0000 (16:10 +0100)
(Unable to open secrets.tdb.)

Michael

source/utils/net.c

index a030531947a8cb3d57a72760562776292dd8b188..99384ad61a9d05be9e842c4b9d2cd0745905784d 100644 (file)
@@ -677,6 +677,16 @@ static int net_getdomainsid(int argc, const char **argv)
                          "backend knowlege (such as the sid stored in LDAP)\n"));
        }
 
+       /* first check to see if we can even access secrets, so we don't
+          panic when we can't. */
+
+       if (!secrets_init()) {
+               d_fprintf(stderr, "Unable to open secrets.tdb.  "
+                                 "Can't fetch domainSID for name: %s\n",
+                                 get_global_sam_name());
+               return 1;
+       }
+
        /* Generate one, if it doesn't exist */
        get_global_sam_sid();