]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ldap: only set the callback ptr for TLS context when TLS is used
authorPatrick Monnerat <patrick@monnerat.net>
Sun, 28 Mar 2021 09:43:11 +0000 (11:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 28 Mar 2021 14:01:20 +0000 (16:01 +0200)
Follow-up to a5eee22e594c2460f
Fixes #6804
Closes #6805

lib/openldap.c

index 049ddd437503b6570b78df08ee120cb9818e389f..b6980c590021b84ec99386c068dbf27692739a36 100644 (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;
     }