summaryrefslogtreecommitdiff
path: root/imap
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-05-13 02:16:34 -0600
committerEduardo Chappa <chappa@washington.edu>2020-05-13 02:16:34 -0600
commit00c4ef9e0d4bc4d1ea210e7a0d31494b4116bb4a (patch)
treea45ced362cdacee4559153b9d9bd68130ab9b7a7 /imap
parent1a2261b89b700ae5d73bb82a7b581d7d30012f90 (diff)
downloadalpine-00c4ef9e0d4bc4d1ea210e7a0d31494b4116bb4a.tar.xz
* Avoid error messages or tcp timeouts when cancelling imap authentication.
Diffstat (limited to 'imap')
-rw-r--r--imap/src/c-client/auth_bea.c12
-rw-r--r--imap/src/c-client/auth_oa2.c11
-rw-r--r--imap/src/c-client/auth_pla.c2
-rw-r--r--imap/src/c-client/imap4r1.c4
4 files changed, 12 insertions, 17 deletions
diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c
index 2273b413..1db020a4 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 a636bc4a..ea60f13f 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 befd7f8c..0725d90b 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 b2c685fb..43e5398b 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,