From 7ca059d80aae996ff3031aca15241a55e255a0f5 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 8 Apr 2021 08:53:12 -0600 Subject: * Clear out some warnings given by gcc 10. --- alpine/arg.c | 2 +- alpine/imap.c | 109 ++++++++++++++++++++++++++---------------------- alpine/imap.h | 2 +- alpine/osdep/debuging.c | 2 + alpine/reply.c | 8 +--- alpine/smime.c | 5 +-- alpine/xoauth2.h | 8 ++-- alpine/xoauth2conf.c | 74 +++++++++++++++----------------- 8 files changed, 104 insertions(+), 106 deletions(-) (limited to 'alpine') diff --git a/alpine/arg.c b/alpine/arg.c index 72ab064a..a5e54d80 100644 --- a/alpine/arg.c +++ b/alpine/arg.c @@ -622,7 +622,7 @@ Loop: while(--ac > 0) if((str = *++av) != NULL){ if(x.name) fs_give((void **) &x.name); - x.name = cpystr(str); + x.name = (unsigned char *) cpystr(str); } } else{ diff --git a/alpine/imap.c b/alpine/imap.c index 6e6ea8cb..85c25029 100644 --- a/alpine/imap.c +++ b/alpine/imap.c @@ -1,7 +1,3 @@ -#if !defined(lint) && !defined(DOS) -static char rcsid[] = "$Id: imap.c 1266 2009-07-14 18:39:12Z hubert@u.washington.edu $"; -#endif - /* * ======================================================================== * Copyright 2013-2020 Eduardo Chappa @@ -145,8 +141,7 @@ extern XOAUTH2_INFO_S xoauth_default[]; * c-client for processing. Every c-client application must have its * own. */ -OAUTH2_S alpine_oauth2_list[] = -{ +OAUTH2_S alpine_oauth2_list[] = { {GMAIL_NAME, {"imap.gmail.com", "smtp.gmail.com", NULL, NULL}, {{"client_id", NULL}, @@ -162,12 +157,12 @@ OAUTH2_S alpine_oauth2_list[] = {"state", NULL}, {"device_code", NULL} /* not used */ }, - {{"GET", "https://accounts.google.com/o/oauth2/auth", /* authorization address, get access code */ + {{"GET", (unsigned char *) "https://accounts.google.com/o/oauth2/auth", /* authorization address, get access code */ {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_End, OA2_End, OA2_End}}, {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* Device Info information, not used */ - {"POST", "https://accounts.google.com/o/oauth2/token", /* Address to get refresh token from access code */ + {"POST", (unsigned char *) "https://accounts.google.com/o/oauth2/token", /* Address to get refresh token from access code */ {OA2_Id, OA2_Secret, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Code, OA2_End, OA2_End}}, - {"POST", "https://accounts.google.com/o/oauth2/token", /* access token from refresh token */ + {"POST", (unsigned char *) "https://accounts.google.com/o/oauth2/token", /* access token from refresh token */ {OA2_Id, OA2_Secret, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End}} }, {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */ @@ -196,11 +191,11 @@ OAUTH2_S alpine_oauth2_list[] = {"device_code", NULL} /* only used for frst time set up */ }, {{NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* Get Access Code, Not used */ - {"POST", "https://login.microsoftonline.com/\001/oauth2/v2.0/devicecode", /* first time use and get device code information */ + {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/devicecode", /* first time use and get device code information */ {OA2_Id, OA2_Scope, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, - {"POST", "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */ + {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */ {OA2_Id, OA2_Redirect, OA2_DeviceCode, OA2_End, OA2_End, OA2_End, OA2_End}}, - {"POST", "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */ + {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */ {OA2_Id, OA2_RefreshToken, OA2_Scope, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End}} }, {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */ @@ -228,12 +223,12 @@ OAUTH2_S alpine_oauth2_list[] = {"state", NULL}, /* not used */ {"device_code", NULL} /* not used */ }, - {{"GET", "https://login.microsoftonline.com/\001/oauth2/v2.0/authorize", /* Get Access Code */ + {{"GET", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/authorize", /* Get Access Code */ {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_End, OA2_End, OA2_End}}, {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */ - {"POST", "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */ + {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */ {OA2_Id, OA2_Redirect, OA2_Scope, OA2_GrantTypeforAccessToken, OA2_Secret, OA2_Code, OA2_End}}, - {"POST", "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */ + {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */ {OA2_Id, OA2_RefreshToken, OA2_Scope, OA2_GrantTypefromRefreshToken, OA2_Secret, OA2_End, OA2_End}} }, {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */ @@ -261,12 +256,12 @@ OAUTH2_S alpine_oauth2_list[] = {"state", NULL}, /* used */ {"device_code", NULL} /* not used */ }, - {{"GET", "https://api.login.yahoo.com/oauth2/request_auth", /* Get Access Code */ + {{"GET", (unsigned char *) "https://api.login.yahoo.com/oauth2/request_auth", /* Get Access Code */ {OA2_Id, OA2_Redirect, OA2_Response, OA2_State, OA2_End, OA2_End, OA2_End}}, {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */ - {"POST", "https://api.login.yahoo.com/oauth2/get_token", /* Get first Refresh Token and Access token */ + {"POST", (unsigned char *) "https://api.login.yahoo.com/oauth2/get_token", /* Get first Refresh Token and Access token */ {OA2_Id, OA2_Secret, OA2_Redirect, OA2_Code, OA2_GrantTypeforAccessToken, OA2_End, OA2_End}}, - {"POST", "https://api.login.yahoo.com/oauth2/get_token", /* Get access token from refresh token */ + {"POST", (unsigned char *) "https://api.login.yahoo.com/oauth2/get_token", /* Get access token from refresh token */ {OA2_Id, OA2_Secret, OA2_Redirect, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End}} }, {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */ @@ -294,12 +289,12 @@ OAUTH2_S alpine_oauth2_list[] = {"state", NULL}, /* not used */ {"device_code", NULL} /* not used */ }, - {{"GET", "https://oauth.yandex.com/authorize", /* Get Access Code */ + {{"GET", (unsigned char *) "https://oauth.yandex.com/authorize", /* Get Access Code */ {OA2_Id, OA2_Redirect, OA2_Response, OA2_End, OA2_End, OA2_End, OA2_End}}, {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */ - {"POST", "https://oauth.yandex.com/token", /* Get first Refresh Token and Access token */ + {"POST", (unsigned char *) "https://oauth.yandex.com/token", /* Get first Refresh Token and Access token */ {OA2_Id, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Secret, OA2_Code, OA2_End, OA2_End}}, - {"POST", "https://oauth.yandex.com/token", /* Get access token from refresh token */ + {"POST", (unsigned char *) "https://oauth.yandex.com/token", /* Get access token from refresh token */ {OA2_Id, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_Secret, OA2_End, OA2_End, OA2_End}} }, {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */ @@ -312,7 +307,36 @@ OAUTH2_S alpine_oauth2_list[] = 0, /* Cancel refresh token */ YANDEX_FLAGS /* default flags. For YANDEX this should be set to OA2_AUTHORIZE */ }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0}, + {NULL, /* Name, unsigned char * */ + {NULL, NULL, NULL, NULL }, /* host and equivalents */ + {{NULL, NULL}, /* client-id */ + {NULL, NULL}, /* client-secret */ + {NULL, NULL}, /* tenant - outlook */ + {NULL, NULL}, /* access_code, for authorize method */ + {NULL, NULL}, /* refresh token */ + {NULL, NULL}, /* scope */ + {NULL, NULL}, /* redirect */ + {NULL, NULL}, /* grant type for access token */ + {NULL, NULL}, /* grant type from refresh token */ + {NULL, NULL}, /* response */ + {NULL, NULL}, /* state */ + {NULL, NULL} /* device code */ + }, + {{NULL, NULL, {0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for authorize */ + {NULL, NULL, {0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for device login */ + {NULL, NULL, {0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for getting refresh token */ + {NULL, NULL, {0, 0, 0, 0, 0, 0, 0}} /* method, server, parameters for refreshing access token */ + }, + {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */ + NULL, /* access token */ + NULL, /* special IMAP ID */ + 0, /* Hide this */ + 0, /* expiration time */ + 0, /* first time */ + 0, /* require secret */ + 0, /* cancel refresh token */ + 0 /* flags */ + } }; int @@ -404,15 +428,15 @@ oauth2_select_flow(char *host) int sel, n = 0, j; for(oa2list = alpine_oauth2_list; oa2list && oa2list->name ;oa2list++) - n += strlen(oa2list->name); + 5; /* number, parenthesis, space */ - n += 1024; /* large enough to display to lines of 80 characters in UTF-8 */ + n += strlen((char *) oa2list->name) + 5; /* number, parenthesis, space */ + n += 1024; /* large enough to display lines of 80 characters in UTF-8 */ s = fs_get(n*sizeof(char)); strcpy(s, _("Please select below the authorization flow you would like to follow:")); sprintf(s + strlen(s), _("Please select the client-id to use from the following list.\n\n")); for(j = 1, oa2list = alpine_oauth2_list; oa2list && oa2list->name ;oa2list++){ for(i = 0; oa2list && oa2list->host && oa2list->host[i] && strucmp(oa2list->host[i], host); i++); - if(oa2list && oa2list->host && i < OAUTH2_TOT_EQUIV && oa2list->host[i]) - sprintf(s + strlen(s), " %d) %.70s\n", j++, oa2list->name); + if(oa2list && oa2list->host && i < OAUTH2_TOT_EQUIV && oa2list->host[i]) + sprintf(s + strlen(s), " %d) %.70s\n", j++, oa2list->name); } display_init_err(s, 0); @@ -472,8 +496,7 @@ void oauth2_set_device_info(OAUTH2_S *oa2, char *method) { char tmp[MAILTMPLEN]; - char *code; - char *name = oa2->name; + char *name = (char *) oa2->name; int aux_rv_value; OAUTH2_DEVICECODE_S *deviceinfo = &oa2->devicecode; OAUTH2_DEVICEPROC_S aux_value; @@ -508,7 +531,7 @@ oauth2_set_device_info(OAUTH2_S *oa2, char *method) } else{ so_puts(in_store, "

"); - so_puts(in_store, deviceinfo->message); + so_puts(in_store, (char *) deviceinfo->message); } so_puts(in_store, _("

Alpine will try to use your URL Viewers setting to find a browser to open this URL.")); sprintf(tmp, _(" When you open this link, you will be sent to %s's servers to complete this process."), name); @@ -569,9 +592,6 @@ oauth2_set_device_info(OAUTH2_S *oa2, char *method) oauth2_elapsed_done(NULL); } else{ - int flags, rc, q_line; - /* TRANSLATORS: user needs to input an access code from the server */ - char prompt[MAILTMPLEN], token[MAILTMPLEN]; /* * If screen hasn't been initialized yet, use want_to. */ @@ -630,8 +650,6 @@ try_wantto: if(want_to(tmp, 'n', 'x', NO_HELP, WT_NORM) == 'y'){ int rv; UCS ch; - q_line = -(ps_global->ttyo ? ps_global->ttyo->footer_rows : 3); - flags = OE_APPEND_CURRENT; snprintf(tmp_20k_buf+strlen(tmp_20k_buf), SIZEOF_20KBUF-strlen(tmp_20k_buf), "%s", _("After you are done going through the process described above, press \'y\' to continue, or \'n\' to cancel\n")); @@ -677,7 +695,7 @@ oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, int * sprintf(tmp, _("

Alpine is attempting to log you into your %s account, using the %s method."), oauth2->name, method), so_puts(in_store, tmp); - if(strucmp(oauth2->name, GMAIL_NAME) == 0){ + if(strucmp((char *) oauth2->name, (char *) GMAIL_NAME) == 0){ so_puts(in_store, _(" If this is your first time setting up this type of authentication, please follow the steps below. ")); so_puts(in_store, _("

First you must register Alpine with Google and create a client-id and client-secret. If you already did that, then you can skip to the authorization step, and continue with the process outlined below.")); so_puts(in_store, _("