s3-net Do not look for a local SID when we are a DC
authorAndrew Bartlett <abartlet@samba.org>
Thu, 10 Nov 2011 08:57:05 +0000 (19:57 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 16 Nov 2011 23:34:09 +0000 (00:34 +0100)
If we are actually a DC, then the only SID we have is the domain SID,
and looking for it under the local name fails if we are a Samba4 AD DC.

Andrew Bartlett

source3/utils/net.c

index d05f6143e18acab39cfaaa7acf01224de462817c..ce9e7c57b210a3e5cfe827ba4de9d8be6489728d 100644 (file)
@@ -346,14 +346,15 @@ static int net_getdomainsid(struct net_context *c, int argc, const char **argv)
        /* Generate one, if it doesn't exist */
        get_global_sam_sid();
 
-       if (!secrets_fetch_domain_sid(lp_netbios_name(), &domain_sid)) {
-               d_fprintf(stderr, _("Could not fetch local SID\n"));
-               return 1;
+       if (!IS_DC) {
+               if (!secrets_fetch_domain_sid(lp_netbios_name(), &domain_sid)) {
+                       d_fprintf(stderr, _("Could not fetch local SID\n"));
+                       return 1;
+               }
+               sid_to_fstring(sid_str, &domain_sid);
+               d_printf(_("SID for local machine %s is: %s\n"),
+                        lp_netbios_name(), sid_str);
        }
-       sid_to_fstring(sid_str, &domain_sid);
-       d_printf(_("SID for local machine %s is: %s\n"),
-                lp_netbios_name(), sid_str);
-
        if (!secrets_fetch_domain_sid(c->opt_workgroup, &domain_sid)) {
                d_fprintf(stderr, _("Could not fetch domain SID\n"));
                return 1;