dovecot: Added --with-gssapi=plugin

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 7 01:02:20 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/c1d09af8bdda
changeset: 6199:c1d09af8bdda
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 07 01:00:12 2007 +0300
description:
Added --with-gssapi=plugin

diffstat:

4 files changed, 55 insertions(+), 9 deletions(-)
configure.in           |   25 ++++++++++++++++++++-----
src/auth/Makefile.am   |   18 +++++++++++++++++-
src/auth/mech-gssapi.c |   17 ++++++++++++++++-
src/auth/mech.c        |    4 ++--

diffs (162 lines):

diff -r 4f6c4aeafafb -r c1d09af8bdda configure.in
--- 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(bsdauth,
 
 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
-	else
+	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 @@ if test $want_gssapi = yes; then
 		# 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 @@ if test $want_gssapi = yes; then
 				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, [
diff -r 4f6c4aeafafb -r c1d09af8bdda src/auth/Makefile.am
--- 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
 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)
 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 @@ dovecot_auth_SOURCES = \
 	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 @@ dovecot_auth_SOURCES = \
 	userdb-static.c \
 	userdb-vpopmail.c \
 	userdb-sql.c \
+	$(builtin_gssapi_sources) \
 	$(builtin_ldap_sources)
 
 headers = \
@@ -129,6 +138,13 @@ headers = \
 	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)
diff -r 4f6c4aeafafb -r c1d09af8bdda src/auth/mech-gssapi.c
--- 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 @@ const struct mech_module mech_gssapi = {
 	mech_gssapi_auth_free
 };
 
-#endif
+#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
diff -r 4f6c4aeafafb -r c1d09af8bdda src/auth/mech.c
--- 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 @@ void mech_init(void)
 	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 @@ void mech_deinit(void)
 	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
 }


More information about the dovecot-cvs mailing list