summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2022-06-22 20:54:15 +0200
committerJule Anger <janger@samba.org>2022-07-11 11:33:49 +0000
commita708af36656329e0ca39f6f8ab355ea965707bdf (patch)
treede5333c9f0bb34ab1fb38b44502f8d6a06ebc93e
parent42edafd3ed7a99f9a18d1612ea7525b11c43356d (diff)
downloadsamba-a708af36656329e0ca39f6f8ab355ea965707bdf.tar.gz
s3:libads: Check if we have a valid sockaddr
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15106 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit fbf134c8d9e2fe0615824eee6ae7ccdbef4b59dc) Autobuild-User(v4-16-test): Jule Anger <janger@samba.org> Autobuild-Date(v4-16-test): Mon Jul 11 11:33:49 UTC 2022 on sn-devel-184
-rwxr-xr-xsource3/libads/ldap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index b2288241a43..f1a1e036050 100755
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -357,6 +357,10 @@ static NTSTATUS cldap_ping_list(ADS_STRUCT *ads,
for (i = 0; i < count; i++) {
char server[INET6_ADDRSTRLEN];
+ if (is_zero_addr(&sa_list[i].u.ss)) {
+ continue;
+ }
+
print_sockaddr(server, sizeof(server), &sa_list[i].u.ss);
if (!NT_STATUS_IS_OK(
@@ -528,6 +532,10 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
ok = get_dc_name(c_domain, c_realm, srv_name, &ip_out);
if (ok) {
+ if (is_zero_addr(&ip_out)) {
+ return NT_STATUS_NO_LOGON_SERVERS;
+ }
+
/*
* we call ads_try_connect() to fill in the
* ads->config details
@@ -657,6 +665,12 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
status = ADS_ERROR_NT(NT_STATUS_NOT_FOUND);
goto out;
}
+
+ if (is_zero_addr(&ss)) {
+ status = ADS_ERROR_NT(NT_STATUS_NOT_FOUND);
+ goto out;
+ }
+
ok = ads_try_connect(ads, ads->server.gc, &ss);
if (ok) {
goto got_connection;