]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check for sasl/sasl.h too
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 20 Jul 2015 14:47:49 +0000 (10:47 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 20 Jul 2015 14:48:22 +0000 (10:48 -0400)
src/modules/rlm_ldap/config.h.in
src/modules/rlm_ldap/configure
src/modules/rlm_ldap/configure.ac
src/modules/rlm_ldap/ldap.c
src/modules/rlm_ldap/rlm_ldap.c

index e392d4894f9a1f25d07dde2ef253ec52473ca1cb..a3ca36fb46825cdafeb5c76f25e3899f164f3b56 100644 (file)
@@ -56,3 +56,6 @@
 
 /* Build the server with support for Novell eDir Universal Password */
 #undef WITH_EDIR
+
+/* Build the server with support for SASL binds */
+#undef WITH_SASL
index c8f0e74b6b18c1560772f51c8c43184e77e1864f..940411e37857f3a5137bc1ae50499939541696f0 100755 (executable)
@@ -1854,6 +1854,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 fail=
 SMART_LIBS=
 SMART_CLFAGS=
+SASL=
 if test x$with_rlm_ldap != xno; then
 
                                ac_ext=c
@@ -3152,6 +3153,241 @@ fi
 $as_echo "$ac_cv_ldap_set_rebind_proc" >&6; }
        fi
 
+
+
+ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__pm%'`
+old_CPPFLAGS="$CPPFLAGS"
+smart_include=
+smart_include_dir="/usr/local/include /opt/include"
+
+_smart_try_dir=
+_smart_include_dir=
+
+for _prefix in $smart_prefix ""; do
+  for _dir in $smart_try_dir; do
+    _smart_try_dir="${_smart_try_dir} ${_dir}/${_prefix}"
+  done
+
+  for _dir in $smart_include_dir; do
+    _smart_include_dir="${_smart_include_dir} ${_dir}/${_prefix}"
+  done
+done
+
+if test "x$_smart_try_dir" != "x"; then
+  for try in $_smart_try_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl/sasl.h in $try" >&5
+$as_echo_n "checking for sasl/sasl.h in $try... " >&6; }
+    CPPFLAGS="-isystem $try $old_CPPFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <sasl/sasl.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem $try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CPPFLAGS="$old_CPPFLAGS"
+fi
+
+if test "x$smart_include" = "x"; then
+  for _prefix in $smart_prefix; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${_prefix}/sasl/sasl.h" >&5
+$as_echo_n "checking for ${_prefix}/sasl/sasl.h... " >&6; }
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <sasl/sasl.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem ${_prefix}/"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+fi
+
+if test "x$smart_include" = "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl/sasl.h" >&5
+$as_echo_n "checking for sasl/sasl.h... " >&6; }
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <sasl/sasl.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include=" "
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "x$smart_include" = "x"; then
+
+  for prefix in $smart_prefix; do
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file="${_prefix}/${1}"
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
+
+  done
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file=sasl/sasl.h
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
+
+
+  for try in $_smart_include_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl/sasl.h in $try" >&5
+$as_echo_n "checking for sasl/sasl.h in $try... " >&6; }
+    CPPFLAGS="-isystem $try $old_CPPFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <sasl/sasl.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem $try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CPPFLAGS="$old_CPPFLAGS"
+fi
+
+if test "x$smart_include" != "x"; then
+  eval "ac_cv_header_$ac_safe=yes"
+  CPPFLAGS="$smart_include $old_CPPFLAGS"
+  SMART_CPPFLAGS="$smart_include $SMART_CPPFLAGS"
+fi
+
+smart_prefix=
+
+       if test "x$ac_cv_header_sasl_sasl_h" = "xyes"; then
+         if test x"$ac_cv_func_ldap_sasl_interactive_bind" = "xyes"; then
+
+$as_echo "#define WITH_SASL 1" >>confdefs.h
+
+           SASL=sasl.c
+          fi
+       fi
+
        targetname=rlm_ldap
 else
        targetname=
@@ -3190,12 +3426,6 @@ _ACEOF
 mod_ldflags=$SMART_LIBS
 mod_cflags="$SMART_CPPFLAGS"
 
-if test x"$ac_cv_func_ldap_sasl_interactive_bind" = "xyes"; then
-       SASL=sasl.c
-else
-       SASL=
-fi
-
 
 
 
index bce260ba7f6653a2c48d6b99d2741e2ce08f8f5e..b014b706b7eb5595ea81edad8378a93bc3a997ce 100644 (file)
@@ -6,6 +6,7 @@ AC_DEFUN(modname,[rlm_ldap])
 fail=
 SMART_LIBS=
 SMART_CLFAGS=
+SASL=
 if test x$with_[]modname != xno; then
 
        dnl ############################################################
@@ -108,6 +109,17 @@ if test x$with_[]modname != xno; then
                ])
        fi
 
+       dnl ############################################################
+       dnl # Check for SASL support
+       dnl ############################################################
+       FR_SMART_CHECK_INCLUDE([sasl/sasl.h])
+       if test "x$ac_cv_header_sasl_sasl_h" = "xyes"; then
+         if test x"$ac_cv_func_ldap_sasl_interactive_bind" = "xyes"; then
+           AC_DEFINE(WITH_SASL, 1, [Build the server with support for SASL binds])
+           SASL=sasl.c
+         fi
+       fi
+
        targetname=modname
 else
        targetname=
@@ -136,12 +148,6 @@ AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, ${ac_cv_ldap_set_rebind_proc}, [Nu
 mod_ldflags=$SMART_LIBS
 mod_cflags="$SMART_CPPFLAGS"
 
-if test x"$ac_cv_func_ldap_sasl_interactive_bind" = "xyes"; then
-       SASL=sasl.c
-else
-       SASL=
-fi
-
 AC_SUBST(mod_ldflags)
 AC_SUBST(mod_cflags)
 AC_SUBST(SASL)
index dc2e58f80891ad819dc3ac047d2f024adb29dcf5..8aa142e776d1d68bc0f47d05ceeb73472881f91c 100644 (file)
@@ -697,7 +697,7 @@ ldap_rcode_t rlm_ldap_bind(rlm_ldap_t const *inst, REQUEST *request, ldap_handle
        rad_assert(*pconn && (*pconn)->handle);
        rad_assert(!retry || inst->pool);
 
-#ifndef HAVE_LDAP_SASL_INTERACTIVE_BIND
+#ifndef WITH_SASL
        rad_assert(!sasl->mech);
 #endif
 
@@ -712,7 +712,7 @@ ldap_rcode_t rlm_ldap_bind(rlm_ldap_t const *inst, REQUEST *request, ldap_handle
         */
        num = retry ? fr_connection_pool_get_num(inst->pool) : 0;
        for (i = num; i >= 0; i--) {
-#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND
+#ifdef WITH_SASL
                if (sasl && sasl->mech) {
                        status = rlm_ldap_sasl_interactive(inst, request, *pconn, dn, password, sasl,
                                                           &error, &extra);
index 92622986c5b0757a40870fccb71428c0b11d7fb1..404efac0a220ae1942878381f55cfc1558c36983 100644 (file)
@@ -741,7 +741,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
                }
        }
 
-#ifndef HAVE_LDAP_SASL_INTERACTIVE_BIND
+#ifndef WITH_SASL
        if (inst->user_sasl.mech) {
                cf_log_err_cs(conf, "Configuration item 'user.sasl.mech' not supported.  "
                              "Linked libldap does not provide ldap_sasl_bind function");