summaryrefslogtreecommitdiff
path: root/imap/src
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2022-04-15 17:11:39 -0600
committerEduardo Chappa <chappa@washington.edu>2022-04-15 17:11:39 -0600
commit5aeedb66cbeaa624be27821201ae3ebba56f39e1 (patch)
treecc7c5d3dfde9b2980a6d7c27b8059ee96a614800 /imap/src
parent59e384997c4a7775cce215f1275c526351f58fb0 (diff)
downloadalpine-5aeedb66cbeaa624be27821201ae3ebba56f39e1.tar.xz
* Treat HTTP_BAD code as an error when trying to authenticate using XOAUTH2
and cancel the refresh token (which will restart the authorization process) for the email account.
Diffstat (limited to 'imap/src')
-rw-r--r--imap/src/c-client/oauth2_aux.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c
index 3bb4b502..b396ccda 100644
--- a/imap/src/c-client/oauth2_aux.c
+++ b/imap/src/c-client/oauth2_aux.c
@@ -397,20 +397,19 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method,
break;
- case HTTP_BAD : break;
-
- default : { char tmp[200];
- char *err, *err_desc;
- jx = json_body_value(json, "error");
- err = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "Unknown error");
- jx = json_body_value(json, "error_description");
- err_desc = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "No description");
- sprintf(tmp, "Code %d: %.80s: %.80s", status, err, err_desc);
- mm_log (tmp, ERROR);
- if(err) fs_give((void **) &err);
- if(err_desc) fs_give((void **) &err_desc);
- oauth2->cancel_refresh_token++;
- }
+ case HTTP_BAD :
+ default : { char tmp[200];
+ char *err, *err_desc;
+ jx = json_body_value(json, "error");
+ err = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "Unknown error");
+ jx = json_body_value(json, "error_description");
+ err_desc = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "No description");
+ sprintf(tmp, "Code %d: %.80s: %.80s", status, err, err_desc);
+ mm_log (tmp, ERROR);
+ if(err) fs_give((void **) &err);
+ if(err_desc) fs_give((void **) &err_desc);
+ oauth2->cancel_refresh_token++;
+ }
}
json_free(&json);