diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-07-28 21:16:54 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-07-28 21:16:54 -0600 |
commit | c39814e31d89bd14111347aadca9f0e225b8f06d (patch) | |
tree | 1ed9d2c5e790d3ece97739f04e73dea4d38b1488 | |
parent | 816e148694cd483aae8206b6187fed8b0ddb9b13 (diff) | |
download | alpine-c39814e31d89bd14111347aadca9f0e225b8f06d.tar.xz |
* Print error when trying to authenticate using XOAUTH2, when available.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | imap/src/c-client/oauth2_aux.c | 22 | ||||
-rw-r--r-- | pith/pine.hlp | 2 |
3 files changed, 20 insertions, 5 deletions
@@ -66,3 +66,4 @@ web/src/alpined.d/Makefile web/src/pubcookie/Makefile stamp-h1 POTFILES +regex/Makefile diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c index 0ecd0730..550f3b56 100644 --- a/imap/src/c-client/oauth2_aux.c +++ b/imap/src/c-client/oauth2_aux.c @@ -235,9 +235,16 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, oauth2->cancel_refresh_token = 0; /* do not cancel this token. It is good */ break; - default : { char tmp[100]; - sprintf(tmp, "Oauth2 client Received Code %d", status); + 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++; } break; @@ -302,9 +309,16 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, case HTTP_BAD : break; - default : { char tmp[100]; - sprintf(tmp, "Oauth2 Client Received Code %d", status); + 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++; } } diff --git a/pith/pine.hlp b/pith/pine.hlp index c3a0973d..928aa814 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 565 2021-06-10 20:14:46 +Alpine Commit 567 2021-07-28 21:16:49 ============= h_news ================= <HTML> <HEAD> |