winbindd: Use pdb_get_domain_info() to get exactly the local domain info when we...
authorAndrew Bartlett <abartlet@samba.org>
Thu, 11 Jun 2015 23:54:21 +0000 (11:54 +1200)
committerJeremy Allison <jra@samba.org>
Wed, 17 Jun 2015 20:10:24 +0000 (22:10 +0200)
This also triggers pdb_samba_dsdb_init_secrets(), to force the
correct SID into secrets.tdb.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10991

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd_util.c

index 021f5ca1d6c6cd277d15d89983a9d5b0ddf72cfc..dc6faf14833e682f420070f685a72da51d19b082 100644 (file)
@@ -722,12 +722,23 @@ bool init_domain_list(void)
                enum netr_SchannelType sec_chan_type;
                const char *account_name;
                struct samr_Password current_nt_hash;
+               struct pdb_domain_info *pdb_domain_info;
                bool ok;
 
-               domain = add_trusted_domain(get_global_sam_name(), lp_dnsdomain(),
-                                           &cache_methods, get_global_sam_sid());
+               pdb_domain_info = pdb_get_domain_info(talloc_tos());
+               if (pdb_domain_info == NULL) {
+                       DEBUG(0, ("Failed to fetch our own, local AD "
+                               "domain info from sam.ldb\n"));
+                       return false;
+               }
+               domain = add_trusted_domain(pdb_domain_info->name,
+                                       pdb_domain_info->dns_domain,
+                                       &cache_methods,
+                                       &pdb_domain_info->sid);
+               TALLOC_FREE(pdb_domain_info);
                if (domain == NULL) {
-                       DEBUG(0, ("Failed to add our own, local AD domain to winbindd's internal list\n"));
+                       DEBUG(0, ("Failed to add our own, local AD "
+                               "domain to winbindd's internal list\n"));
                        return false;
                }