changeset 6199:c1d09af8bdda HEAD

Added --with-gssapi=plugin
author Timo Sirainen <tss@iki.fi>
date Tue, 07 Aug 2007 01:00:12 +0300
parents 4f6c4aeafafb
children 9d77a7d26f28
files configure.in src/auth/Makefile.am src/auth/mech-gssapi.c src/auth/mech.c
diffstat 4 files changed, 53 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Tue Aug 07 00:51:16 2007 +0300
+++ b/configure.in	Tue Aug 07 01:00:12 2007 +0300
@@ -138,10 +138,14 @@
 
 AC_ARG_WITH(gssapi,
 [  --with-gssapi           Build with GSSAPI authentication support],
-    if test x$withval = xno; then
+	if test x$withval = xno; then
 		want_gssapi=no
+	elif test x$withval = xplugin; then
+		want_gssapi=yes
+		want_gssapi_plugin=yes
 	else
 		want_gssapi=yes
+		want_gssapi_plugin=no
 	fi,
 	want_gssapi=no)
 
@@ -1556,8 +1560,10 @@
 		# version >= v1.3. Although this doesn't work right with
 		# non-MIT kerberos versioning..
 		if `krb5-config --version|grep -v '1\.2' > /dev/null`; then
-			AUTH_LIBS="$AUTH_LIBS `krb5-config --libs gssapi`"
-			AUTH_CFLAGS="$AUTH_CFLAGS `krb5-config --cflags gssapi`"
+			KRB5_LIBS=`krb5-config --libs gssapi`
+			KRB5_CFLAGS=`krb5-config --cflags gssapi`
+			AC_SUBST(KRB5_LIBS)
+			AC_SUBST(KRB5_CFLAGS)
 			
 			# Although krb5-config exists, all systems still don't
 			# have gssapi.h
@@ -1579,12 +1585,21 @@
 				AC_CHECK_LIB(gss, __gss_userok, [
 					AC_DEFINE(HAVE___GSS_USEROK,,
 						Define if you have __gss_userok())
-				],, `krb5-config --libs gssapi`)
+				],, $KRB5_LIBS)
 			fi
 			CFLAGS=$old_CFLAGS
+
+			if test x$want_gssapi_plugin != xyes; then
+			  AUTH_LIBS="$AUTH_LIBS $KRB5_LIBS"
+			  AUTH_CFLAGS="$AUTH_CFLAGS `krb5-config --cflags gssapi`"
+		          AC_DEFINE(BUILTIN_GSSAPI,, GSSAPI support is built in)
+			else
+			  have_gssapi_plugin=yes
+			fi
 		fi
 	fi
 fi
+AM_CONDITIONAL(GSSAPI_PLUGIN, test "$have_gssapi_plugin" = "yes")
 
 if test $want_sia = yes; then
 	AC_CHECK_FUNC(sia_validate_user, [
--- a/src/auth/Makefile.am	Tue Aug 07 00:51:16 2007 +0300
+++ b/src/auth/Makefile.am	Tue Aug 07 01:00:12 2007 +0300
@@ -1,11 +1,16 @@
 noinst_LIBRARIES = libpassword.a
 auth_moduledir = $(moduledir)/auth
 
+if GSSAPI_PLUGIN
+GSSAPI_LIB = libmech_gssapi.la
+endif
+
 if LDAP_PLUGIN
 LDAP_LIB = libauthdb_ldap.la
 endif
 
 auth_module_LTLIBRARIES = \
+	$(GSSAPI_LIB) \
 	$(LDAP_LIB)
 
 pkglibexecdir = $(libexecdir)/dovecot
@@ -48,6 +53,10 @@
 builtin_ldap_sources = $(ldap_sources)
 endif
 
+if ! GSSAPI_PLUGIN
+builtin_gssapi_sources = mech-gssapi.c
+endif
+
 dovecot_auth_SOURCES = \
 	auth.c \
 	auth-cache.c \
@@ -71,7 +80,6 @@
 	mech-ntlm.c \
 	mech-otp.c \
 	mech-skey.c \
-	mech-gssapi.c \
 	mech-rpa.c \
 	mech-apop.c \
 	mech-winbind.c \
@@ -98,6 +106,7 @@
 	userdb-static.c \
 	userdb-vpopmail.c \
 	userdb-sql.c \
+	$(builtin_gssapi_sources) \
 	$(builtin_ldap_sources)
 
 headers = \
@@ -129,6 +138,13 @@
 	userdb-blocking.h \
 	userdb-vpopmail.h
 
+if GSSAPI_PLUGIN
+libmech_gssapi_la_LDFLAGS = -module -avoid-version
+libmech_gssapi_la_LIBADD = $(KRB5_LIBS)
+libmech_gssapi_la_CPPFLAGS = $(AM_CPPFLAGS) $(KRB5_CFLAGS)
+libmech_gssapi_la_SOURCES = mech-gssapi.c
+endif
+
 if LDAP_PLUGIN
 libauthdb_ldap_la_LDFLAGS = -module -avoid-version
 libauthdb_ldap_la_LIBADD = $(LDAP_LIBS)
--- a/src/auth/mech-gssapi.c	Tue Aug 07 00:51:16 2007 +0300
+++ b/src/auth/mech-gssapi.c	Tue Aug 07 01:00:12 2007 +0300
@@ -448,4 +448,19 @@
 	mech_gssapi_auth_free
 };
 
+#ifndef BUILTIN_GSSAPI
+void mech_gssapi_init(void);
+void mech_gssapi_deinit(void);
+
+void mech_gssapi_init(void)
+{
+	mech_register_module(&mech_gssapi);
+}
+
+void mech_gssapi_deinit(void)
+{
+	mech_unregister_module(&mech_gssapi);
+}
 #endif
+
+#endif
--- a/src/auth/mech.c	Tue Aug 07 00:51:16 2007 +0300
+++ b/src/auth/mech.c	Tue Aug 07 01:00:12 2007 +0300
@@ -94,7 +94,7 @@
 	mech_register_module(&mech_skey);
 	mech_register_module(&mech_rpa);
 	mech_register_module(&mech_anonymous);
-#ifdef HAVE_GSSAPI
+#ifdef BUILTIN_GSSAPI
 	mech_register_module(&mech_gssapi);
 #endif
 }
@@ -115,7 +115,7 @@
 	mech_unregister_module(&mech_skey);
 	mech_unregister_module(&mech_rpa);
 	mech_unregister_module(&mech_anonymous);
-#ifdef HAVE_GSSAPI
+#ifdef BUILTIN_GSSAPI
 	mech_unregister_module(&mech_gssapi);
 #endif
 }