From 205f8b266cfeedc18d4fad134b7fbd6d68c14ef3 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 11 Mar 2005 05:28:07 +0000 Subject: Fixed LDAP library file name bug (KNOWN_BUGS #1). configure now auto-detects the correct dynamic library names by default, and provides override switches --with-ldap-lib, --with-lber-lib and --without-lber-lib. Added CURL_DISABLE_LDAP to platform-specific config files to disable LDAP support on those platforms that probably don't have dynamic OpenLDAP libraries available to avoid compile errors. --- lib/Makefile.netware | 1 + lib/config-amigaos.h | 2 ++ lib/config-mac.h | 2 ++ lib/config-riscos.h | 3 +++ lib/config-win32.h | 6 ++++++ lib/config.dj | 3 +++ lib/ldap.c | 24 ++++++++++++++---------- 7 files changed, 31 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/Makefile.netware b/lib/Makefile.netware index 35c7932ce..a41656fbc 100644 --- a/lib/Makefile.netware +++ b/lib/Makefile.netware @@ -336,6 +336,7 @@ config.h: Makefile.netware @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ + @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ ifdef NW_WINSOCK @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ else diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index 387adebf7..88779753d 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -57,6 +57,8 @@ #define USE_OPENSSL 1 #define USE_SSLEAY 1 +#define CURL_DISABLE_LDAP 1 + #define OS "AmigaOS" diff --git a/lib/config-mac.h b/lib/config-mac.h index 8b0b0337c..d742452b1 100644 --- a/lib/config-mac.h +++ b/lib/config-mac.h @@ -36,6 +36,8 @@ # define USE_OPENSSL 1 #endif +#define CURL_DISABLE_LDAP 1 + #define HAVE_RAND_STATUS 1 #define HAVE_RAND_EGD 1 diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 85dec3ea4..be18c8693 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -388,3 +388,6 @@ #define HAVE_FIONBIO +/* to disable LDAP */ +#define CURL_DISABLE_LDAP + diff --git a/lib/config-win32.h b/lib/config-win32.h index a12394f2c..e17ef98ae 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -232,6 +232,12 @@ /* use ioctlsocket() for non-blocking sockets */ #define HAVE_IOCTLSOCKET +/* lber dynamic library file */ +/* #undef DL_LBER_FILE */ + +/* ldap dynamic library file */ +#define DL_LDAP_FILE "wldap32.dll" + /************************************************* * This section is for compiler specific defines.* *************************************************/ diff --git a/lib/config.dj b/lib/config.dj index f2d38d3da..4b53bd9ae 100644 --- a/lib/config.dj +++ b/lib/config.dj @@ -93,6 +93,9 @@ #define USE_OPENSSL 1 #endif +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ #if (DJGPP_MINOR < 4) diff --git a/lib/ldap.c b/lib/ldap.c index 15c19b377..bb8a84933 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -110,7 +110,7 @@ typedef void * (*dynafunc)(void *input); */ #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) || defined(WIN32) static void *libldap = NULL; -#ifndef WIN32 +#if defined(DL_LBER_FILE) static void *liblber = NULL; #endif #endif @@ -120,24 +120,26 @@ static int DynaOpen(const char **mod_name) #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) if (libldap == NULL) { /* - * libldap.so should be able to resolve its dependency on - * liblber.so automatically, but since it does not we will + * libldap.so can normally resolve its dependency on liblber.so + * automatically, but in broken installation it does not so * handle it here by opening liblber.so as global. */ - *mod_name = "liblber.so"; +#ifdef DL_LBER_FILE + *mod_name = DL_LBER_FILE; liblber = dlopen(*mod_name, DLOPEN_MODE); + if (!liblber) + return 0; +#endif /* Assume loading libldap.so will fail if loading of liblber.so failed */ - if (liblber) { - *mod_name = "libldap.so"; - libldap = dlopen(*mod_name, RTLD_LAZY); - } + *mod_name = DL_LDAP_FILE; + libldap = dlopen(*mod_name, RTLD_LAZY); } - return (libldap != NULL && liblber != NULL); + return (libldap != NULL); #elif defined(WIN32) - *mod_name = "wldap32.dll"; + *mod_name = DL_LDAP_FILE; if (!libldap) libldap = (void*)LoadLibrary(*mod_name); return (libldap != NULL); @@ -155,10 +157,12 @@ static void DynaClose(void) dlclose(libldap); libldap=NULL; } +#ifdef DL_LBER_FILE if (liblber) { dlclose(liblber); liblber=NULL; } +#endif #elif defined(WIN32) if (libldap) { FreeLibrary ((HMODULE)libldap); -- cgit v1.2.3