diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-06-07 15:46:17 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-06-07 08:57:48 +0200 |
commit | 632f672b0859cee995788a00ecd464a0a8d5c74a (patch) | |
tree | 98b97b6c45fc2e1737307a5c59bfc9f98f9ccae6 /source4 | |
parent | 285293c8b5d85383aa5af9968dc73fba5beb9de0 (diff) | |
download | samba-632f672b0859cee995788a00ecd464a0a8d5c74a.tar.gz samba-632f672b0859cee995788a00ecd464a0a8d5c74a.tar.bz2 samba-632f672b0859cee995788a00ecd464a0a8d5c74a.zip |
s4-cldap: fixed the CLDAP response for IPv6 clients
Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Jun 7 08:57:48 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r-- | source4/cldap_server/netlogon.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 92f7a4a752..77f50ff3e6 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -37,6 +37,7 @@ #include "param/param.h" #include "../lib/tsocket/tsocket.h" #include "libds/common/flag_mapping.h" +#include "lib/util/util_net.h" /* fill in the cldap netlogon union for a given version @@ -292,16 +293,17 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx, src_address, NULL); NT_STATUS_HAVE_NO_MEMORY(client_site); load_interface_list(mem_ctx, lp_ctx, &ifaces); - /* - * TODO: the caller should pass the address which the client - * used to trigger this call, as the client is able to reach - * this ip. - */ + if (src_address) { pdc_ip = iface_list_best_ip(ifaces, src_address); } else { pdc_ip = iface_list_first_v4(ifaces); } + if (pdc_ip == NULL || !is_ipaddress_v4(pdc_ip)) { + /* this matches windows behaviour */ + pdc_ip = "127.0.0.1"; + } + ZERO_STRUCTP(netlogon); /* check if either of these bits is present */ @@ -325,7 +327,7 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx, netlogon->data.nt5_ex.server_site = server_site; netlogon->data.nt5_ex.client_site = client_site; if (version & NETLOGON_NT_VERSION_5EX_WITH_IP) { - /* Clearly this needs to be fixed up for IPv6 */ + /* note that this is always a IPV4 address */ extra_flags = NETLOGON_NT_VERSION_5EX_WITH_IP; netlogon->data.nt5_ex.sockaddr.sockaddr_family = 2; netlogon->data.nt5_ex.sockaddr.pdc_ip = pdc_ip; |