s3:libads: call ldap_set_option(LDAP_OPT_PROTOCOL_VERSION) as soon as possible
authorStefan Metzmacher <metze@samba.org>
Tue, 30 Jan 2024 09:27:58 +0000 (10:27 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 23 Apr 2024 23:50:34 +0000 (23:50 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libads/ldap.c

index 84771f6a43e3306d3d6a0e3a73e6cc42099b1055..211a18472a8397d5e5866e2d9c3bb4fd3e77c984 100644 (file)
@@ -991,14 +991,14 @@ got_connection:
        }
        DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name));
 
+       ldap_set_option(ads->ldap.ld, LDAP_OPT_PROTOCOL_VERSION, &version);
+
        /* cache the successful connection for workgroup and realm */
        if (ads_closest_dc(ads)) {
                saf_store( ads->server.workgroup, ads->config.ldap_server_name);
                saf_store( ads->server.realm, ads->config.ldap_server_name);
        }
 
-       ldap_set_option(ads->ldap.ld, LDAP_OPT_PROTOCOL_VERSION, &version);
-
        /* fill in the current time and offsets */
 
        status = ads_current_time( ads );