]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/libads: get rid of additional loop calling add_failed_connection_entry()
authorRalph Boehme <slow@samba.org>
Tue, 1 Jul 2025 16:19:32 +0000 (18:19 +0200)
committerJule Anger <janger@samba.org>
Thu, 7 Aug 2025 12:53:16 +0000 (12:53 +0000)
Just call add_failed_connection_entry() in the initial loop at all places where
we have a "bad" result.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit a397801598eef4b0381a64a37af1845e9e85a50f)

source3/libads/ldap.c

index 82d47341221721dd38f9310e5d45336dcb16dec3..af467cfe390f2d3912e826f09ab2f3b6ef61d357 100644 (file)
@@ -518,16 +518,24 @@ again:
                struct NETLOGON_SAM_LOGON_RESPONSE_EX *cldap_reply = NULL;
                char server[INET6_ADDRSTRLEN];
 
+               print_sockaddr(server, sizeof(server), &req_sa_list[i]->u.ss);
+
                if (responses[i] == NULL) {
+                       add_failed_connection_entry(
+                               domain,
+                               server,
+                               NT_STATUS_INVALID_NETWORK_RESPONSE);
                        continue;
                }
 
-               print_sockaddr(server, sizeof(server), &req_sa_list[i]->u.ss);
-
                if (responses[i]->ntver != NETLOGON_NT_VERSION_5EX) {
                        DBG_NOTICE("realm=[%s] nt_version mismatch: 0x%08x for %s\n",
                                   ads->server.realm,
                                   responses[i]->ntver, server);
+                       add_failed_connection_entry(
+                               domain,
+                               server,
+                               NT_STATUS_INVALID_NETWORK_RESPONSE);
                        continue;
                }
 
@@ -595,16 +603,6 @@ again:
                }
        }
 
-       /* keep track of failures as all were not suitable */
-       for (i = 0; i < num_requests; i++) {
-               char server[INET6_ADDRSTRLEN];
-
-               print_sockaddr(server, sizeof(server), &req_sa_list[i]->u.ss);
-
-               add_failed_connection_entry(domain, server,
-                                           NT_STATUS_UNSUCCESSFUL);
-       }
-
        status = NT_STATUS_NO_LOGON_SERVERS;
        DBG_WARNING("realm[%s] no valid response "
                    "num_requests[%zu] for count[%zu] - %s\n",