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. --- imap/src/c-client/auth_bea.c | 7 ++++++- imap/src/c-client/auth_oa2.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'imap/src/c-client') 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){ -- cgit v1.2.3-54-g00ecf