summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-31 06:37:37 +0000
committerGerald Carter <jerry@samba.org>2003-07-31 06:37:37 +0000
commit3543399eac143215407beaeca87eed4e4c03c5d0 (patch)
treebbd4b85378c56e6713228f6873ae88b74827fcce
parent0d087e3ba28a9061529c95799624ccc4686eb1e9 (diff)
downloadsamba-3543399eac143215407beaeca87eed4e4c03c5d0.tar.gz
samba-3543399eac143215407beaeca87eed4e4c03c5d0.tar.bz2
samba-3543399eac143215407beaeca87eed4e4c03c5d0.zip
make sure the domain sid is set when enumerating trusted domains
(we don't always get it back) (This used to be commit 6e8f23d1b1dd5122691cd9363a5c572fcab182af)
-rw-r--r--source3/nsswitch/winbindd_util.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index ca5146fc56..0de30dbca8 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -174,8 +174,11 @@ void rescan_trusted_domains(BOOL force)
char **names;
char **alt_names;
int num_domains = 0;
- DOM_SID *dom_sids;
+ DOM_SID *dom_sids, null_sid;
int i;
+ struct winbindd_domain *new_domain;
+
+ ZERO_STRUCTP(&null_sid);
result = domain->methods->trusted_domains(domain, mem_ctx, &num_domains,
&names, &alt_names, &dom_sids);
@@ -189,6 +192,26 @@ void rescan_trusted_domains(BOOL force)
DEBUG(10,("Found domain %s\n", names[i]));
add_trusted_domain(names[i], alt_names?alt_names[i]:NULL,
domain->methods, &dom_sids[i]);
+
+ /* if the SID was empty, we better set it now */
+
+ if ( sid_equal(&dom_sids[i], &null_sid) ) {
+
+ new_domain = find_domain_from_name(names[i]);
+
+ /* this should never happen */
+ if ( !domain) {
+ DEBUG(0,("rescan_trust_domains: can't find the domain I just added! [%s]\n",
+ names[i]));
+ break;
+ }
+
+ result = domain->methods->domain_sid( new_domain, &new_domain->sid );
+
+ if ( NT_STATUS_IS_OK(result) )
+ sid_copy( &dom_sids[i], &domain->sid );
+
+ }
/* store trusted domain in the cache */
trustdom_cache_store(names[i], alt_names ? alt_names[i] : NULL,