From: Arran Cudbard-Bell Date: Mon, 20 Jul 2015 14:47:49 +0000 (-0400) Subject: Check for sasl/sasl.h too X-Git-Tag: release_3_0_10~318 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4029af0642e44bfc48f8a06afd85fdf803128d02;p=thirdparty%2Ffreeradius-server.git Check for sasl/sasl.h too --- diff --git a/src/modules/rlm_ldap/config.h.in b/src/modules/rlm_ldap/config.h.in index e392d4894f9..a3ca36fb468 100644 --- a/src/modules/rlm_ldap/config.h.in +++ b/src/modules/rlm_ldap/config.h.in @@ -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 diff --git a/src/modules/rlm_ldap/configure b/src/modules/rlm_ldap/configure index c8f0e74b6b1..940411e3785 100755 --- a/src/modules/rlm_ldap/configure +++ b/src/modules/rlm_ldap/configure @@ -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 +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 +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 +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 +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 - diff --git a/src/modules/rlm_ldap/configure.ac b/src/modules/rlm_ldap/configure.ac index bce260ba7f6..b014b706b7e 100644 --- a/src/modules/rlm_ldap/configure.ac +++ b/src/modules/rlm_ldap/configure.ac @@ -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) diff --git a/src/modules/rlm_ldap/ldap.c b/src/modules/rlm_ldap/ldap.c index dc2e58f8089..8aa142e776d 100644 --- a/src/modules/rlm_ldap/ldap.c +++ b/src/modules/rlm_ldap/ldap.c @@ -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); diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 92622986c5b..404efac0a22 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -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");