ldap: only set the callback ptr for TLS context when TLS is used

Follow-up to a5eee22e59
Fixes #6804
Closes #6805
This commit is contained in:
Patrick Monnerat 2021-03-28 11:43:11 +02:00 committed by Daniel Stenberg
parent 85e6975643
commit 8cbc16b2f9
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -365,13 +365,14 @@ static CURLcode ldap_disconnect(struct Curl_easy *data,
{
struct ldapconninfo *li = conn->proto.ldapc;
(void) dead_connection;
(void) data;
if(li) {
if(li->ld) {
Sockbuf *sb;
ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb);
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
if(conn->ssl[FIRSTSOCKET].use) {
Sockbuf *sb;
ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb);
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
}
ldap_unbind_ext(li->ld, NULL, NULL);
li->ld = NULL;
}