1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3:libsmb: allow store_cldap_reply() to work with a ipv6 response

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 10 01:35:18 UTC 2024 on atb-devel-224
This commit is contained in:
Stefan Metzmacher 2024-05-07 14:53:24 +00:00 committed by Andrew Bartlett
parent 05807488fd
commit 712ffbffc0

View File

@ -196,7 +196,29 @@ static NTSTATUS store_cldap_reply(TALLOC_CTX *mem_ctx,
/* FIXME */
r->sockaddr_size = 0x10; /* the w32 winsock addr size */
r->sockaddr.sockaddr_family = 2; /* AF_INET */
r->sockaddr.pdc_ip = talloc_strdup(mem_ctx, addr);
if (is_ipaddress_v4(addr)) {
r->sockaddr.pdc_ip = talloc_strdup(mem_ctx, addr);
if (r->sockaddr.pdc_ip == NULL) {
return NT_STATUS_NO_MEMORY;
}
} else {
/*
* ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX will
* fail with an ipv6 address.
*
* This matches windows behaviour in the CLDAP
* response when NETLOGON_NT_VERSION_5EX_WITH_IP
* is used.
*
* Windows returns the ipv4 address of the ipv6
* server interface and falls back to 127.0.0.1
* if there's no ipv4 address.
*/
r->sockaddr.pdc_ip = talloc_strdup(mem_ctx, "127.0.0.1");
if (r->sockaddr.pdc_ip == NULL) {
return NT_STATUS_NO_MEMORY;
}
}
ndr_err = ndr_push_struct_blob(&blob, mem_ctx, r,
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX);