aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2024-08-29 12:16:19 +0000
committerGraham Leggett <minfrin@apache.org>2024-08-29 12:16:19 +0000
commit0b10ac38d89444d345e94af361c30a8a18d6c879 (patch)
tree289ef2d602f23997fb4501fdf5059185be140382
parentdf96b37b0b9217a28069c1590a29f62563a072f4 (diff)
downloadapr-0b10ac38d89444d345e94af361c30a8a18d6c879.tar.gz
apr-0b10ac38d89444d345e94af361c30a8a18d6c879.zip
apr_ldap: Explicitly detect the case where OpenLDAP has been
installed with SASL support, but the SASL headers are missing. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1920267 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--build/ldap.m43
-rw-r--r--configure.in3
-rw-r--r--include/private/apu_ldap_internal.h.in25
-rw-r--r--include/private/apu_ldap_internal.hw25
-rw-r--r--ldap/apr_ldap.c9
-rw-r--r--libapr.dsp51
7 files changed, 117 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 5efe7b10b..a6f190bf5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 2.0.0
+ *) apr_ldap: Explicitly detect the case where OpenLDAP has been
+ installed with SASL support, but the SASL headers are missing.
+ [Graham Leggett]
+
*) testmmap: Avoid a crash after test_file_open() fails. [Graham
Leggett]
diff --git a/build/ldap.m4 b/build/ldap.m4
index 600d7f1c9..5345c042b 100644
--- a/build/ldap.m4
+++ b/build/ldap.m4
@@ -93,6 +93,7 @@ AC_DEFUN([APU_FIND_LDAPLIB], [
AC_CHECK_LIB(${ldaplib}, ldap_init,
[
LDADD_ldap_found="-l${ldaplib} ${extralib}"
+ AC_CHECK_LIB(${ldaplib}, ldap_sasl_interactive_bind, apu_have_ldap_sasl_interactive_bind="1", , ${extralib})
apu_have_ldap="1";
], , ${extralib})
fi
@@ -106,6 +107,7 @@ AC_DEFUN([APU_FIND_LDAP], [
echo $ac_n "${nl}checking for ldap support..."
+apu_have_ldap_sasl_interactive_bind="0"
apu_have_ldap="0";
apu_have_ldap_openldap="0"
apu_have_ldap_microsoft="0"
@@ -224,6 +226,7 @@ AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
AC_SUBST(ldap_h)
AC_SUBST(lber_h)
+AC_SUBST(apu_have_ldap_sasl_interactive_bind)
AC_SUBST(apu_have_ldap)
AC_SUBST(apu_have_ldap_openldap)
AC_SUBST(apu_have_ldap_solaris)
diff --git a/configure.in b/configure.in
index 34aeebf03..8c2a0cbdf 100644
--- a/configure.in
+++ b/configure.in
@@ -3306,7 +3306,8 @@ if test -d $srcdir/test; then
AC_CONFIG_FILES([test/Makefile test/internal/Makefile])
fi
-AC_CONFIG_FILES([include/private/apu_select_dbm.h
+AC_CONFIG_FILES([include/private/apu_ldap_internal.h
+ include/private/apu_select_dbm.h
include/apu_want.h])
dir=include/arch/unix
diff --git a/include/private/apu_ldap_internal.h.in b/include/private/apu_ldap_internal.h.in
new file mode 100644
index 000000000..1b65dd847
--- /dev/null
+++ b/include/private/apu_ldap_internal.h.in
@@ -0,0 +1,25 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APU_LDAP_INTERNAL_H
+#define APU_LDAP_INTERNAL_H
+
+/*
+** The following macros control what features APRUTIL will use
+*/
+#define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND @apu_have_ldap_sasl_interactive_bind@
+
+#endif /* !APU_LDAP_INTERNAL_H */
diff --git a/include/private/apu_ldap_internal.hw b/include/private/apu_ldap_internal.hw
new file mode 100644
index 000000000..5aebf0dff
--- /dev/null
+++ b/include/private/apu_ldap_internal.hw
@@ -0,0 +1,25 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APU_LDAP_INTERNAL_H
+#define APU_LDAP_INTERNAL_H
+
+/*
+** The following macros control what features APRUTIL will use
+*/
+#define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND 0
+
+#endif /* !APU_LDAP_INTERNAL_H */
diff --git a/ldap/apr_ldap.c b/ldap/apr_ldap.c
index 23c9ec3a7..31b23654c 100644
--- a/ldap/apr_ldap.c
+++ b/ldap/apr_ldap.c
@@ -25,6 +25,7 @@
#include "apr_ldap.h"
#include "apr_ldap_internal.h"
#include "apu_internal.h"
+#include "apu_ldap_internal.h"
#include "apr_errno.h"
#include "apr_poll.h"
#include "apr_pools.h"
@@ -1803,7 +1804,11 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_poll(apr_pool_t *pool,
-#if APR_HAS_OPENLDAP_LDAPSDK
+#if APR_HAS_OPENLDAP_LDAPSDK && APR_HAVE_LDAP_SASL_INTERACTIVE_BIND
+
+#if !defined(HAVE_SASL_H) && !defined(HAVE_SASL_SASL_H)
+#error OpenLDAP was built with SASL support, but the SASL headers are not installed as required.
+#endif
typedef struct apr_ldap_bind_ctx_t {
apr_ldap_t *ld;
@@ -2000,7 +2005,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_bind(apr_pool_t *pool, apr_ldap_t *ldap,
}
else {
-#if APR_HAS_OPENLDAP_LDAPSDK
+#if APR_HAS_OPENLDAP_LDAPSDK && APR_HAVE_LDAP_SASL_INTERACTIVE_BIND
const char *rmech;
diff --git a/libapr.dsp b/libapr.dsp
index 3c4e53b54..1a96b1feb 100644
--- a/libapr.dsp
+++ b/libapr.dsp
@@ -1115,6 +1115,57 @@ SOURCE=.\include\apu.h
# End Source File
# Begin Source File
+SOURCE=.\include\private\apu_ldap_internal.h.in
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\private\apu_ldap_internal.hw
+
+!IF "$(CFG)" == "libapr - Win32 Release"
+
+# Begin Custom Build - Creating apu_ldap_internal.h from apu_ldap_internal.hw
+InputPath=.\include\private\apu_ldap_internal.hw
+
+".\include\private\apu_ldap_internal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ type .\include\private\apu_ldap_internal.hw > .\include\private\apu_ldap_internal.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "libapr - Win32 Debug"
+
+# Begin Custom Build - Creating apu_ldap_internal.h from apu_ldap_internal.hw
+InputPath=.\include\private\apu_ldap_internal.hw
+
+".\include\private\apu_ldap_internal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ type .\include\private\apu_ldap_internal.hw > .\include\private\apu_ldap_internal.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "libapr - x64 Release"
+
+# Begin Custom Build - Creating apu_ldap_internal.h from apu_ldap_internal.hw
+InputPath=.\include\private\apu_ldap_internal.hw
+
+".\include\private\apu_ldap_internal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ type .\include\private\apu_ldap_internal.hw > .\include\private\apu_ldap_internal.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "libapr - x64 Debug"
+
+# Begin Custom Build - Creating apu_ldap_internal.h from apu_ldap_internal.hw
+InputPath=.\include\private\apu_ldap_internal.hw
+
+".\include\private\apu_ldap_internal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ type .\include\private\apu_ldap_internal.hw > .\include\private\apu_ldap_internal.h
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\include\private\apu_select_dbm.h.in
# End Source File
# Begin Source File