dsgetdcname: return an IP address on rediscovery
authorUri Simchoni <uri@samba.org>
Thu, 3 Mar 2016 07:18:44 +0000 (09:18 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 7 Mar 2016 21:16:20 +0000 (22:16 +0100)
When dsgetdcname return its result based on discovery
process (instead of retrieving cached value), always
return the found server's IP address in dc_address field,
rather than its netbios name.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11769

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/dsgetdcname.c

index a63ba5a0ce7dbb078efaf1df450d19a3f7ce1314..1033329a04e03c5609e0b674b0843349bf3b497d 100644 (file)
@@ -792,14 +792,14 @@ static NTSTATUS make_dc_info_from_cldap_reply(TALLOC_CTX *mem_ctx,
                print_sockaddr(addr, sizeof(addr), ss);
                dc_address = addr;
                dc_address_type = DS_ADDRESS_TYPE_INET;
-       }
-
-       if (!ss && r->sockaddr.pdc_ip) {
-               dc_address      = r->sockaddr.pdc_ip;
-               dc_address_type = DS_ADDRESS_TYPE_INET;
        } else {
-               dc_address      = r->pdc_name;
-               dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
+               if (r->sockaddr.pdc_ip) {
+                       dc_address      = r->sockaddr.pdc_ip;
+                       dc_address_type = DS_ADDRESS_TYPE_INET;
+               } else {
+                       dc_address      = r->pdc_name;
+                       dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
+               }
        }
 
        map_dc_and_domain_names(flags,