summaryrefslogtreecommitdiff
path: root/imap/src/c-client/auth_oa2.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-05-21 21:53:30 -0600
committerEduardo Chappa <chappa@washington.edu>2020-05-21 21:53:30 -0600
commit6c702a26f10f04bf225aa914b2eae5b89e3d0b4a (patch)
treeb0c138bc89422c07d26ec58b7aba36eb2698fda9 /imap/src/c-client/auth_oa2.c
parentb66dd2a29ac3c79d2e25ae513f367b9f20a352f3 (diff)
downloadalpine-6c702a26f10f04bf225aa914b2eae5b89e3d0b4a.tar.xz
* Update to some http_* functions to return status code returned by server.
Diffstat (limited to 'imap/src/c-client/auth_oa2.c')
-rw-r--r--imap/src/c-client/auth_oa2.c15
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;