aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c4
-rw-r--r--lib/smtp.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 22a0c4246..6b6d4ce45 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -579,9 +579,9 @@ static CURLcode imap_perform_authenticate(struct connectdata *conn)
}
else
#endif
-
if((imapc->authmechs & SASL_MECH_XOAUTH2) &&
- (imapc->prefmech & SASL_MECH_XOAUTH2)) {
+ (imapc->prefmech & SASL_MECH_XOAUTH2) &&
+ (imapc->prefmech != SASL_AUTH_ANY) || conn->xoauth2_bearer) {
mech = "XOAUTH2";
state1 = IMAP_AUTHENTICATE_XOAUTH2;
state2 = IMAP_AUTHENTICATE_FINAL;
diff --git a/lib/smtp.c b/lib/smtp.c
index f2c79794c..c3650e1d9 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -500,9 +500,9 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
}
else
#endif
-
if((smtpc->authmechs & SASL_MECH_XOAUTH2) &&
- (smtpc->prefmech & SASL_MECH_XOAUTH2)) {
+ (smtpc->prefmech & SASL_MECH_XOAUTH2) &&
+ (smtpc->prefmech != SASL_AUTH_ANY) || conn->xoauth2_bearer) {
mech = "XOAUTH2";
state1 = SMTP_AUTH_XOAUTH2;
state2 = SMTP_AUTH_FINAL;