From: Patrick Monnerat Date: Wed, 27 Dec 2023 10:19:17 +0000 (+0100) Subject: [PATCH] openldap: fix an LDAP crash X-Git-Tag: archive/raspbian/8.5.0-2+rpi1^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=eb0455f2daaa874c56e62622b19c8c56a26c4340;p=curl.git [PATCH] openldap: fix an LDAP crash Reported-by: Ozan Cansel Fixes #12593 Closes #12600 Gbp-Pq: Name openldap_fix_an_LDAP_crash.patch --- diff --git a/lib/openldap.c b/lib/openldap.c index 131f4741..75dbf188 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -887,10 +887,14 @@ static CURLcode oldap_do(struct Curl_easy *data, bool *done) result = oldap_url_parse(data, &lud); if(!result) { - Sockbuf *sb; - /* re-install the libcurl SSL handlers into the sockbuf. */ - ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb); - ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data); +#ifdef USE_SSL + if(ssl_installed(conn)) { + Sockbuf *sb; + /* re-install the libcurl SSL handlers into the sockbuf. */ + ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb); + ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data); + } +#endif rc = ldap_search_ext(li->ld, lud->lud_dn, lud->lud_scope, lud->lud_filter, lud->lud_attrs, 0,