summaryrefslogtreecommitdiff
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
parent1a2261b89b700ae5d73bb82a7b581d7d30012f90 (diff)
downloadalpine-00c4ef9e0d4bc4d1ea210e7a0d31494b4116bb4a.tar.xz
* Avoid error messages or tcp timeouts when cancelling imap authentication.
-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
-rw-r--r--pith/pine.hlp2
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 =================
<HTML>
<HEAD>