From 6c702a26f10f04bf225aa914b2eae5b89e3d0b4a Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 21 May 2020 21:53:30 -0600 Subject: * Update to some http_* functions to return status code returned by server. --- imap/src/c-client/auth_oa2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'imap/src/c-client/auth_oa2.c') diff --git a/imap/src/c-client/auth_oa2.c b/imap/src/c-client/auth_oa2.c index b003a653..6de4395e 100644 --- a/imap/src/c-client/auth_oa2.c +++ b/imap/src/c-client/auth_oa2.c @@ -236,6 +236,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, OAUTH2_SERVER_METHOD_S RefreshMethod; char *s = NULL; JSON_S *json = NULL; + int status = 0; if(oauth2->param[OA2_Id].value == NULL || oauth2->param[OA2_Secret].value == NULL){ oauth2clientinfo_t ogci = @@ -260,9 +261,12 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, params[i].name = params[i].value = NULL; if(strcmp(RefreshMethod.name, "POST") == 0) - s = http_post_param(RefreshMethod.urlserver, params); + s = http_post_param(RefreshMethod.urlserver, params, &status); else if(strcmp(RefreshMethod.name, "POST2") == 0) - s = http_post_param2(RefreshMethod.urlserver, params); + s = http_post_param2(RefreshMethod.urlserver, params, &status); + + if(status != 200 && s) + fs_give((void **) &s); /* at this moment, ignore the error */ if(s){ unsigned char *u = s; @@ -318,9 +322,12 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, params[i].name = params[i].value = NULL; if(strcmp(RefreshMethod.name, "POST") == 0) - s = http_post_param(RefreshMethod.urlserver, params); + s = http_post_param(RefreshMethod.urlserver, params, &status); else if(strcmp(RefreshMethod.name, "POST2") == 0) - s = http_post_param2(RefreshMethod.urlserver, params); + s = http_post_param2(RefreshMethod.urlserver, paramsm &status); + + if(status != 200 && s) + fs_give((void **) &s); /* at this moment, ignore the error */ if(s){ unsigned char *u = s; -- cgit v1.2.3-54-g00ecf