diff options
Diffstat (limited to 'imap/src/c-client/auth_oa2.c')
-rw-r--r-- | imap/src/c-client/auth_oa2.c | 15 |
1 files changed, 11 insertions, 4 deletions
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; |