]> granicus.if.org Git - curl/commitdiff
sasl: Don't choose OAuth 2.0 if mechanism not advertised
authorSteve Holme <steve_holme@hotmail.com>
Sat, 5 Sep 2015 16:29:49 +0000 (17:29 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Thu, 12 Nov 2015 18:25:33 +0000 (18:25 +0000)
Regression from commit 9e8ced9890 which meant if --oauth2-bearer was
specified but the SASL mechanism wasn't supported by the server then
the mechanism would be chosen.

lib/curl_sasl.c

index a0c9899152ba0eaaad548cb0bf299d3281186c66..8ccfac84a13390f316dc1bc1cc3eb6c6abd9849d 100644 (file)
@@ -1455,7 +1455,8 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
       }
     else
 #endif
-    if((enabledmechs & SASL_MECH_XOAUTH2) || conn->oauth_bearer) {
+    if((enabledmechs & SASL_MECH_XOAUTH2) && ((conn->oauth_bearer) ||
+                                              (!conn->passwd))) {
       mech = SASL_MECH_STRING_XOAUTH2;
       state1 = SASL_XOAUTH2;
       sasl->authused = SASL_MECH_XOAUTH2;