diff options
Diffstat (limited to 'imap/src/c-client/imap4r1.c')
-rw-r--r-- | imap/src/c-client/imap4r1.c | 19 |
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); |