From 5aeedb66cbeaa624be27821201ae3ebba56f39e1 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Fri, 15 Apr 2022 17:11:39 -0600 Subject: * 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. --- imap/src/c-client/oauth2_aux.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'imap/src') 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); -- cgit v1.2.3-70-g09d2