diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-12-31 05:26:29 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-12-31 05:26:29 +0000 |
commit | e6de276ff44fe766804cdf95f45e23cdff2ca5d3 (patch) | |
tree | 456a27b8b20b6f25c808e87190cec2e053685a7c /source3 | |
parent | 5eee23cc64139ba1d23101c87709e6d5198a6c68 (diff) | |
download | samba-e6de276ff44fe766804cdf95f45e23cdff2ca5d3.tar.gz samba-e6de276ff44fe766804cdf95f45e23cdff2ca5d3.tar.bz2 samba-e6de276ff44fe766804cdf95f45e23cdff2ca5d3.zip |
Jerry rightly complained that we can't assume that the first domain is
our primary domain - new domains are added to the front of the list. :-(
Use a much more reliable 'flag test' instead. (note: changes winbind structures, make clean).
Andrew Bartlett
(This used to be commit cc050e01370633a985c9878bdce297f9175fdbf7)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nsswitch/winbindd_util.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index a0619594b5..a9bb851a7a 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -168,9 +168,7 @@ void rescan_trusted_domains( void ) if ( (now > last_scan) && ((now-last_scan) < WINBINDD_RESCAN_FREQ) ) return; - /* get the handle for our domain (it is always the first in the list) */ - - if ( (mydomain = domain_list()) == NULL ) { + if ( (mydomain = find_our_domain()) == NULL ) { DEBUG(0,("rescan_trusted_domains: Can't find my own domain!\n")); return; } @@ -272,6 +270,8 @@ BOOL init_domain_list(void) domain = add_trusted_domain( lp_workgroup(), lp_realm(), &cache_methods, NULL); + domain->primary = True; + /* get any alternate name for the primary domain */ cache_methods.alternate_name(domain); @@ -341,6 +341,24 @@ struct winbindd_domain *find_domain_from_sid(DOM_SID *sid) return NULL; } +/* Given a domain sid, return the struct winbindd domain info for it */ + +struct winbindd_domain *find_our_domain() +{ + struct winbindd_domain *domain; + + /* Search through list */ + + for (domain = domain_list(); domain != NULL; domain = domain->next) { + if (domain->primary) + return domain; + } + + /* Not found */ + + return NULL; +} + /* Lookup a sid in a domain from a name */ BOOL winbindd_lookup_sid_by_name(struct winbindd_domain *domain, |