Repository: mesos Updated Branches: refs/heads/master f6620f851 -> 25844c57b
Added test for CRAM-MD5 support of SASL within configuration phase. Review: https://reviews.apache.org/r/30263 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/25844c57 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/25844c57 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/25844c57 Branch: refs/heads/master Commit: 25844c57bb33b93545a9dada1e5018f9ae43b4c2 Parents: f6620f8 Author: Till Toenshoff <[email protected]> Authored: Thu Apr 16 15:35:29 2015 +0200 Committer: Till Toenshoff <[email protected]> Committed: Thu Apr 16 15:35:29 2015 +0200 ---------------------------------------------------------------------- configure.ac | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/25844c57/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 6346db9..7f9e529 100644 --- a/configure.ac +++ b/configure.ac @@ -735,7 +735,7 @@ libsubversion-1 is required for mesos to build. ])]) -# Check if Sasl2 prefix path was provided, and if so, add it to +# Check if Sasl2 prefix path was provided, and if so, add it to # the CPPFLAGS and LDFLAGS with respective /include and /lib path # suffixes. if test -n "`echo $with_sasl`" ; then @@ -743,9 +743,6 @@ if test -n "`echo $with_sasl`" ; then LDFLAGS="-L${with_sasl}/lib $LDFLAGS" fi -# TODO(benh): Also check for md5 support so we can use the CRAM-MD5 -# mechanism. We can likely do a AC_CHECK_LIB looking for a particular -# function only provided if md5 support is present. AC_CHECK_LIB([sasl2], [sasl_done], [], [AC_MSG_ERROR([cannot find libsasl2 ------------------------------------------------------------------- @@ -753,6 +750,66 @@ We need libsasl2 for authentication! ------------------------------------------------------------------- ])]) +AC_MSG_CHECKING([SASL CRAM-MD5 support]) + +# Render a test binary for checking if the SASL client supports CRAM-MD5. +cat <<__EOF__ >crammd5_installed.c [ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include <sasl/sasl.h> +#include <sasl/saslplug.h> +#include <sasl/saslutil.h> + +static void search_crammd5( + client_sasl_mechanism_t *m, + sasl_info_callback_stage_t stage, + void *rock) +{ + if (stage == SASL_INFO_LIST_START || stage == SASL_INFO_LIST_END) { + return; + } + if (m->plug != NULL) { + if (!strcmp("CRAM-MD5", m->plug->mech_name)) { + printf("found"); + } + } +} + +int main(int argc, char** argv) +{ + int result = sasl_client_init(NULL); + if (result != SASL_OK) { + return 1; + } + sasl_client_plugin_info(NULL, &search_crammd5, NULL); + return 0; +}] +__EOF__ + +# Build the SASL client check test binary. Prevent the use of possibly +# activated debug symbols in executables (cc -g) as those cause a +# distcheck failure on OSX by leaking build artefacts (.dsym). +AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], + [SASL_TEST_CFLAGS=""], [SASL_TEST_CFLAGS=$CFLAGS]) +$CC crammd5_installed.c $CPPFLAGS $SASL_TEST_CFLAGS $LDFLAGS -lsasl2 \ + -o crammd5_installed 2>&1 >/dev/null + +# Run the test binary and get its output. +crammd5test=`./crammd5_installed 2>&1` + +# Clean up all leftovers from this test. +rm -f crammd5_installed.c crammd5_installed + +AS_IF([test "x$crammd5test" = "xfound"], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([no +------------------------------------------------------------------- +We need CRAM-MD5 support for SASL authentication. +-------------------------------------------------------------------])]) + + # Perform necessary configuration for network isolator. if test "x$with_network_isolator" = "xyes"; then # Check for OS support.
