From: Nick Porter Date: Tue, 2 May 2023 07:47:42 +0000 (+0100) Subject: Don't clear LDAP controls before using them to unbind. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c338fc73682f9d37e03b6f3453be395bb2994e66;p=thirdparty%2Ffreeradius-server.git Don't clear LDAP controls before using them to unbind. --- diff --git a/src/lib/ldap/connection.c b/src/lib/ldap/connection.c index 2deae56612d..e1ad4ec2ae6 100644 --- a/src/lib/ldap/connection.c +++ b/src/lib/ldap/connection.c @@ -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; }