]> granicus.if.org Git - mutt/commitdiff
Fail oauth quietly if it was not configured.
authorKevin McCarthy <kevin@8t8.us>
Sun, 24 Mar 2019 01:45:31 +0000 (09:45 +0800)
committerKevin McCarthy <kevin@8t8.us>
Fri, 29 Mar 2019 22:20:53 +0000 (15:20 -0700)
Don't report an error unless they explicitly put "oauthbearer" in the
authenticator list or configured the oauth_refresh_command.

imap/auth_oauth.c
pop_auth.c

index 14e843a54d85b0c8c8c94b9a6ed64efb4d32ab2b..c847d4c03dbadd607b0f34b411da91708c833d9d 100644 (file)
@@ -41,6 +41,10 @@ imap_auth_res_t imap_auth_oauth (IMAP_DATA* idata, const char* method)
       !idata->conn->ssf)
     return IMAP_AUTH_UNAVAIL;
 
+  /* If they did not explicitly request or configure oauth then fail quietly */
+  if (!(method || (ImapOauthRefreshCmd && *ImapOauthRefreshCmd)))
+      return IMAP_AUTH_UNAVAIL;
+
   mutt_message _("Authenticating (OAUTHBEARER)...");
 
   /* We get the access token from the imap_oauth_refresh_command */
index 2d50fed562af59e6fc76af9cf3612ef413fde9f5..883f679126758b2f971748307c664973682bde60 100644 (file)
@@ -327,6 +327,10 @@ static pop_auth_res_t pop_auth_oauth (POP_DATA *pop_data, const char *method)
   size_t auth_cmd_len;
   int ret, len;
 
+  /* If they did not explicitly request or configure oauth then fail quietly */
+  if (!(method || (PopOauthRefreshCmd && *PopOauthRefreshCmd)))
+      return POP_A_UNAVAIL;
+
   mutt_message _("Authenticating (OAUTHBEARER)...");
 
   oauthbearer = mutt_account_getoauthbearer (&pop_data->conn->account);
@@ -459,13 +463,13 @@ int pop_authenticate (POP_DATA* pop_data)
 
     while (authenticator->authenticate)
     {
-      ret = authenticator->authenticate (pop_data, authenticator->method);
+      ret = authenticator->authenticate (pop_data, NULL);
       if (ret == POP_A_SOCKET)
        switch (pop_connect (pop_data))
        {
          case 0:
          {
-           ret = authenticator->authenticate (pop_data, authenticator->method);
+           ret = authenticator->authenticate (pop_data, NULL);
            break;
          }
          case -2: