From e73ec5a0bd0c052d3ce8b621381fc5f58014aa2b Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 9 Aug 2004 20:55:23 +0000 Subject: Conditional Compilation of the various handlers --- ChangeLog | 4 ++++ configure.in | 45 ++++++++++++++++++++++++++++++++++----------- daemon/Makefile.am | 21 +++++++++++++++------ daemon/httpauthd.c | 8 ++++++-- 4 files changed, 59 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3db63b2..d90d42e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +0.4.2 + - Separated base handler functionality, reorganized files, code + - Conditional compilation of various handlers + 0.4.1 - Fix unititialized memory bug - Fixed address parsing and formatting bugs diff --git a/configure.in b/configure.in index 320fa2d..5b0a37e 100644 --- a/configure.in +++ b/configure.in @@ -36,8 +36,8 @@ dnl Nate Nielsen dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT(httpauth, 0.4.1, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(httpauth, 0.4.1) +AC_INIT(httpauth, 0.4.2, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(httpauth, 0.4.2) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include -g -O0" @@ -57,13 +57,14 @@ AC_ARG_ENABLE(debug, [Compile binaries in debug mode])) if test "$enable_debug" = "yes"; then - CFLAGS="$CFLAGS -g -O0" - AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode]) - echo "enabling debug compile mode" + CFLAGS="$CFLAGS -g -O0" + AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode]) + echo "enabling debug compile mode" fi -# TODO: Make SMB support an option -# TODO: Make LDAP support an option +# Check for the various options +AC_ARG_WITH(ldap, [ --with-ldap with LDAP support]) +AC_ARG_ENABLE(ntlm, [ --enable-ntlm enable NTLM support]) # TODO: Figure out why we need this wierd hack ACX_PTHREAD( , [echo "ERROR: Pthread support not found."; exit 1] ) @@ -76,9 +77,6 @@ AC_CHECK_LIB([crypt_r], [crypt], , [ [ echo "ERROR: Crypt library required."; exit 1] ) ]) -AC_CHECK_LIB([ldap], [ldap_init], , - [ echo "ERROR: Open LDAP 2.x library required."; exit 1] ) - # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([unistd.h stdio.h stddef.h fcntl.h stdlib.h assert.h errno.h stdarg.h err.h string.h], , @@ -92,11 +90,36 @@ AC_CHECK_DECL(PTHREAD_MUTEX_ERRORCHECK_NP, [AC_DEFINE(HAVE_ERR_MUTEX, 1, "Error [AC_CHECK_DECL(PTHREAD_MUTEX_ERRORCHECK, [AC_DEFINE(HAVE_ERR_MUTEX, 2)], [echo "ERROR: Missing error checking mutex functionality in pthread.h"], [ #include ])], [ #include ]) - + # Required Functions AC_CHECK_FUNCS([memset strerror malloc realloc getopt strchr tolower getaddrinfo], , [echo "ERROR: Required function missing"; exit 1]) AC_CHECK_FUNCS([strlwr]) + +# LDAP support +AM_CONDITIONAL(WITH_LDAP, test -n "$with_ldap") +if test -n "$with_ldap"; then + + echo "enabling LDAP support" + + if test "$with_ldap" != "yes"; then + LDFLAGS="$LDFLAGS -L$with_ldap/lib" + CFLAGS="$CFLAGS -L$with_ldap/include" + fi + + AC_CHECK_LIB([ldap], [ldap_init], , + [ echo "ERROR: Open LDAP 2.x library required."; exit 1] ) + + AC_CHECK_HEADERS(ldap.h) + AC_DEFINE_UNQUOTED(WITH_LDAP, 1, [With LDAP Support] ) +fi + +# NTLM Support +AM_CONDITIONAL(WITH_NTLM, test -n "$enable_ntlm") +if test -n "$enable_ntlm"; then + echo "enabling NTLM support" + AC_DEFINE_UNQUOTED(WITH_NTLM, 1, [With NTLM Support] ) +fi AC_CONFIG_FILES([Makefile daemon/Makefile doc/Makefile]) AC_OUTPUT diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 3d80d4c..7eb7087 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -2,23 +2,32 @@ sbin_PROGRAMS = httpauthd httpauthd_SOURCES = httpauthd.c httpauthd.h usuals.h bd.h bd.c misc.c basic.h basic.c \ - ntlm.c ntlmssp.h ntlmssp.c digest.h digest.c ldap.c defaults.h simple.c \ - \ + digest.h digest.c defaults.h simple.c \ ../common/compat.h ../common/compat.c ../common/buffer.h ../common/buffer.c \ ../common/hash.h ../common/hash.c ../common/md5.h ../common/md5.c \ ../common/sha1.h ../common/sha1.c ../common/sock_any.c ../common/sock_any.h \ - ../common/stringx.c ../common/stringx.h \ - \ + ../common/stringx.c ../common/stringx.h + +LDAP_SOURCES = ldap.c + +NTLM_SOURCES = ntlm.c ntlmssp.h ntlmssp.c \ smblib/smblib.c smblib/smblib-util.c smblib/file.c smblib/smb-errors.c \ smblib/exper.c smblib/smblib-api.c smblib/smblib.h smblib/std-defines.h \ smblib/smblib-priv.h smblib/smblib-common.h \ - \ rfcnb/rfcnb-io.c rfcnb/rfcnb-util.c rfcnb/session.c rfcnb/byteorder.h \ rfcnb/rfcnb-common.h rfcnb/rfcnb-error.h rfcnb/rfcnb.h rfcnb/rfcnb-io.h \ rfcnb/rfcnb-priv.h rfcnb/rfcnb-util.h rfcnb/std-includes.h +if WITH_LDAP +httpauthd_SOURCES += $(LDAP_SOURCES) +endif + +if WITH_NTLM +httpauthd_SOURCES += $(NTLM_SOURCES) +endif + httpauthd_CFLAGS = -D_THREAD_SAFE -pthread -DLinux \ -I${top_srcdir}/common/ -I${top_srcdir} httpauthd_LDFLAGS = -pthread -EXTRA_DIST = +EXTRA_DIST = $(LDAP_SOURCES) diff --git a/daemon/httpauthd.c b/daemon/httpauthd.c index 17ed15c..f995d6d 100644 --- a/daemon/httpauthd.c +++ b/daemon/httpauthd.c @@ -36,9 +36,13 @@ extern ha_handler_t ntlm_handler; /* This is the list of all available handlers */ ha_handler_t* g_handlerlist[] = { - &simple_handler, +#if WITH_LDAP &ldap_handler, - &ntlm_handler +#endif +#if WITH_NTLM + &ntlm_handler, +#endif + &simple_handler, }; typedef struct httpauth_loaded -- cgit v1.2.3