From 00c4ef9e0d4bc4d1ea210e7a0d31494b4116bb4a Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Wed, 13 May 2020 02:16:34 -0600 Subject: * Avoid error messages or tcp timeouts when cancelling imap authentication. --- imap/src/c-client/auth_bea.c | 12 ++++-------- imap/src/c-client/auth_oa2.c | 11 +++-------- imap/src/c-client/auth_pla.c | 2 +- imap/src/c-client/imap4r1.c | 4 ++++ pith/pine.hlp | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index 2273b41..1db020a 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -138,13 +138,9 @@ long auth_oauthbearer_client (authchallenge_t challenger,authrespond_t responder } /* empty challenge or user requested abort or client does not have info */ - if(!oauth2.access_token) { - if (base){ - (*responder) (stream,base,"",strlen(base)); - if ((challenge = (*challenger) (stream,&clen)) != NULL) - fs_give ((void **) &challenge); - } - (*responder) (stream,NIL,NIL,0); + if(tryanother || !oauth2.access_token) { + if (!base) + (*responder) (stream,NIL,NIL,0); *trial = 0; /* cancel subsequent attempts */ ret = LONGT; /* will get a BAD response back */ } @@ -196,7 +192,7 @@ long auth_oauthbearer_client (authchallenge_t challenger,authrespond_t responder fs_give ((void **) &response); } } - if (!ret || !oauth2.name || tryanother) + if (!ret || !oauth2.name) *trial = 65535; /* don't retry if bad protocol */ return ret; } diff --git a/imap/src/c-client/auth_oa2.c b/imap/src/c-client/auth_oa2.c index a636bc4..ea60f13 100644 --- a/imap/src/c-client/auth_oa2.c +++ b/imap/src/c-client/auth_oa2.c @@ -169,13 +169,8 @@ long auth_oauth2_client (authchallenge_t challenger,authrespond_t responder, cha } /* empty challenge or user requested abort or client does not have info */ - if(!oauth2.access_token) { - if (base){ - (*responder) (stream,base,"",strlen(base)); - if ((challenge = (*challenger) (stream,&clen)) != NULL) - fs_give ((void **) &challenge); - } - (*responder) (stream,NIL,NIL,0); + if(tryanother || !oauth2.access_token) { + if (!base) (*responder) (stream,base,NIL,0); *trial = 0; /* cancel subsequent attempts */ ret = LONGT; /* will get a BAD response back */ } @@ -214,7 +209,7 @@ long auth_oauth2_client (authchallenge_t challenger,authrespond_t responder, cha fs_give ((void **) &response); } } - if (!ret || !oauth2.name || tryanother) + if (!ret || !oauth2.name) *trial = 65535; /* don't retry if bad protocol */ return ret; } diff --git a/imap/src/c-client/auth_pla.c b/imap/src/c-client/auth_pla.c index befd7f8..0725d90 100644 --- a/imap/src/c-client/auth_pla.c +++ b/imap/src/c-client/auth_pla.c @@ -75,7 +75,7 @@ long auth_plain_client (authchallenge_t challenger,authrespond_t responder,char #endif mm_login (mb,user, &pwd,*trial); if (!pwd) { /* empty challenge or user requested abort */ - (*responder) (stream,NIL,NIL,0); + if (!base) (*responder) (stream,base,NIL,0); *trial = 0; /* cancel subsequent attempts */ ret = LONGT; /* will get a BAD response back */ } diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index b2c685f..43e5398 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -1187,6 +1187,10 @@ long imap_auth (MAILSTREAM *stream,NETMBX *mb,char *tmp,char *usr) net_port(LOCAL->netstream),&trial,usr); LOCAL->sensitive = NIL; /* unhide */ + if(base && ok && !trial){ /* return now or see below for the same code */ + mm_log ("IMAP Authentication cancelled",ERROR); + return NIL; + } /* make sure have a response */ if (!(reply = &LOCAL->reply)->tag) reply = imap_fake (stream,tag, diff --git a/pith/pine.hlp b/pith/pine.hlp index 9af9db9..74c97c3 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 426 2020-05-13 00:30:15 +Alpine Commit 427 2020-05-13 02:16:31 ============= h_news ================= -- cgit v1.2.3-54-g00ecf