From 40e5221e67e620c84350331aa4f273bcd88d25de Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Fri, 26 Jun 2020 12:30:31 -0600 Subject: * When Alpine starts a PREAUTH connection, it might still ask the user to login. Reported by Frank Tobin. --- imap/src/c-client/imap4r1.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'imap/src') diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index 4991f85e..db3f1190 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -800,7 +800,7 @@ long imap_status (MAILSTREAM *stream,char *mbx,long flags) MAILSTREAM *imap_open (MAILSTREAM *stream) { - unsigned long i,j; + unsigned long i,j, preauthed; char *s,tmp[MAILTMPLEN],usr[MAILTMPLEN]; NETMBX mb; IMAPPARSEDREPLY *reply = NIL; @@ -891,8 +891,9 @@ MAILSTREAM *imap_open (MAILSTREAM *stream) return NIL; /* lost during greeting */ } + preauthed = !strcmp (reply->key,"PREAUTH"); /* STARTTLS is not allowed in PREAUTH state */ - if (LOCAL->netstream && !strcmp (reply->key,"PREAUTH")){ + if (LOCAL->netstream && preauthed){ sslstart_t stls = (sslstart_t) mail_parameters (NIL,GET_SSLSTART,NIL); if (!LOCAL->gotcapability) imap_capability (stream); if (LOCAL->netstream @@ -902,7 +903,7 @@ MAILSTREAM *imap_open (MAILSTREAM *stream) } } /* if connected and not preauthenticated */ - if (LOCAL->netstream && strcmp (reply->key,"PREAUTH")) { + if (LOCAL->netstream && !preauthed) { sslstart_t stls = (sslstart_t) mail_parameters (NIL,GET_SSLSTART,NIL); /* get server capabilities */ if (!LOCAL->gotcapability) imap_capability (stream); -- cgit v1.2.3-70-g09d2