diff options
author | Gerald Carter <jerry@samba.org> | 2006-08-24 12:13:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:47 -0500 |
commit | 8cac7c139908eff0124a4a6f9d25f3b3fe10a254 (patch) | |
tree | 5dd369db8f3efdf5fa1ca6186b3d40c4db0a9eeb /source3/libads | |
parent | a5a69ec15013cade97ef95c4e45a44063667dbe4 (diff) | |
download | samba-8cac7c139908eff0124a4a6f9d25f3b3fe10a254.tar.gz samba-8cac7c139908eff0124a4a6f9d25f3b3fe10a254.tar.bz2 samba-8cac7c139908eff0124a4a6f9d25f3b3fe10a254.zip |
r17795: Finally track down the "ads_connect: Interrupted system call"
error. Fix our DNS SRV lookup code to deal with multi-homed hosts.
We were noly remembering one IP address per host from the Additional
records section in the SRV response which could have been an unreachable
address.
(This used to be commit 899179d2b9fba13cc6f4dab6efc3c22e44e062bc)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/dns.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 903d19b753..c946ab0bdd 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -398,14 +398,45 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, const char *name, struct dn } /* only interested in A records as a shortcut for having to come - back later and lookup the name */ + back later and lookup the name. For multi-homed hosts, the + number of additional records and exceed the number of answer + records. */ + if ( (rr.type != T_A) || (rr.rdatalen != 4) ) continue; + /* FIX ME!!! Should this be a list of IP addresses for + each host? */ + for ( i=0; i<idx; i++ ) { if ( strcmp( rr.hostname, dcs[i].hostname ) == 0 ) { - uint8 *buf = (uint8*)&dcs[i].ip.s_addr; + int num_ips = dcs[i].num_ips; + uint8 *buf; + struct in_addr *tmp_ips; + + /* allocate new memory */ + + if ( dcs[i].num_ips == 0 ) { + if ( (dcs[i].ips = TALLOC_ARRAY( dcs, + struct in_addr, 1 )) == NULL ) + { + return NT_STATUS_NO_MEMORY; + } + } else { + if ( (tmp_ips = TALLOC_REALLOC_ARRAY( dcs, dcs[i].ips, + struct in_addr, dcs[i].num_ips+1)) == NULL ) + { + return NT_STATUS_NO_MEMORY; + } + + dcs[i].ips = tmp_ips; + } + dcs[i].num_ips++; + + /* copy the new IP address */ + + buf = (uint8*)&dcs[i].ips[num_ips].s_addr; memcpy( buf, rr.rdata, 4 ); } } |