From 78ebe5ef4a47e4fe03e7b52afef0fb66e0de2378 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 9 May 2020 15:01:59 -0600 Subject: * Several improvements to Alpine's support of XOAUTH2. In the case of Gmail, a text explaining the basic steps on how to configure fully Alpine with Gmail was added. In addition, some issues introduced while included OAUTHBEARER were also fixed. --- alpine/imap.c | 21 +++++++-- doc/tech-notes/tech-notes.txt | 102 ------------------------------------------ imap/src/c-client/auth_bea.c | 7 ++- imap/src/c-client/auth_oa2.c | 9 +++- pith/pine.hlp | 2 +- 5 files changed, 32 insertions(+), 109 deletions(-) diff --git a/alpine/imap.c b/alpine/imap.c index 6c14bc4d..638121e1 100644 --- a/alpine/imap.c +++ b/alpine/imap.c @@ -217,14 +217,29 @@ oauth2_get_access_code(char *url, char *method, OAUTH2_S *oauth2, int *tryanothe goto try_wantto; so_puts(in_store, "

"); - sprintf(tmp, _("

Auhtorizing Alpine Access to %s Email Services
"), oauth2->name); + sprintf(tmp, _("
Authorizing Alpine Access to %s Email Services
"), oauth2->name); so_puts(in_store, tmp); sprintf(tmp, _("

Alpine is attempting to log you into your %s account, using the %s method."), oauth2->name, method), so_puts(in_store, tmp); - so_puts(in_store, _(" In order to do that, Alpine needs to open the following URL:")); + if(strucmp(oauth2->name, "Gmail") == 0){ + so_puts(in_store, _(" If this is your first time setting up this type of authentication and you have a G-Suite account, please follow the steps below. ")); + so_puts(in_store, _("

First you must register Alpine with Google and create a client-id and client-secret. The steps below explain how to do this. If you already did that, then you can skip to the second part to continue with the setup process.")); + so_puts(in_store, _("

")); + so_puts(in_store, _("

As a result of this process, you will get a client-id and a client-secret.")); + so_puts(in_store, _(" Exit this screen, and from Alpine's Main Screen press S U to save these values permanently.")); + so_puts(in_store, _(" Then retry login into Gmail's server, skip these steps, and continue with the steps below.")); + so_puts(in_store, _("

Cancelling this process will lead to an error in authentication that can be ignored.")); + } + + so_puts(in_store, _("

In order to authrorize Alpine to access your email, Alpine needs to open the following URL:")); so_puts(in_store,"

"); - sprintf(tmp_20k_buf, _("%s."), url, url); + sprintf(tmp_20k_buf, _("%s"), url, url); so_puts(in_store, tmp_20k_buf); so_puts(in_store, _("

