]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libads: Check if we have a valid sockaddr
authorAndreas Schneider <asn@samba.org>
Wed, 22 Jun 2022 18:54:15 +0000 (20:54 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 27 Jun 2022 20:39:31 +0000 (20:39 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 27 20:39:31 UTC 2022 on sn-devel-184

source3/libads/ldap.c

index 4a559bc5a70b2adc59da8eb8bb0b9217d89bb5b9..e7e34998f7414b4a4d5177943e8915cb9f8f6ace 100755 (executable)
@@ -392,6 +392,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(
@@ -563,6 +567,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
@@ -692,6 +700,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;