summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-07-28 21:16:54 -0600
committerEduardo Chappa <chappa@washington.edu>2021-07-28 21:16:54 -0600
commitc39814e31d89bd14111347aadca9f0e225b8f06d (patch)
tree1ed9d2c5e790d3ece97739f04e73dea4d38b1488
parent816e148694cd483aae8206b6187fed8b0ddb9b13 (diff)
downloadalpine-c39814e31d89bd14111347aadca9f0e225b8f06d.tar.xz
* Print error when trying to authenticate using XOAUTH2, when available.
-rw-r--r--.gitignore1
-rw-r--r--imap/src/c-client/oauth2_aux.c22
-rw-r--r--pith/pine.hlp2
3 files changed, 20 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 14cb1f39..1e6e3282 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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>