Index: configure.in =================================================================== RCS file: /home/cvs/debian/fetchmail/configure.in,v retrieving revision 1.1.1.11 retrieving revision 1.12 diff -u -r1.1.1.11 -r1.12 --- configure.in 2001/03/29 14:28:27 1.1.1.11 +++ configure.in 2001/04/11 19:26:59 1.12 @@ -15,11 +15,6 @@ VERSION=`sed -n '/VERSION *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in` AM_INIT_AUTOMAKE("$PACKAGE", "$VERSION") -dnl Map autoconf, autoheader and aclocal to missing.sh if they are -dnl not available in the system, so as not to cause problems in -dnl Makefile.in. Be sure to fix this hack if we start supporting -dnl automake (Makefile.am). - AC_CANONICAL_HOST AC_PROG_CC AC_PROG_INSTALL @@ -371,129 +366,6 @@ [with_netsec=no]) test "$with_netsec" = "yes" && AC_DEFINE(NET_SECURITY) -### use option --with-kerberos5=DIR to point at a Kerberos 5 directory -AC_ARG_WITH(kerberos5, - [ --with-kerberos5=DIR point fetchmail compilation at a Kerberos 5 directory], - with_kerberos5=$withval) - -# The "then" arm (nonempty $with_kerberos5) is kind of a crock. It works for -# configuring the BSD/OS Kerberos V support, though. -if test -n "$with_kerberos5" -a "$with_kerberos5" != "no" -then - # Path given - echo "Configuring kerberosV for `uname`" - AC_DEFINE(KERBEROS_V5) - CEFLAGS="$CEFLAGS -I$with_kerberos5/include" - LDEFLAGS="$LDEFLAGS -L$with_kerberos5/lib" - AC_CHECK_LIB(crypto, - krb5_des_string_to_key, - libk5crypto=-lcrypto, - AC_CHECK_LIB(k5crypto, - krb5_des_string_to_key, - libk5crypto=-lk5crypto, - AC_ERROR(Kerberos 5 libraries not found), - ${LDEFLAGS} -lcom_err), - ${LDEFLAGS} -lcom_err) - if test -f "$with_kerberos5/include/roken.h" - then - AC_DEFINE(HEIMDAL) - LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -lcom_err" - else - LIBS="$LIBS -lkrb5 ${libk5crypto} -lcom_err" - fi -elif test "$with_kerberos" != "no" -a "$with_kerberos5" != "no" ; then - for dir in /usr/kerberos /usr/local/krb5 /usr/athena - do - if test -f "$dir/include/krb5.h" - then - AC_DEFINE(KERBEROS_V5) - CEFLAGS="$CEFLAGS -I$dir/include" - LDEFLAGS="$LDEFLAGS -L$dir/lib" - if test -f "$dir/include/roken.h" - then - AC_DEFINE(HEIMDAL) - LIBS="$LIBS -lkrb5 -lasn1 -ldes -lcom_err" - else - AC_CHECK_LIB(crypto, - krb5_des_string_to_key, - libk5crypto=-lcrypto, - AC_CHECK_LIB(k5crypto, - krb5_des_string_to_key, - libk5crypto=-lk5crypto, - AC_ERROR(Kerberos 5 libraries not found), - ${LDEFLAGS} -lcom_err), - ${LDEFLAGS} -lcom_err) - LIBS="$LIBS -lkrb5 ${libk5crypto} -lcom_err" - fi - with_kerberos5=$dir - break - fi - done -fi - -### use option --with-kerberos=DIR to point at a Kerberos 4 directory -AC_ARG_WITH(kerberos, - [ --with-kerberos=DIR point fetchmail compilation at a Kerberos 4 directory]) - -# The "elif" arm (nonempty $with_kerberos) is kind of a crock. It works for -# configuring the BSD/OS Kerberos IV support, though. - -# Check for a NetBSD/OpenBSD special case -if test "$with_kerberos" = "yes" && test `uname` = "NetBSD" -o `uname` = "OpenBSD" -then - # Path given - echo "Configuring kerberosIV for `uname`" - AC_DEFINE(KERBEROS_V4) - CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV" - LIBS="$LIBS -lkrb -ldes" -elif test -n "$with_kerberos" -a -n "$with_kerberos5" -a "$with_kerberos" != "no" -a "$with_kerberos5" != "no" -then - AC_DEFINE(KERBEROS_V4) - CEFLAGS="$CEFLAGS -I$with_kerberos/include" - LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib" - if test -f "$with_kerberos5/roken.h" - then - AC_DEFINE(HEIMDAL) - LIBS="-lkrb4 -l45 $LIBS" - else - LIBS="-lkrb4 -ldes425 $LIBS" - fi -elif test -n "$with_kerberos5" -a "$with_kerberos" != "no" -a "$with_kerberos5" != "no" -then - for dir in /usr/kerberos /usr/kerberosIV /usr/athena - do - if test -f "$dir/include/kerberosIV/krb.h" - then - AC_DEFINE(KERBEROS_V4) - CEFLAGS="$CEFLAGS -I$dir/include" - LDEFLAGS="$LDEFLAGS -L$dir/lib" - LIBS="-lkrb4 -ldes425 $LIBS" - break - fi - done -elif test -n "$with_kerberos" -a "$with_kerberos" != "no" -then - AC_DEFINE(KERBEROS_V4) - CEFLAGS="$CEFLAGS -I$with_kerberos/include" - LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib" - LIBS="$LIBS -lkrb -ldes" -else - if test "$with_kerberos" != "no" - then - for dir in /usr/kerberos /usr/kerberosIV /usr/athena - do - if test -f "$dir/include/krb.h" - then - AC_DEFINE(KERBEROS_V4) - CEFLAGS="$CEFLAGS -I$dir/include" - LDEFLAGS="$LDEFLAGS -L$dir/lib" - LIBS="$LIBS -lkrb -ldes" - break - fi - done - fi -fi - ### use option --with-ssl to compile in the SSL support AC_ARG_WITH(ssl, [ --with-ssl=[DIR] enable SSL support using libraries in DIR], @@ -553,6 +425,131 @@ else echo 'Disabling SSL support...' fi + +### use option --with-kerberos5=DIR to point at a Kerberos 5 directory +### make sure --with-ssl is run before --with-kerberos* ! +AC_ARG_WITH(kerberos5, + [ --with-kerberos5=DIR point fetchmail compilation at a Kerberos 5 directory], +[ +if test "$with_kerberos5" != "no" +then + if test "$with_kerberos5" != "yes" ; then + searchdirs="$with_kerberos5" + else + searchdirs="/usr/kerberos /usr/local/krb5 /usr/athena /usr" + fi + with_kerberos5= + for dir in $searchdirs + do AC_MSG_CHECKING([for Kerberos V in $dir]) + if test -f "$dir/include/krb5.h" + then + ac_krblibs= + if test -f "$dir/include/roken.h" + then + ac_krblibs="-lasn1 -lroken -lcom_err" + AC_MSG_RESULT([Heimdal found]) + dnl Attempt to detect if we need to -ldb2 to link Heimdal + dnl we assume we do if it is available + AC_CHECK_LIB(db2, db_open, ac_krblibs="$ac_krblibs -ldb2", [], + ${LDEFLAGS}) + AC_CHECK_LIB(des, des_string_to_key, libk5crypto=-ldes, + AC_CHECK_LIB(ssl, MD5_Init, [], + AC_ERROR([DES libraries not found. Try adding --with-ssl to enable OpenSSL support]), + ${LDEFLAGS} ${ac_krblibs}), + ${LDEFLAGS} ${ac_krblibs}) + AC_DEFINE(HEIMDAL) + else + AC_MSG_RESULT([found]) + ac_krblibs="-lcom_err" + AC_CHECK_LIB(crypto, + krb5_des_string_to_key, + libk5crypto=-lcrypto, + AC_CHECK_LIB(k5crypto, + krb5_des_string_to_key, + libk5crypto=-lk5crypto, + AC_ERROR([Kerberos 5 DES libraries not found]), + ${LDEFLAGS} ${ac_krblibs}), + ${LDEFLAGS} ${ac_krblibs}) + fi + AC_CHECK_LIB(krb5, krb5_init_context,[], + continue, + ${LDEFLAGS} ${ac_krblibs}) + AC_DEFINE(KERBEROS_V5) + test "$dir" != "/usr" && CEFLAGS="$CEFLAGS -I$dir/include" + LDEFLAGS="$LDEFLAGS -L$dir/lib" + LIBS="$LIBS $ac_krblibs $libk5crypto" + with_kerberos5=$dir + break + else + AC_MSG_RESULT([not found]) + fi + done + if test -z "$with_kerberos5" ; then + AC_ERROR([Kerberos 5 libraries not found]) + fi +fi +]) dnl --with-kerberos5=DIR + +### use option --with-kerberos=DIR to point at a Kerberos 4 directory +AC_ARG_WITH(kerberos, + [ --with-kerberos=DIR point fetchmail compilation at a Kerberos 4 directory], +[ +if test "$with_kerberos" != "no" +then +# Check for a NetBSD/OpenBSD special case +if test "$with_kerberos" = "yes" && ( test `uname` = "NetBSD" || test `uname` = "OpenBSD" ) +then + AC_CHECKING([kerberosIV for `uname`]) + AC_DEFINE(KERBEROS_V4) + CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV" + LIBS="$LIBS -lkrb -ldes" +else + #we need to detect when we're building under a kerberosV compatibility + #layer, btw... + if test "$with_kerberos" != "yes" ; then + searchdirs="$with_kerberos" + else + searchdirs="$with_kerberos5 /usr/kerberos /usr/kerberosIV /usr/athena /usr" + fi + with_kerberos= + ac_saveLDFLAGS="$LDFLAGS" + for dir in $searchdirs + do + AC_MSG_CHECKING([for Kerberos IV in $dir]) + if test -f "$dir/include/krb.h" || test -f "$dir/include/krb4.h" \ + || test -f "$dir/include/kerberosIV/krb.h" + then + AC_MSG_RESULT([found]) + else + AC_MSG_RESULT([not found]) + continue + fi + #Find libs + if test -f "$with_kerberos5/roken.h" ; then + AC_CHECK_LIB(45, krb_mk_req) + fi + LDFLAGS="-L$dir/lib $ac_saveLDFLAGS" + AC_SEARCH_LIBS(des_string_to_key, [des425 des], [], continue) + AC_SEARCH_LIBS(krb_realmofhost, [krb4 krb], [], continue) + with_kerberos="$dir" + if test -f "$dir/include/kerberosIV/krb.h" ; then + dir="$dir/include/kerberosIV" + else + dir="$dir/include" + fi + AC_DEFINE(KERBEROS_V4) + test -f "$with_kerberos5/roken.h" && AC_DEFINE(HEIMDAL) + test "$dir" != "/usr/include" && CEFLAGS="$CEFLAGS -I$dir" + LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib" + break + done + if test -z "$with_kerberos" ; then + AC_ERROR([Kerberos 4 libraries not found]) + fi + LDFLAGS="$ac_saveLDFLAGS" +fi +fi +]) dnl --with-kerberos=DIR ### use option --with-socks=DIR to point at SOCKS library AC_ARG_WITH(socks, Index: driver.c =================================================================== RCS file: /home/cvs/debian/fetchmail/driver.c,v retrieving revision 1.1.1.8 retrieving revision 1.8 diff -u -r1.1.1.8 -r1.8 --- driver.c 2001/03/18 13:00:03 1.1.1.8 +++ driver.c 2001/04/11 05:38:56 1.8 @@ -40,33 +40,12 @@ #include "mx.h" #endif /* HAVE_RES_SEARCH */ +#include "kerberos.h" #ifdef KERBEROS_V4 -#ifdef KERBEROS_V5 -#include -#include -#else -#if defined (__bsdi__) -#include /* order of includes matters */ -#include -#define krb_get_err_text(e) (krb_err_txt[e]) -#else -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) -#define krb_get_err_text(e) (krb_err_txt[e]) -#include -#include -#else -#include -#include -#endif /* ! defined (__FreeBSD__) */ -#endif /* ! defined (__bsdi__) */ -#endif /* KERBEROS_V5 */ #include #include #endif /* KERBEROS_V4 */ -#ifdef KERBEROS_V5 -#include -#include -#endif /* KERBEROS_V5 */ + #include "i18n.h" #include "socket.h" Index: kerberos.c =================================================================== RCS file: /home/cvs/debian/fetchmail/kerberos.c,v retrieving revision 1.1.1.3 retrieving revision 1.5 diff -u -r1.1.1.3 -r1.5 --- kerberos.c 2001/02/22 22:41:14 1.1.1.3 +++ kerberos.c 2001/04/11 05:38:56 1.5 @@ -4,6 +4,9 @@ * For license terms, see the file COPYING in this directory. */ #include "config.h" + +#ifdef KERBEROS_V4 + #include #include #include @@ -12,28 +15,11 @@ #endif #include "fetchmail.h" #include "socket.h" +#include "kerberos.h" #include #include /* for htonl/ntohl */ -#ifdef KERBEROS_V4 - -# ifdef KERBEROS_V5 -# include -# include -# else -# if defined (__bsdi__) -# include -# define krb_get_err_text(e) (krb_err_txt[e]) -# endif -# if defined(__NetBSD__) || (__FreeBSD__) || defined(__linux__) -# define krb_get_err_text(e) (krb_err_txt[e]) -# endif -# include -# endif - -/* des.h might define _ for no good reason. */ -#undef _ #include "i18n.h" #if SIZEOF_INT == 4 Index: pop3.c =================================================================== RCS file: /home/cvs/debian/fetchmail/pop3.c,v retrieving revision 1.1.1.11 retrieving revision 1.10 diff -u -r1.1.1.11 -r1.10 --- pop3.c 2001/04/10 20:47:16 1.1.1.11 +++ pop3.c 2001/04/11 05:38:56 1.10 @@ -211,10 +211,10 @@ if (strstr(buffer, "GSSAPI")) has_gssapi = TRUE; #endif /* defined(GSSAPI) */ -#if defined(KERBEROS_V4) || defined(KERBEROS_V5) +#if defined(KERBEROS_V4) if (strstr(buffer, "KERBEROS_V4")) has_kerberos = TRUE; -#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ +#endif /* defined(KERBEROS_V4) */ #ifdef OPIE_ENABLE if (strstr(buffer, "X-OTP")) has_otp = TRUE; @@ -227,7 +227,7 @@ /* * OK, we have an authentication type now. */ -#if defined(KERBEROS_V4) || defined(KERBEROS_V5) +#if defined(KERBEROS_V4) /* * Servers doing KPOP have to go through a dummy login sequence * rather than doing SASL.