From 88de3aa407f15cb333caf267e50453ef4338d1fb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 8 Apr 2000 06:34:15 +0000 Subject: Preauth fix. svn path=/trunk/; revision=2864 --- NEWS | 1 + imap.c | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index c5c78d30..894d6ecf 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ * Added contrib/toprocmail, which demonstrates how a plugin can displaty selected mail headers. * French internationalization update from Guy Brand. +* IMAP PREAUTH fix from Todd Sabin . fetchmail-5.3.5 (Wed Mar 29 18:17:19 EST 2000), 18840 lines: diff --git a/imap.c b/imap.c index 3e534cf3..66010957 100644 --- a/imap.c +++ b/imap.c @@ -130,14 +130,7 @@ int imap_ok(int sock, char *argbuf) while (isspace(*cp)) cp++; - if (strncmp(cp, "PREAUTH", 2) == 0) - { - if (argbuf) - strcpy(argbuf, cp); - preauth = TRUE; - return(PS_SUCCESS); - } - else if (strncmp(cp, "OK", 2) == 0) + if (strncmp(cp, "OK", 2) == 0) { if (argbuf) strcpy(argbuf, cp); @@ -860,7 +853,6 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) /* probe to see if we're running IMAP4 and can use RFC822.PEEK */ capabilities[0] = '\0'; - preauth = FALSE; if ((ok = gen_transact(sock, "CAPABILITY")) == PS_SUCCESS) { /* UW-IMAP server 10.173 notifies in all caps */ @@ -898,11 +890,14 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) expunge_period = 1; /* - * If either (a) we saw a PREAUTH token in the capability response, or + * If either (a) we saw a PREAUTH token in the greeting, or * (b) the user specified ssh preauthentication, then we're done. */ if (preauth || ctl->server.preauthenticate == A_SSH) - return(PS_SUCCESS); + { + preauth = FALSE; /* reset for the next session */ + return(PS_SUCCESS); + } /* * Handle idling. We depend on coming through here on startup -- cgit v1.2.3