From: Kevin McCarthy Date: Sun, 24 Mar 2019 01:45:31 +0000 (+0800) Subject: Fail oauth quietly if it was not configured. X-Git-Tag: mutt-1-12-rel~83^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=728f1fa8f251f74f4934f6a6401b7c4b9984e712;p=mutt Fail oauth quietly if it was not configured. Don't report an error unless they explicitly put "oauthbearer" in the authenticator list or configured the oauth_refresh_command. --- diff --git a/imap/auth_oauth.c b/imap/auth_oauth.c index 14e843a5..c847d4c0 100644 --- a/imap/auth_oauth.c +++ b/imap/auth_oauth.c @@ -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 */ diff --git a/pop_auth.c b/pop_auth.c index 2d50fed5..883f6791 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -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: