]> granicus.if.org Git - neomutt/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)
committerRichard Russon <rich@flatcap.org>
Tue, 9 Apr 2019 11:54:28 +0000 (12:54 +0100)
Don't report an error unless they explicitly put "oauthbearer" in the
authenticator list or configured the oauth_refresh_command.

Co-authored-by: Richard Russon <rich@flatcap.org>
imap/auth_oauth.c
pop/pop_auth.c

index 8dcf1e32ae6734a6de1f0cbb70edcd9fb44b8664..cf4900720c0f366e4724372689c60efe8fc58f1e 100644 (file)
@@ -57,6 +57,10 @@ enum ImapAuthRes imap_auth_oauth(struct ImapAccountData *adata, const char *meth
     return IMAP_AUTH_UNAVAIL;
   }
 
+  /* If they did not explicitly request or configure oauth then fail quietly */
+  if (!(method || (C_ImapOauthRefreshCmd && *C_ImapOauthRefreshCmd)))
+    return IMAP_AUTH_UNAVAIL;
+
   mutt_message(_("Authenticating (OAUTHBEARER)..."));
 
   /* We get the access token from the imap_oauth_refresh_command */
index 7e9a471557fe70e9185947ca3d9cf3059221f1dc..4f1a8359d7aa63c0d0f4c6e2049c8c018faf749a 100644 (file)
@@ -339,6 +339,10 @@ static enum PopAuthRes pop_auth_user(struct PopAccountData *adata, const char *m
  */
 static enum PopAuthRes pop_auth_oauth(struct PopAccountData *adata, const char *method)
 {
+  /* If they did not explicitly request or configure oauth then fail quietly */
+  if (!(method || (C_PopOauthRefreshCmd && *C_PopOauthRefreshCmd)))
+    return POP_A_UNAVAIL;
+
   mutt_message(_("Authenticating (OAUTHBEARER)..."));
 
   char *oauthbearer = mutt_account_getoauthbearer(&adata->conn->account);
@@ -475,14 +479,14 @@ int pop_authenticate(struct PopAccountData *adata)
 
     while (authenticator->authenticate)
     {
-      ret = authenticator->authenticate(adata, authenticator->method);
+      ret = authenticator->authenticate(adata, NULL);
       if (ret == POP_A_SOCKET)
       {
         switch (pop_connect(adata))
         {
           case 0:
           {
-            ret = authenticator->authenticate(adata, authenticator->method);
+            ret = authenticator->authenticate(adata, NULL);
             break;
           }
           case -2: