]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't clear LDAP controls before using them to unbind.
authorNick Porter <nick@portercomputing.co.uk>
Tue, 2 May 2023 07:47:42 +0000 (08:47 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 2 May 2023 07:47:42 +0000 (08:47 +0100)
src/lib/ldap/connection.c

index 2deae56612d190f3d9e6307d7241dcde4a96a80b..e1ad4ec2ae651e9792d06131fbe9fee2af50d99a 100644 (file)
@@ -222,11 +222,7 @@ static int _ldap_connection_free(fr_ldap_connection_t *c)
 
        talloc_free_children(c);        /* Force inverted free order */
 
-       fr_ldap_control_clear(c);
-
-       if (!c->handle) return 0;       /* Don't need to do anything else if we don't yet have a handle */
-
-       {
+       if (c->handle) {
                LDAPControl     *our_serverctrls[LDAP_MAX_CONTROLS];
                LDAPControl     *our_clientctrls[LDAP_MAX_CONTROLS];
 
@@ -239,7 +235,7 @@ static int _ldap_connection_free(fr_ldap_connection_t *c)
                ldap_unbind_ext(c->handle, our_serverctrls, our_clientctrls);   /* Same code as ldap_unbind_ext_s */
        }
 
-       c->handle = NULL;
+       fr_ldap_control_clear(c);
 
        return 0;
 }