diff options
author | Eduardo Chappa <chappa@washington.edu> | 2020-05-21 21:53:30 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2020-05-21 21:53:30 -0600 |
commit | 6c702a26f10f04bf225aa914b2eae5b89e3d0b4a (patch) | |
tree | b0c138bc89422c07d26ec58b7aba36eb2698fda9 /imap/src/c-client/auth_bea.c | |
parent | b66dd2a29ac3c79d2e25ae513f367b9f20a352f3 (diff) | |
download | alpine-6c702a26f10f04bf225aa914b2eae5b89e3d0b4a.tar.xz |
* Update to some http_* functions to return status code returned by server.
Diffstat (limited to 'imap/src/c-client/auth_bea.c')
-rw-r--r-- | imap/src/c-client/auth_bea.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index 94305132..6b78fe64 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -219,6 +219,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, OAUTH2_SERVER_METHOD_S RefreshMethod; unsigned 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 = @@ -243,9 +244,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 reply text */ if(s){ unsigned char *u = s; @@ -301,9 +305,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; |