From b5eb45a153202d72aeb48de1149e7c74aef979fd Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 8 May 2021 21:01:02 -0600 Subject: * Clear out some gcc warnings, and code improvement. Work in progress. --- imap/src/c-client/auth_bea.c | 7 +++++-- imap/src/c-client/auth_gss.c | 6 +++--- imap/src/c-client/auth_oa2.c | 7 +++++-- imap/src/c-client/oauth2_aux.c | 5 +++++ 4 files changed, 18 insertions(+), 7 deletions(-) (limited to 'imap') diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index 4b001ac7..e05a5007 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -99,9 +99,12 @@ long auth_oauthbearer_client (authchallenge_t challenger,authrespond_t responder && (oauth2.access_token || (!RefreshToken && oauth2.param[OA2_RefreshToken].value) || (RefreshToken && oauth2.param[OA2_RefreshToken].value - && strcmp(RefreshToken, oauth2.param[OA2_RefreshToken].value) - || oauth2.cancel_refresh_token))) + && strcmp(RefreshToken, oauth2.param[OA2_RefreshToken].value)) + || oauth2.cancel_refresh_token)) mm_login_method (mb, user, (void *) &oauth2, *trial, BEARERNAME); + + if(RefreshToken) + fs_give((void **) &RefreshToken); } /* empty challenge or user requested abort or client does not have info */ diff --git a/imap/src/c-client/auth_gss.c b/imap/src/c-client/auth_gss.c index 52cf6d9d..6a339745 100644 --- a/imap/src/c-client/auth_gss.c +++ b/imap/src/c-client/auth_gss.c @@ -401,14 +401,14 @@ char *auth_gssapi_server (authresponse_t responder,int argc,char *argv[]) else { /* can't acquire credentials! */ if (gss_display_name (&dsmn,crname,&buf,&mech) == GSS_S_COMPLETE) - SERVER_LOG ("Failed to acquire credentials for %s",buf.value); + SERVER_LOG ("Failed to acquire credentials for %s",(char *) buf.value); if (smj != GSS_S_FAILURE) do switch (dsmj = gss_display_status (&dsmn,smj,GSS_C_GSS_CODE, GSS_C_NO_OID,&mctx,&resp)) { case GSS_S_COMPLETE: mctx = 0; case GSS_S_CONTINUE_NEEDED: - SERVER_LOG ("Unknown GSSAPI failure: %s",resp.value); + SERVER_LOG ("Unknown GSSAPI failure: %s",(char *)resp.value); gss_release_buffer (&dsmn,&resp); } while (dsmj == GSS_S_CONTINUE_NEEDED); @@ -416,7 +416,7 @@ char *auth_gssapi_server (authresponse_t responder,int argc,char *argv[]) GSS_C_NO_OID,&mctx,&resp)) { case GSS_S_COMPLETE: case GSS_S_CONTINUE_NEEDED: - SERVER_LOG ("GSSAPI mechanism status: %s",resp.value); + SERVER_LOG ("GSSAPI mechanism status: %s",(char *)resp.value); gss_release_buffer (&dsmn,&resp); } while (dsmj == GSS_S_CONTINUE_NEEDED); diff --git a/imap/src/c-client/auth_oa2.c b/imap/src/c-client/auth_oa2.c index 47cd7260..7fb30542 100644 --- a/imap/src/c-client/auth_oa2.c +++ b/imap/src/c-client/auth_oa2.c @@ -127,9 +127,12 @@ long auth_oauth2_client (authchallenge_t challenger,authrespond_t responder, cha && (oauth2.access_token || (!RefreshToken && oauth2.param[OA2_RefreshToken].value) || (RefreshToken && oauth2.param[OA2_RefreshToken].value - && strcmp(RefreshToken, oauth2.param[OA2_RefreshToken].value) - || oauth2.cancel_refresh_token))) + && strcmp(RefreshToken, oauth2.param[OA2_RefreshToken].value)) + || oauth2.cancel_refresh_token)) mm_login_method (mb, user, (void *) &oauth2, *trial, OA2NAME); + + if(RefreshToken) + fs_give((void **) &RefreshToken); } /* empty challenge or user requested abort or client does not have info */ diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c index 3a584279..ad1c07de 100644 --- a/imap/src/c-client/oauth2_aux.c +++ b/imap/src/c-client/oauth2_aux.c @@ -178,6 +178,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, break; case JLong : oauth2->devicecode.expires_in = *(long *) jx->value; break; + default : break; } if((jx = json_body_value(json, "interval")) != NULL) @@ -186,6 +187,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, break; case JLong : oauth2->devicecode.interval = *(long *) jx->value; break; + default : break; } jx = json_body_value(json, "message"); @@ -224,6 +226,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, break; case JLong : oauth2->expiration = time(0) + *(long *) jx->value; break; + default : break; } oauth2->cancel_refresh_token = 0; /* do not cancel this token. It is good */ break; @@ -282,6 +285,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, break; case JLong : oauth2->expiration = time(0) + *(long *) jx->value; break; + default : break; } jx = json_body_value(json, "expires_in"); @@ -360,6 +364,7 @@ void oauth2deviceinfo_get_accesscode(void *inp, void *outp) break; case JLong : oauth2->expiration = time(0) + *(long *) jx->value; break; + default : break; } rv = OA2_CODE_SUCCESS; -- cgit v1.2.3-70-g09d2