summaryrefslogtreecommitdiff
path: root/alpine
diff options
context:
space:
mode:
Diffstat (limited to 'alpine')
-rw-r--r--alpine/imap.c34
-rw-r--r--alpine/xoauth2.h3
-rw-r--r--alpine/xoauth2info.c8
3 files changed, 20 insertions, 25 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index f078f779..0b1ca312 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -865,10 +865,9 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
if(registered){
x = oauth2_get_client_info(oa2list->name, user);
if(!x) return; /* user cancelled, let's get out of here */
- if(x){
- int error = 0, authorize = 0, device = 0;
- if(x->flow){
- for(oa2list = alpine_oauth2_list;
+ if(x->flow){
+ int authorize = 0, device = 0;
+ for(oa2list = alpine_oauth2_list;
oa2list && oa2list->host != NULL && oa2list->host[0] != NULL;
oa2list++){
for(i = 0; i < OAUTH2_TOT_EQUIV
@@ -881,29 +880,22 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
device += oa2list->server_mthd[1].name ? 1 : 0;
if(flow && !strucmp(x->flow, flow)) break; /* found it */
}
- }
- if(!oa2list || !oa2list->host || !oa2list->host[0])
- error++;
- }
- else error++;
- if(error){
- if(x->flow){
- snprintf(tmp_20k_buf, SIZEOF_20KBUF, _("%s does not support or recognize flow type \"%s\". Use %s%s%s"),
+ }
+ if(!oa2list || !oa2list->host || !oa2list->host[0]){
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF,
+ _("%s does not support or recognize flow type \"%s\". Use %s%s%s"),
mb->orighost,
x->flow,
authorize ? "\"Authorize\"" : "",
authorize ? (device ? " or " : "") : "",
device ? "\"Device\"" : "");
- tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
- q_status_message(SM_ORDER | SM_DING, 3, 5, tmp_20k_buf);
- }
- else
- q_status_message(SM_ORDER | SM_DING, 3, 3, _("Configuration does not specify flow type. Use \"Authorize\" or \"Device\""));
- }
- free_xoauth2_info(&x);
- if(error) return;
+ tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
+ q_status_message(SM_ORDER | SM_DING, 3, 5, tmp_20k_buf);
+ free_xoauth2_info(&x);
+ return;
+ }
}
- /* else use the one we found earlier, the user has to configure this better */
+ free_xoauth2_info(&x);
}
if(registered){
diff --git a/alpine/xoauth2.h b/alpine/xoauth2.h
index 6e69c652..5a7a3050 100644
--- a/alpine/xoauth2.h
+++ b/alpine/xoauth2.h
@@ -15,6 +15,9 @@
#ifndef ALPINE_XOAUTH2_INCLUDED
#define ALPINE_XOAUTH2_INCLUDED
+#define AUTHORIZE_FLOW "Authorize"
+#define DEVICE_FLOW "Device"
+
#define GMAIL_NAME (unsigned char *) "Gmail"
#define GMAIL_ID "624395471329-0qee3goofj7kbl7hsukou3rqq0igntv1.apps.googleusercontent.com"
#define GMAIL_SECRET "vwnqVJQrJZpR6JilCfAN5nY7"
diff --git a/alpine/xoauth2info.c b/alpine/xoauth2info.c
index c6cfa4e1..c46e2696 100644
--- a/alpine/xoauth2info.c
+++ b/alpine/xoauth2info.c
@@ -14,10 +14,10 @@
#include "../alpine/xoauth2.h"
XOAUTH2_INFO_S xoauth_default[] = {
- { GMAIL_NAME, GMAIL_ID, GMAIL_SECRET, GMAIL_TENANT, NULL, NULL},
- { OUTLOOK_NAME, OUTLOOK_ID, OUTLOOK_SECRET, OUTLOOK_TENANT, NULL, NULL},
- { YAHOO_NAME, YAHOO_ID, YAHOO_SECRET, YAHOO_TENANT, NULL, NULL},
- { YANDEX_NAME, YANDEX_ID, YANDEX_SECRET, YANDEX_TENANT, NULL, NULL},
+ { GMAIL_NAME, GMAIL_ID, GMAIL_SECRET, GMAIL_TENANT, NULL, AUTHORIZE_FLOW},
+ { OUTLOOK_NAME, OUTLOOK_ID, OUTLOOK_SECRET, OUTLOOK_TENANT, NULL, DEVICE_FLOW},
+ { YAHOO_NAME, YAHOO_ID, YAHOO_SECRET, YAHOO_TENANT, NULL, AUTHORIZE_FLOW},
+ { YANDEX_NAME, YANDEX_ID, YANDEX_SECRET, YANDEX_TENANT, NULL, AUTHORIZE_FLOW},
{ NULL, NULL, NULL, NULL, NULL, NULL}
};