From d7cdf6ee36adeac9233678fb8f2a112e6678a770 Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Tue, 22 Jul 2014 11:01:03 -0400 Subject: Diagnose incompatible OpenLDAP versions during build and test. With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, PostgreSQL backends can crash at exit. Raise a warning during "configure" based on the compile-time OpenLDAP version number, and test the crash scenario in the dblink test suite. Back-patch to 9.0 (all supported versions). --- configure.in | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 0d7cb5a77c6..e22f8d8ad76 100644 --- a/configure.in +++ b/configure.in @@ -1097,10 +1097,39 @@ if test "$with_libxslt" = yes ; then AC_CHECK_HEADER(libxslt/xslt.h, [], [AC_MSG_ERROR([header file is required for XSLT support])]) fi +# PGAC_LDAP_SAFE +# -------------- +# PostgreSQL sometimes loads libldap_r and plain libldap into the same +# process. Check for OpenLDAP versions known not to tolerate doing so; assume +# non-OpenLDAP implementations are safe. The dblink test suite exercises the +# hazardous interaction directly. + +AC_DEFUN([PGAC_LDAP_SAFE], +[AC_CACHE_CHECK([for compatible LDAP implementation], [pgac_cv_ldap_safe], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[#include +#if !defined(LDAP_VENDOR_VERSION) || \ + (defined(LDAP_API_FEATURE_X_OPENLDAP) && \ + LDAP_VENDOR_VERSION >= 20424 && LDAP_VENDOR_VERSION <= 20431) +choke me +#endif], [])], +[pgac_cv_ldap_safe=yes], +[pgac_cv_ldap_safe=no])]) + +if test "$pgac_cv_ldap_safe" != yes; then + AC_MSG_WARN([ +*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend +*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and +*** also uses LDAP will crash on exit.]) +fi]) + + + if test "$with_ldap" = yes ; then if test "$PORTNAME" != "win32"; then AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR([header file is required for LDAP])]) + PGAC_LDAP_SAFE else AC_CHECK_HEADERS(winldap.h, [], [AC_MSG_ERROR([header file is required for LDAP])], -- cgit v1.2.3