Alpine will try to use your URL Viewers setting to find a browser to open this URL.")); diff --git a/doc/tech-notes/tech-notes.txt b/doc/tech-notes/tech-notes.txt index 890c3910..d5a5d015 100644 --- a/doc/tech-notes/tech-notes.txt +++ b/doc/tech-notes/tech-notes.txt @@ -1,106 +1,4 @@ - Alpine Technical Notes - - Version 2.22, January 2020 - -Table of Contents - - Introduction - - * Design Goals - * Alpine Components - - Background Details - - * Domain Names - * RFC 2822 Compliance - * SMTP and Sendmail - * Internet Message Access Protocol (IMAP) - * Multipurpose Internet Mail Extensions (MIME) - * Folder Collections - - Building and Installation - - * Compile-time Options - * Including LDAP Functionality - * Including Kerberos 5 Functionality - * Other Alpine Compile-time Options - * IMAPd Compile-time Options - * Building the Alpine Programs - * Installing Alpine and Pico on UNIX Platforms - * Installing PC-Alpine - * Installing IMAPd - * Support Files and Environment Variables: UNIX Alpine - * Support Files, Environment Variables, and Registry Values: - PC-Alpine - - Command Line Arguments - - * Alpine - * Pico - * Pilot - - Configuration and Preferences - - * Alpine Configuration - * General Configuration Variables - * Configuration Features - * Hidden Config Variables and Features - * Retired Variables - * Tokens for Index and Replying - * Conditional Inclusion of Text for Reply-Leadin, Signatures, and - Templates - * Per Server Directory Configuration - * Color Configuration - * Index Line Color Configuration - * Role Configuration - * Filtering Configuration - * Scoring Configuration - * Other Rules Configuration - * Search Rules Configuration - * Patterns - * Configuring News - Configuration Notes - + Alpine in Function Key Mode - + Domain Settings - + Syntax for Collections - + Syntax for Folder Names - + Server Name Syntax - + Folder Namespaces - + What is a Mail Drop? - + Sorting a Folder - + Alternate Editor - + Signatures and Signature Placement - + Feature List Variable - + Configuration Inheritance - + Using Environment Variables - + SMTP Servers - + MIME.Types file - + Color Details - + S/MIME Overview - + Additional Notes on PC-Alpine - - Behind the Scenes - - * Address Books - * Remote Configuration - * Checkpointing - * Debug Files - * INBOX and Special Folders - * Internal Help Files - * International Character Sets - * Interrupted and Postponed Messages - * Message Status - * MIME: Reading a Message - * MIME: Sending a Message - * New Mail Notification - * NFS - * Printers and Printing - * Save and Export - * Sent Mail - * Spell Checker - * Terminal Emulation and Key Mapping - Introduction Design Goals diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index b9bf61e1..2273b413 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -139,6 +139,11 @@ long auth_oauthbearer_client (authchallenge_t challenger,authrespond_t responder /* empty challenge or user requested abort or client does not have info */ if(!oauth2.access_token) { + if (base){ + (*responder) (stream,base,"",strlen(base)); + if ((challenge = (*challenger) (stream,&clen)) != NULL) + fs_give ((void **) &challenge); + } (*responder) (stream,NIL,NIL,0); *trial = 0; /* cancel subsequent attempts */ ret = LONGT; /* will get a BAD response back */ @@ -297,7 +302,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, (oauth2getaccesscode_t) mail_parameters (NIL, GET_OA2CLIENTGETACCESSCODE, NIL); if(ogac) - oauth2->param[OA2_Code].value = (*ogac)(url, BEARERNAME, oauth2, tryanother); + oauth2->param[OA2_Code].value = (*ogac)(url, method, oauth2, tryanother); } if(oauth2->param[OA2_Code].value){ diff --git a/imap/src/c-client/auth_oa2.c b/imap/src/c-client/auth_oa2.c index 4c4a5898..76a529eb 100644 --- a/imap/src/c-client/auth_oa2.c +++ b/imap/src/c-client/auth_oa2.c @@ -170,6 +170,11 @@ long auth_oauth2_client (authchallenge_t challenger,authrespond_t responder, cha /* empty challenge or user requested abort or client does not have info */ if(!oauth2.access_token) { + if (base){ + (*responder) (stream,base,"",strlen(base)); + if ((challenge = (*challenger) (stream,&clen)) != NULL) + fs_give ((void **) &challenge); + } (*responder) (stream,NIL,NIL,0); *trial = 0; /* cancel subsequent attempts */ ret = LONGT; /* will get a BAD response back */ @@ -241,7 +246,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, oauth2clientinfo_t ogci = (oauth2clientinfo_t) mail_parameters (NIL, GET_OA2CLIENTINFO, NIL); - if(ogci) (*ogci)(oauth2->name, method, &oauth2->param[OA2_Id].value, + if(ogci) (*ogci)(oauth2->name, &oauth2->param[OA2_Id].value, &oauth2->param[OA2_Secret].value); } @@ -315,7 +320,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, (oauth2getaccesscode_t) mail_parameters (NIL, GET_OA2CLIENTGETACCESSCODE, NIL); if(ogac) - oauth2->param[OA2_Code].value = (*ogac)(url, oauth2, tryanother); + oauth2->param[OA2_Code].value = (*ogac)(url, method, oauth2, tryanother); } if(oauth2->param[OA2_Code].value){ diff --git a/pith/pine.hlp b/pith/pine.hlp index e2717455..21fe5dc3 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 419 2020-04-12 14:29:36 +Alpine Commit 422 2020-05-09 15:01:02 ============= h_news ================= -- cgit v1.2.3-70-g09d2