From 649572ba29dfab09cb77a5c2f6f5d12e9822792c Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 1 Nov 2020 12:27:04 -0700 Subject: * Improvements to the cancel authentication logic to not to make it have a delay when cancelling authentication. --- imap/src/c-client/auth_bea.c | 2 +- imap/src/c-client/auth_oa2.c | 2 +- imap/src/c-client/imap4r1.c | 25 +++++++++++-------------- pith/pine.hlp | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index 64c3aa6c..d9f5e067 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -150,7 +150,7 @@ long auth_oauthbearer_client (authchallenge_t challenger,authrespond_t responder if(oauth2.param[OA2_Id].value) fs_give((void **) &oauth2.param[OA2_Id].value); if(oauth2.param[OA2_Secret].value) fs_give((void **) &oauth2.param[OA2_Secret].value); if(oauth2.param[OA2_Tenant].value) fs_give((void **) &oauth2.param[OA2_Tenant].value); - if (!ret || !oauth2.name) + if (!ret) *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 dac87960..b446b40f 100644 --- a/imap/src/c-client/auth_oa2.c +++ b/imap/src/c-client/auth_oa2.c @@ -169,7 +169,7 @@ long auth_oauth2_client (authchallenge_t challenger,authrespond_t responder, cha if(oauth2.param[OA2_Id].value) fs_give((void **) &oauth2.param[OA2_Id].value); if(oauth2.param[OA2_Secret].value) fs_give((void **) &oauth2.param[OA2_Secret].value); if(oauth2.param[OA2_Tenant].value) fs_give((void **) &oauth2.param[OA2_Tenant].value); - if (!ret || !oauth2.name) + if (!ret) *trial = 65535; /* don't retry if bad protocol */ return ret; } diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index 7343122c..344eadaf 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -1215,23 +1215,20 @@ long imap_auth (MAILSTREAM *stream,NETMBX *mb,char *tmp,char *usr) ok = (*at->client) (imap_challenge,imap_response,base,"imap",mb,stream, 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; - } + if(!base){ /* make sure have a response */ - if (!(reply = &LOCAL->reply)->tag) - reply = imap_fake (stream,tag, + if (!(reply = &LOCAL->reply)->tag) + reply = imap_fake (stream,tag, "[CLOSED] IMAP connection broken (authenticate)"); - else if (compare_cstring (reply->tag,tag)) - while (compare_cstring ((reply = imap_reply (stream,tag))->tag,tag)) - imap_soutr (stream,"*"); + else if (compare_cstring (reply->tag,tag)) + while (compare_cstring ((reply = imap_reply (stream,tag))->tag,tag)) + imap_soutr (stream,"*"); /* good if SASL ok and success response */ - if (ok && imap_OK (stream,reply)){ - if(stream->auth.name) fs_give((void **) &stream->auth.name); - stream->auth.name = cpystr(at->name); /* save method name */ - return T; + if (ok && imap_OK (stream,reply)){ + if(stream->auth.name) fs_give((void **) &stream->auth.name); + stream->auth.name = cpystr(at->name); /* save method name */ + return T; + } } if (!trial) { /* if main program requested cancellation */ mm_log ("IMAP Authentication cancelled",ERROR); diff --git a/pith/pine.hlp b/pith/pine.hlp index 054ba3e2..002b804b 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 513 2020-11-01 01:40:24 +Alpine Commit 514 2020-11-01 12:25:08 ============= h_news ================= -- cgit v1.2.3-70-g09d2