summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-02-06 18:16:03 +0100
committerMichael Adam <obnox@samba.org>2008-02-07 14:08:12 +0100
commit086eaf20574264f24230301565f16347c5d2738e (patch)
tree192d8c830e29ca1b5771000f4ab85b15d801ed6b
parent3fcef06e4fdf375f4b07e953a5d707dfc226415b (diff)
downloadsamba-086eaf20574264f24230301565f16347c5d2738e.tar.gz
Add configure check for LBER_LOG_PRINT_FN - to intercept ldap debug.
Use the resulting HAVE_LBER_LOG_PRINT_FN to determine whether we can use it in init_ldap_debugging to intercept LDAP debug output and print it out in the samba logs (controlled with "ldap debug level"). Michael
-rw-r--r--source/configure.in15
-rw-r--r--source/lib/ldap_debug_handler.c4
2 files changed, 17 insertions, 2 deletions
diff --git a/source/configure.in b/source/configure.in
index 14948ad8961..d3fb63bb537 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -3243,6 +3243,21 @@ if test x"$with_ldap_support" != x"no"; then
# this test must be before the libldap test
AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
+ #######################################################
+ # if we have LBER_OPT_LOG_PRINT_FN, we can intercept
+ # ldap logging and print it out in the samba logs
+ AC_CACHE_CHECK([for LBER_OPT_LOG_PRINT_FN],
+ samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN,
+ [AC_TRY_COMPILE([#include <lber.h>],
+ [int val = LBER_OPT_LOG_PRINT_FN;],
+ samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=yes,
+ samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=no)])
+
+ if test x"$samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN" = x"yes"; then
+ AC_DEFINE(HAVE_LBER_LOG_PRINT_FN, 1,
+ [Support for LDAP/LBER logging interception])
+ fi
+
########################################################
# now see if we can find the ldap libs in standard paths
AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
diff --git a/source/lib/ldap_debug_handler.c b/source/lib/ldap_debug_handler.c
index cff50062580..f289f743fb4 100644
--- a/source/lib/ldap_debug_handler.c
+++ b/source/lib/ldap_debug_handler.c
@@ -30,7 +30,7 @@ static void samba_ldap_log_print_fn(LDAP_CONST char *data)
void init_ldap_debugging(void)
{
-#if HAVE_LDAP
+#if defined(HAVE_LDAP) && defined(HAVE_LBER_LOG_PRINT_FN)
int ret;
int ldap_debug_level = lp_ldap_debug_level();
@@ -48,5 +48,5 @@ void init_ldap_debugging(void)
if (ret != LBER_OPT_SUCCESS) {
DEBUG(10, ("Error setting LBER log print function.\n"));
}
-#endif /* HAVE_LDAP */
+#endif /* HAVE_LDAP && HAVE_LBER_LOG_PRINT_FN */
}