From 12bad8e9048609eaca2914647dbcb7388202f694 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Mon, 25 Feb 2013 17:13:51 -0500 Subject: [PATCH] Fix rlm_mschap builds on OSX --- src/modules/rlm_mschap/.gitignore | 3 +++ src/modules/rlm_mschap/config.h.in | 22 +++++++++++++++++++ src/modules/rlm_mschap/configure.in | 39 +++++++++++++++++++++++++++++++++ src/modules/rlm_mschap/rlm_mschap.c | 10 ++++----- src/modules/rlm_mschap/rlm_mschap.mk | 2 -- src/modules/rlm_mschap/rlm_mschap.mk.in | 10 +++++++++ 6 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 src/modules/rlm_mschap/config.h.in create mode 100644 src/modules/rlm_mschap/configure.in delete mode 100644 src/modules/rlm_mschap/rlm_mschap.mk create mode 100644 src/modules/rlm_mschap/rlm_mschap.mk.in diff --git a/src/modules/rlm_mschap/.gitignore b/src/modules/rlm_mschap/.gitignore index 3cfae44..c9ba1a4 100644 --- a/src/modules/rlm_mschap/.gitignore +++ b/src/modules/rlm_mschap/.gitignore @@ -1 +1,4 @@ +configure +config.h +rlm_mschap.mk smbencrypt diff --git a/src/modules/rlm_mschap/config.h.in b/src/modules/rlm_mschap/config.h.in new file mode 100644 index 0000000..9aaf853 --- /dev/null +++ b/src/modules/rlm_mschap/config.h.in @@ -0,0 +1,22 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Build with Apple Open Directory support */ +#undef HAVE_OPEN_DIRECTORY + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION diff --git a/src/modules/rlm_mschap/configure.in b/src/modules/rlm_mschap/configure.in new file mode 100644 index 0000000..ad7a438 --- /dev/null +++ b/src/modules/rlm_mschap/configure.in @@ -0,0 +1,39 @@ +AC_INIT(rlm_mschap.c) +AC_REVISION($Revision$) +AC_DEFUN(modname,[rlm_mschap]) + +if test x$with_[]modname != xno; then + + AC_PROG_CC + AC_PROG_CPP + + FR_SMART_CHECK_INCLUDE(membership.h) + if test "x$ac_cv_header_membership_h" = "xyes"; then + AC_DEFINE([HAVE_MEMBERSHIP_H],[1],[Build with Apple Open Directory support]) + mschap_sources+="opendir.c" + mschap_ldflags+=" -framework DirectoryService" + fi + targetname=modname +else + targetname= + echo \*\*\* module modname is disabled. +fi + +if test x"$fail" != x""; then + if test x"${enable_strict_dependencies}" = x"yes"; then + AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.]) + else + AC_MSG_WARN([silently not building ]modname[.]) + AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); + targetname="" + fi +fi + +AC_SUBST(mschap_sources) +AC_SUBST(mschap_ldflags) +AC_SUBST(mschap_cflags) +AC_SUBST(targetname) + +AC_CONFIG_HEADER(config.h) +AC_OUTPUT(rlm_mschap.mk) + diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index 155ac57..31842cd 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -37,10 +37,10 @@ RCSID("$Id$") #include "smbdes.h" #ifdef HAVE_OPENSSL_CRYPTO_H -#include +# include #endif -#ifdef __APPLE__ +#ifdef WITH_OPEN_DIRECTORY extern int od_mschap_auth(REQUEST *request, VALUE_PAIR *challenge, VALUE_PAIR * usernamepair); #endif @@ -152,7 +152,7 @@ typedef struct rlm_mschap_t { const char *auth_type; int allow_retry; char *retry_msg; -#ifdef __APPLE__ +#ifdef WITH_OPEN_DIRECTORY int open_directory; #endif } rlm_mschap_t; @@ -556,7 +556,7 @@ static const CONF_PARSER module_config[] = { offsetof(rlm_mschap_t, allow_retry), NULL, "yes" }, { "retry_msg", PW_TYPE_STRING_PTR, offsetof(rlm_mschap_t, retry_msg), NULL, NULL }, -#ifdef __APPLE__ +#ifdef WITH_OPEN_DIRECTORY { "use_open_directory", PW_TYPE_BOOLEAN, offsetof(rlm_mschap_t,open_directory), NULL, "yes" }, #endif @@ -1705,7 +1705,7 @@ static rlm_rcode_t mschap_authenticate(void * instance, REQUEST *request) return RLM_MODULE_REJECT; } -#ifdef __APPLE__ +#ifdef WITH_OPEN_DIRECTORY /* * No "known good" NT-Password attribute. Try to do * OpenDirectory authentication. diff --git a/src/modules/rlm_mschap/rlm_mschap.mk b/src/modules/rlm_mschap/rlm_mschap.mk deleted file mode 100644 index 880ecd0..0000000 --- a/src/modules/rlm_mschap/rlm_mschap.mk +++ /dev/null @@ -1,2 +0,0 @@ -TARGET := rlm_mschap.a -SOURCES := rlm_mschap.c smbdes.c opendir.c mschap.c diff --git a/src/modules/rlm_mschap/rlm_mschap.mk.in b/src/modules/rlm_mschap/rlm_mschap.mk.in new file mode 100644 index 0000000..2c08419 --- /dev/null +++ b/src/modules/rlm_mschap/rlm_mschap.mk.in @@ -0,0 +1,10 @@ +TARGETNAME := @targetname@ + +ifneq "$(TARGETNAME)" "" +TARGET := $(TARGETNAME).a +endif + +SOURCES := $(TARGETNAME).c smbdes.c mschap.c @mschap_sources@ + +SRC_CFLAGS := @mschap_cflags@ +TGT_LDLIBS := @mschap_ldflags@ -- 2.1.4