diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | acconfig.h | 2 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | pop3.c | 53 |
4 files changed, 40 insertions, 34 deletions
@@ -16,6 +16,9 @@ Release Notes: ------------------------------------------------------------------------------ +fetchmail-4.4.0 () +* Corrected OTP support from Craig Metz. + fetchmail-4.3.6 (Fri Jan 23 00:25:57 EST 1998) * Improved RPM packaging with correct grouping and an icon. * Fixed another minor bug in handling of `expunge 0'. @@ -68,7 +68,7 @@ #undef RPA_ENABLE /* Define if you want OPIE support compiled in */ -#undef OPIE_ENABLE +#undef OPIE /* Leave that blank line there!! Autoheader needs it. diff --git a/configure.in b/configure.in index 677ef6f3..3a51afa1 100644 --- a/configure.in +++ b/configure.in @@ -182,19 +182,13 @@ AC_ARG_ENABLE(RPA, [with_RPA=no]) test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE) -### use option --enable-OPIE to compile in the OPIE support +### use option --enable-opie to compile in the OPIE support AC_ARG_ENABLE(opie, - [ --enable-OPIE support OTP through the OPIE library], - [with_opie=$enableval], + [ --enable-opie support OTP through the OPIE library], + [ AC_CHECK_HEADER(opie.h,, [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1]) + AC_CHECK_LIB(opie,opiegenerator,, [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1]) + AC_DEFINE(OPIE,1) ], [with_opie=no]) -if test "$with_opie" = "yes"; -then - AC_CHECK_HEADER(opie.h,, - [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1]) - AC_CHECK_LIB(opie,opiegenerator,, - [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1]) - AC_DEFINE(OPIE,1) -fi ### use option --with-gssapi=DIR to compile in GSSAPI support AC_ARG_WITH(gssapi, @@ -19,9 +19,9 @@ #include "fetchmail.h" #include "socket.h" -#if HAVE_LIBOPIE -#include <opie.h> -#endif /* HAVE_LIBOPIE */ +#if OPIE +#include <opie.h> +#endif /* OPIE */ #ifndef strstr /* glibc-2.1 declares this as a macro */ extern char *strstr(); /* needed on sysV68 R3V7.1. */ @@ -35,9 +35,9 @@ static int phase; #define PHASE_LOGOUT 4 static int last; -#if HAVE_LIBOPIE +#if OPIE static char lastok[POPBUFSIZE+1]; -#endif /* HAVE_LIBOPIE */ +#endif /* OPIE */ int pop3_ok (int sock, char *argbuf) /* parse command response */ @@ -62,9 +62,9 @@ int pop3_ok (int sock, char *argbuf) if (strcmp(buf,"+OK") == 0) { -#if HAVE_LIBOPIE +#if OPIE strcpy(lastok, bufp); -#endif /* HAVE_LIBOPIE */ +#endif /* OPIE */ ok = 0; } else if (strcmp(buf,"-ERR") == 0) @@ -104,9 +104,9 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) int ok; char *start,*end; char *msg; -#if HAVE_LIBOPIE +#if OPIE char *challenge; -#endif /* HAVE_LIBOPIE */ +#endif /* OPIE */ phase = PHASE_GETAUTH; @@ -146,22 +146,31 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) } #endif /* RPA_ENABLE */ -#if defined(HAVE_LIBOPIE) && defined(OPIE_ENABLE) +#if OPIE /* see RFC1938: A One-Time Password System */ - if (challenge = strstr(lastok, "otp-")) - { - char response[OPIE_RESPONSE_MAX+1]; - - if (opiegenerator(challenge, ctl->password, response)) - { - ok = PS_ERROR; - break; - } - - ok = gen_transact(sock, "PASS %s", response); + if (challenge = strstr(lastok, "otp-")) { + char response[OPIE_RESPONSE_MAX+1]; + int i; + + i = opiegenerator(challenge, !strcmp(ctl->password, "opie") ? "" : ctl->password, response); + if ((i == -2) && (cmd_daemon == -1)) { + char secret[OPIE_SECRET_MAX+1]; + fprintf(stderr, "Secret pass phrase: "); + if (opiereadpass(secret, sizeof(secret), 0)) { + i = opiegenerator(challenge, secret, response); + memset(secret, 0, sizeof(secret)); + }; + }; + + if (i) { + ok = PS_ERROR; break; + }; + + ok = gen_transact(sock, "PASS %s", response); + break; } -#endif /* defined(HAVE_LIBOPIE) && defined(OPIE_ENABLE) */ +#endif /* OPIE */ /* ordinary validation, no one-time password or RPA */ ok = gen_transact(sock, "PASS %s", ctl->password); |