From cace68e2999a7b007774f78eb2084aec937fb633 Mon Sep 17 00:00:00 2001 From: Federico Pellegrin Date: Wed, 8 Feb 2023 19:44:58 +0100 Subject: [PATCH] openldap: fix missing sasl symbols at build in specific configs If curl is built with openldap support (USE_OPENLDAP=1) but does not have also some other protocol (IMAP/SMTP/POP3) enabled that brings in Curl_sasl_* functions, then the build will fail with undefined references to various symbols: ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_decode_mech' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_parse_url_auth_option' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_cleanup' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_can_authenticate' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_continue' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_start' ld: ../lib/.libs/libcurl.so: undefined reference to `Curl_sasl_init' This was tracked down to these functions bein used in openldap.c but defined in curl_sasl.c and then forward in two vauth/ files to have a guard against a set of #define configurations that was now extended to cover also this case. Example configuration targeted that could reproduce the problem: curl 7.87.1-DEV () libcurl/7.87.1-DEV .... OpenLDAP/2.6.3 Protocols: file ftp ftps http https ldap ldaps Closes #10445 --- lib/curl_sasl.c | 3 ++- lib/vauth/cleartext.c | 3 ++- lib/vauth/oauth2.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index 9317fc3936..119fb9b25a 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -36,7 +36,8 @@ #include "curl_setup.h" #if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_SMTP) || \ - !defined(CURL_DISABLE_POP3) + !defined(CURL_DISABLE_POP3) || \ + (!defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP)) #include #include "urldata.h" diff --git a/lib/vauth/cleartext.c b/lib/vauth/cleartext.c index 1f6eae9997..c651fc5145 100644 --- a/lib/vauth/cleartext.c +++ b/lib/vauth/cleartext.c @@ -28,7 +28,8 @@ #include "curl_setup.h" #if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_SMTP) || \ - !defined(CURL_DISABLE_POP3) + !defined(CURL_DISABLE_POP3) || \ + (!defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP)) #include #include "urldata.h" diff --git a/lib/vauth/oauth2.c b/lib/vauth/oauth2.c index 5f0f0e6976..a4adbdcf15 100644 --- a/lib/vauth/oauth2.c +++ b/lib/vauth/oauth2.c @@ -27,7 +27,8 @@ #include "curl_setup.h" #if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_SMTP) || \ - !defined(CURL_DISABLE_POP3) + !defined(CURL_DISABLE_POP3) || \ + (!defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP)) #include #include "urldata.h"