summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alpine/imap.c21
-rw-r--r--alpine/xoauth2.h4
-rw-r--r--imap/src/c-client/mail.h5
-rw-r--r--pith/pine.hlp4
4 files changed, 27 insertions, 7 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index 2e02ef6e..fa7b0d7c 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -175,7 +175,8 @@ OAUTH2_S alpine_oauth2_list[] =
0, /* expiration time */
0, /* first time indicator */
1, /* client secret required */
- 0 /* Cancel refresh token */
+ 0, /* Cancel refresh token */
+ GMAIL_FLAGS /* default flags. For Gmail this should be set to OA2_AUTHORIZE */
},
{OUTLOOK_NAME,
{"outlook.office365.com", "smtp.office365.com", NULL, NULL},
@@ -207,7 +208,8 @@ OAUTH2_S alpine_oauth2_list[] =
0, /* expiration time */
0, /* first time indicator */
0, /* client secret required */
- 0 /* Cancel refresh token */
+ 0, /* Cancel refresh token */
+ OUTLOOK_FLAGS /* default flags. For OUTLOOK this should be set to OA2_DEVICE */
},
{OUTLOOK_NAME,
{"outlook.office365.com", "smtp.office365.com", NULL, NULL},
@@ -239,7 +241,8 @@ OAUTH2_S alpine_oauth2_list[] =
0, /* expiration time */
0, /* first time indicator */
1, /* client secret required */
- 0 /* Cancel refresh token */
+ 0, /* Cancel refresh token */
+ OUTLOOK_FLAGS /* default flags. For OUTLOOK this should be set to OA2_DEVICE */
},
{YAHOO_NAME,
{"imap.mail.yahoo.com", "smtp.mail.yahoo.com", NULL, NULL},
@@ -271,7 +274,8 @@ OAUTH2_S alpine_oauth2_list[] =
0, /* expiration time */
0, /* first time indicator */
1, /* client secret required */
- 0 /* Cancel refresh token */
+ 0, /* Cancel refresh token */
+ YAHOO_FLAGS /* default flags. For YAHOO this should be set to OA2_AUTHORIZE */
},
{YANDEX_NAME,
{"imap.yandex.com", "smtp.yandex.com", NULL, NULL},
@@ -303,9 +307,10 @@ OAUTH2_S alpine_oauth2_list[] =
0, /* expiration time */
0, /* first time indicator */
1, /* client secret required */
- 0 /* Cancel refresh token */
+ 0, /* Cancel refresh token */
+ YANDEX_FLAGS /* defaul flags. For YANDEX this should be set to OA2_AUTHORIZE */
},
- { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0},
+ { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0},
};
int
@@ -1111,7 +1116,9 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
&& oa2
&& oa2->host[j] != NULL
&& strucmp(oa2->host[j], mb->orighost) != 0; j++);
- if(oa2 && oa2->host && j < OAUTH2_TOT_EQUIV && oa2->host[j])
+ if(oa2 && oa2->host && j < OAUTH2_TOT_EQUIV && oa2->host[j]
+ && ((oa2->server_mthd[0].name && (oa2->flags & OA2_AUTHORIZE))
+ || (oa2->server_mthd[1].name && (oa2->flags & OA2_DEVICE))))
nmethods++;
}
diff --git a/alpine/xoauth2.h b/alpine/xoauth2.h
index e889078a..2abd1fff 100644
--- a/alpine/xoauth2.h
+++ b/alpine/xoauth2.h
@@ -19,20 +19,24 @@
#define GMAIL_ID "624395471329-0qee3goofj7kbl7hsukou3rqq0igntv1.apps.googleusercontent.com"
#define GMAIL_SECRET "vwnqVJQrJZpR6JilCfAN5nY7"
#define GMAIL_TENANT NULL
+#define GMAIL_FLAGS (OA2_AUTHORIZE)
#define OUTLOOK_NAME "Outlook"
#define OUTLOOK_ID "f21dcaf2-8020-469b-8135-343bfc35d046"
#define OUTLOOK_SECRET "Tk-DAcEi13-FeSsY_Ja4Y.-MyL66I.wIPt"
#define OUTLOOK_TENANT "common"
+#define OUTLOOK_FLAGS (OA2_DEVICE)
#define YANDEX_NAME "Yandex"
#define YANDEX_ID "393578fee26f47858023cf59681882a7"
#define YANDEX_SECRET "7304c4993583498f8ab63e2f21ad6960"
#define YANDEX_TENANT NULL
+#define YANDEX_FLAGS (OA2_AUTHORIZE)
#define YAHOO_NAME "Yahoo!"
#define YAHOO_ID "dj0yJmk9RTdyZEQ2TWxGMzV6JmQ9WVdrOWVrTllZbGgyV2tjbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTli"
#define YAHOO_SECRET "3a8b12d51c09b0a5c0733c36d04cd3c69e33baef"
#define YAHOO_TENANT NULL
+#define YAHOO_FLAGS (OA2_AUTHORIZE)
#endif /* ALPINE_XOAUTH2_INCLUDED */
diff --git a/imap/src/c-client/mail.h b/imap/src/c-client/mail.h
index ce5e2847..9fc1c714 100644
--- a/imap/src/c-client/mail.h
+++ b/imap/src/c-client/mail.h
@@ -1941,6 +1941,10 @@ int PFLUSH (void);
#define OAUTH2_TOT_EQUIV (OAUTH2_MAX_EQUIV + 2)
#define OAUTH2_PARAM_NUMBER (7)
+#define OA2_UNKNOWN 0x00 /* We do not know what method this client-id uses */
+#define OA2_DEVICE 0x01 /* Client ID obtained by client uses Device Method */
+#define OA2_AUTHORIZE 0x10 /* Client ID obtained by client uses Authorize Method */
+
typedef enum {OA2_Id = 0,
OA2_Secret,
OA2_Tenant,
@@ -1995,6 +1999,7 @@ typedef struct oauth2_s {
unsigned int first_time:1; /* this is the first time we get credentials for this account */
unsigned int require_secret:1; /* this server requires a client-secret */
int cancel_refresh_token; /* ask client to cancel refresh token */
+ int flags; /* options to register for this method */
} OAUTH2_S;
typedef struct deviceproc_s {
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 3904fe6c..5b0078e3 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -197,6 +197,10 @@ New features include:
<LI> Add the capability to record http debug. This is necessary to debug XOAUTH2
authemtication, and records sensitive login information. Do not share your
debug file if you use this form of debug.
+<LI> Remove the ability to choose between the device and authorize methods
+ to login to outlook, since the original client-id can only be used
+ for the device method. One needs a special client-id and client-secret
+ to use the authorize method in Outlook.
</UL>
<P>