summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-29 05:50:32 +0000
committerTim Potter <tpot@samba.org>2001-11-29 05:50:32 +0000
commitff27a326f17223cba12b7e0b41ec84aad8238385 (patch)
treed1374839939104a08f1f309cab2004e223b9656c
parent5bfc7214afb23984acc7aba9fd7a57eec7c18d6d (diff)
downloadsamba-ff27a326f17223cba12b7e0b41ec84aad8238385.tar.gz
samba-ff27a326f17223cba12b7e0b41ec84aad8238385.tar.bz2
samba-ff27a326f17223cba12b7e0b41ec84aad8238385.zip
I think the lookup_pdc_name() should be called lookup_dc_name() and the
name_status_find() call here should look up a #1c name instead of #1d. This fixes some bugs currently with BDC authentication in winbindd and in smbd as you can't query the #1d name with the ip address of a BDC. Who is Uncle Tom Cobbley anyway? (This used to be commit 4215048f7b20a8f9e5877bdbb2f54841b2f7fa64)
-rw-r--r--source3/auth/auth_domain.c2
-rw-r--r--source3/libsmb/namequery.c43
-rw-r--r--source3/nsswitch/winbindd_cm.c17
-rw-r--r--source3/rpc_client/cli_trust.c2
4 files changed, 37 insertions, 27 deletions
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index a779a7e9c0..125b3aa029 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -184,7 +184,7 @@ static BOOL attempt_connect_to_dc(struct cli_state *pcli, struct in_addr *ip,
if (is_zero_ip(*ip))
return False;
- if (!lookup_pdc_name(global_myname, lp_workgroup(), ip, dc_name))
+ if (!lookup_dc_name(global_myname, lp_workgroup(), ip, dc_name))
return False;
return connect_to_domain_password_server(pcli, dc_name, trust_passwd);
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index a181e3183f..8d00c50914 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -927,7 +927,7 @@ BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
if (strcmp(dest_host,"*") == 0) {
extern pstring global_myname;
ret = resolve_name(lp_workgroup(), ip, 0x1B);
- lookup_pdc_name(global_myname, lp_workgroup(), ip, dest_host);
+ lookup_dc_name(global_myname, lp_workgroup(), ip, dest_host);
} else {
ret = resolve_name(dest_host, ip, 0x20);
}
@@ -966,31 +966,32 @@ BOOL find_master_ip(char *group, struct in_addr *master_ip)
}
/********************************************************
- Lookup a PDC name given a Domain name and IP address.
+ Lookup a DC name given a Domain name and IP address.
*********************************************************/
-BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name)
+BOOL lookup_dc_name(const char *srcname, const char *domain,
+ struct in_addr *dc_ip, char *ret_name)
{
#if !defined(I_HATE_WINDOWS_REPLY_CODE)
+
+ fstring dc_name;
+ BOOL ret;
+
+ /*
+ * Due to the fact win WinNT *sucks* we must do a node status
+ * query here... JRA.
+ */
+
+ *dc_name = '\0';
+
+ ret = name_status_find(domain, 0x1c, 0x20, *dc_ip, dc_name);
- fstring pdc_name;
- BOOL ret;
-
- /*
- * Due to the fact win WinNT *sucks* we must do a node status
- * query here... JRA.
- */
-
- *pdc_name = '\0';
-
- ret = name_status_find(domain, 0x1b, 0x20,*pdc_ip,pdc_name);
-
- if(ret && *pdc_name) {
- fstrcpy(ret_name, pdc_name);
- return True;
- }
-
- return False;
+ if(ret && *dc_name) {
+ fstrcpy(ret_name, dc_name);
+ return True;
+ }
+
+ return False;
#else /* defined(I_HATE_WINDOWS_REPLY_CODE) */
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index db5c51404a..f11d86d4c1 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -92,7 +92,6 @@ static BOOL cm_get_dc_name(char *domain, fstring srv_name)
static struct get_dc_name_cache *get_dc_name_cache;
struct get_dc_name_cache *dcc;
struct in_addr *ip_list, dc_ip;
- extern pstring global_myname;
int count, i;
/* Check the cache for previous lookups */
@@ -144,8 +143,10 @@ static BOOL cm_get_dc_name(char *domain, fstring srv_name)
/* Lookup domain controller name */
- if (!get_dc_list(False, domain, &ip_list, &count))
+ if (!get_dc_list(False, domain, &ip_list, &count)) {
+ DEBUG(3, ("Could not look up dc's for domain %s\n", domain));
return False;
+ }
/* Firstly choose a PDC/BDC who has the same network address as any
of our interfaces. */
@@ -155,7 +156,10 @@ static BOOL cm_get_dc_name(char *domain, fstring srv_name)
goto got_ip;
}
- if (count == 0) return False;
+ if (count == 0) {
+ DEBUG(3, ("No domain controllers for domain %s\n", domain));
+ return False;
+ }
i = (sys_random() % count);
@@ -163,8 +167,13 @@ static BOOL cm_get_dc_name(char *domain, fstring srv_name)
dc_ip = ip_list[i];
SAFE_FREE(ip_list);
- if (!lookup_pdc_name(global_myname, domain, &dc_ip, srv_name))
+ /* We really should be doing a GETDC call here rather than a node
+ status lookup. */
+
+ if (!name_status_find(domain, 0x1c, 0x20, dc_ip, srv_name)) {
+ DEBUG(3, ("Error looking up DC name for %s in domain %s\n", inet_ntoa(dc_ip), domain));
return False;
+ }
/* We have a name so make the cache entry positive now */
diff --git a/source3/rpc_client/cli_trust.c b/source3/rpc_client/cli_trust.c
index a12f4035ee..c910e2f334 100644
--- a/source3/rpc_client/cli_trust.c
+++ b/source3/rpc_client/cli_trust.c
@@ -213,7 +213,7 @@ account password for domain %s.\n", domain));
for(i = 0; i < count; i++) {
fstring dc_name;
- if(!lookup_pdc_name(global_myname, domain, &ip_list[i], dc_name))
+ if(!lookup_dc_name(global_myname, domain, &ip_list[i], dc_name))
continue;
if((res = modify_trust_password( domain, dc_name,
old_trust_passwd_hash, new_trust_passwd_hash)))