summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-12-04 19:01:01 +0000
committerGerald Carter <jerry@samba.org>2002-12-04 19:01:01 +0000
commit779ec8d3cffed1c56153c8d214abd3ce2c2161b3 (patch)
treea6bc14ee68a4d2b800e84187b8b21673d0e7636f /source3/libsmb
parentf60f763a2dddaa6ab355c66dc2f86831b36dd278 (diff)
downloadsamba-779ec8d3cffed1c56153c8d214abd3ce2c2161b3.tar.gz
samba-779ec8d3cffed1c56153c8d214abd3ce2c2161b3.tar.bz2
samba-779ec8d3cffed1c56153c8d214abd3ce2c2161b3.zip
[merge] remove assert(count ==1) for multi-homed PDCs; CR 1277
(This used to be commit 18799c115b05d6662350509f6662dbfceb4b71f5)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 98d9661567..0f81ff3eab 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1216,15 +1216,34 @@ BOOL get_pdc_ip(const char *domain, struct in_addr *ip)
{
struct in_addr *ip_list;
int count;
+ int i = 0;
/* Look up #1B name */
if (!internal_resolve_name(domain, 0x1b, &ip_list, &count))
return False;
- SMB_ASSERT(count == 1);
+ /* if we get more than 1 IP back we have to assume it is a
+ multi-homed PDC and not a mess up */
+
+ if ( count > 1 ) {
+ DEBUG(6,("get_pdc_ip: PDC has %d IP addresses!\n", count));
+
+ /* look for a local net */
+ for ( i=0; i<count; i++ ) {
+ if ( is_local_net( ip_list[i] ) )
+ break;
+ }
+
+ /* if we hit then end then just grab the first
+ one from the list */
+
+ if ( i == count )
+ i = 0;
+ }
- *ip = ip_list[0];
+ *ip = ip_list[i];
+
SAFE_FREE(ip_list);
return True;
@@ -1307,7 +1326,7 @@ BOOL get_dc_list(const char *domain, struct in_addr **ip_list, int *count, int *
continue;
}
- /* explicit lookup */
+ /* explicit lookup; resolve_name() will handle names & IP addresses */
if ( resolve_name( name, &name_ip, 0x20) ) {
return_iplist[local_count++] = name_ip;