summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-19 13:33:08 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-19 13:33:08 +0000
commit15aad7f33d69be9a46251b29d30c21d465fddf06 (patch)
tree562f58e1750c264311429ed8685bd6bc1407570d /source3/nsswitch
parentacb0c65176b0cd7311beba5e5925375254a8361c (diff)
downloadsamba-15aad7f33d69be9a46251b29d30c21d465fddf06.tar.gz
samba-15aad7f33d69be9a46251b29d30c21d465fddf06.tar.bz2
samba-15aad7f33d69be9a46251b29d30c21d465fddf06.zip
use "ads server" option if set for primary domain
(This used to be commit 1bf5c1a46f4c3f44054ce8fcbc551cdb72683f2b)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_ads.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index e144fffc59..8d0c78b2d5 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -102,6 +102,7 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
ADS_STATUS status;
char *ccache;
struct in_addr server_ip;
+ char *sname;
if (domain->private) {
return (ADS_STRUCT *)domain->private;
@@ -112,12 +113,17 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
SETENV("KRB5CCNAME", ccache, 1);
unlink(ccache);
- if (!resolve_name(domain->name, &server_ip, 0x1b)) {
- DEBUG(1,("Can't find PDC for domain %s\n", domain->name));
- return NULL;
+ if (resolve_name(domain->name, &server_ip, 0x1b)) {
+ sname = inet_ntoa(server_ip);
+ } else {
+ if (strcasecmp(domain->name, lp_workgroup()) != 0) {
+ DEBUG(1,("can't find domain controller for %s\n", domain->name));
+ return NULL;
+ }
+ sname = NULL;
}
- ads = ads_init(primary_realm, inet_ntoa(server_ip), NULL, NULL);
+ ads = ads_init(primary_realm, sname, NULL, NULL);
if (!ads) {
DEBUG(1,("ads_init for domain %s failed\n", domain->name));
return NULL;