summaryrefslogtreecommitdiff
path: root/imap/src/c-client/imap4r1.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-11-01 16:21:25 -0700
committerEduardo Chappa <chappa@washington.edu>2020-11-01 16:21:25 -0700
commitfc5a3d34bb2dd42de653e2a2ad761d229aba8954 (patch)
treefa34d2f9b3cbd6a50947da6ecc8683367e6d492c /imap/src/c-client/imap4r1.c
parent649572ba29dfab09cb77a5c2f6f5d12e9822792c (diff)
downloadalpine-fc5a3d34bb2dd42de653e2a2ad761d229aba8954.tar.xz
* The previous commit does not allow clients to login using xoauth2, so
this commit fixes that.
Diffstat (limited to 'imap/src/c-client/imap4r1.c')
-rw-r--r--imap/src/c-client/imap4r1.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c
index 344eadaf..6970396a 100644
--- a/imap/src/c-client/imap4r1.c
+++ b/imap/src/c-client/imap4r1.c
@@ -1215,20 +1215,23 @@ 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){
+
+ if(base && !trial){ /* do it now, instead of later */
+ mm_log ("IMAP Authentication cancelled",ERROR);
+ return NIL;
+ }
/* make sure have a response */
- if (!(reply = &LOCAL->reply)->tag)
+ if (!(reply = &LOCAL->reply)->tag)
reply = imap_fake (stream,tag,
"[CLOSED] IMAP connection broken (authenticate)");
- else if (compare_cstring (reply->tag,tag))
+ 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);