From 74eb0be1e799d5485fae6e9c82fddc4d4b785df5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 22 Sep 1999 02:00:17 +0000 Subject: Added Todd Sabin's new protocol options. svn path=/trunk/; revision=2571 --- NEWS | 3 +++ fetchmail.c | 2 ++ fetchmail.h | 2 ++ fetchmail.man | 7 +++++++ imap.c | 19 ++++++++++++++----- options.c | 4 ++++ rcfile_l.l | 2 ++ 7 files changed, 34 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index e08ebe2f..6e4f8e23 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,9 @@ fetchmail-5.0.9 (): * Federico G. Schwindt's fix for NetBSD/OpenBSD --with-kerberos. * auth keyword and option changed to preauth. * Correct the exit value when .fetchmailrc permissions are wrong. +* getmail/gotmail scripts by Thomas Nesges added to contrib. +* Guenther H. Leber's fix for a ptential uid.c buffer overflow. +* Todd Sabin's option to force IMAP authentication type. There are 264 people on fetchmail-friends and 441 on fetchmail-announce. diff --git a/fetchmail.c b/fetchmail.c index 80a15563..ff465784 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -1335,6 +1335,8 @@ static int query_host(struct query *ctl) break; case P_IMAP: case P_IMAP_K4: + case P_IMAP_CRAM_MD5: + case P_IMAP_LOGIN: #ifdef GSSAPI case P_IMAP_GSS: #endif /* GSSAPI */ diff --git a/fetchmail.h b/fetchmail.h index c2b8b17e..20387750 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -15,6 +15,8 @@ #define P_APOP 7 #define P_RPOP 8 #define P_ETRN 9 +#define P_IMAP_CRAM_MD5 10 +#define P_IMAP_LOGIN 11 #if INET6 #define SMTP_PORT "smtp" diff --git a/fetchmail.man b/fetchmail.man index f6d2c24d..66708520 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -190,6 +190,13 @@ with RFC 1731 Kerberos v4 preauthentication. .IP IMAP-GSS IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities) with RFC 1731 GSSAPI preauthentication. +.IP IMAP-CRAMMD5 +IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities) +with RFC 2195 CRAM-MD5 authentication. +.IP IMAP-LOGIN +IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities) +with plain LOGIN authentication only, even if the server supports +better methods. .IP ETRN Use the ESMTP ETRN option. .RE diff --git a/imap.c b/imap.c index f947c870..24066fa1 100644 --- a/imap.c +++ b/imap.c @@ -960,13 +960,22 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) { if (outlevel >= O_DEBUG) report (stdout, _("CRAM-MD5 authentication is supported\n")); - if ((ok = do_cram_md5 (sock, ctl))) + if (ctl->server.protocol != P_IMAP_LOGIN) { - if (outlevel >= O_MONITOR) - report (stdout, "IMAP> *\n"); - SockWrite (sock, "*\r\n", 3); + if ((ok = do_cram_md5 (sock, ctl))) + { + if (outlevel >= O_MONITOR) + report (stdout, "IMAP> *\n"); + SockWrite (sock, "*\r\n", 3); + } + return ok; } - return ok; + } + else if (ctl->server.protocol == P_IMAP_CRAM_MD5) + { + report(stderr, + _("Required CRAM-MD5 capability not supported by server\n")); + return(PS_AUTHFAIL); } #ifdef NTLM_ENABLE diff --git a/options.c b/options.c index 63362997..3338323f 100644 --- a/options.c +++ b/options.c @@ -346,6 +346,10 @@ struct query *ctl; /* option record to be initialized */ else if (strcasecmp(optarg, "imap-gss") == 0) ctl->server.protocol = P_IMAP_GSS; #endif /* GSSAPI */ + else if (strcasecmp(optarg, "imap-crammd5") == 0) + ctl->server.protocol = P_IMAP_CRAM_MD5; + else if (strcasecmp(optarg, "imap-login") == 0) + ctl->server.protocol = P_IMAP_LOGIN; else if (strcasecmp(optarg,"etrn") == 0) ctl->server.protocol = P_ETRN; else { diff --git a/rcfile_l.l b/rcfile_l.l index 06bda950..5980a6ce 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -158,6 +158,8 @@ options {/* EMPTY */} (pop3)|(POP3) { yylval.proto = P_POP3; return PROTO; } (imap-k4)|(IMAP-K4) { yylval.proto = P_IMAP_K4; return PROTO; } (imap-gss)|(IMAP-GSS) { yylval.proto = P_IMAP_GSS; return PROTO; } +(imap-crammd5)|(IMAP-CRAMMD5) { yylval.proto = P_IMAP_CRAM_MD5; return PROTO; } +(imap-login)|(IMAP-LOGIN) { yylval.proto = P_IMAP_LOGIN; return PROTO; } (imap)|(IMAP) { yylval.proto = P_IMAP; return PROTO; } (apop)|(APOP) { yylval.proto = P_APOP; return PROTO; } (etrn)|(ETRN) { yylval.proto = P_ETRN; return PROTO; } -- cgit v1.2.3