commit 48086e4e82e033b2403af63b9ffb9ca2dd7b696f
parent c61593c30a4b7c2f5a170bde54c27af2d09a0868
Author: Paul <paul@claws-mail.org>
Date: Tue, 21 Feb 2023 16:44:38 +0000
fix bug 4664, 'OAUTH2 overwrites passwords even for plaintext logins'
based on patch by Roland Haas
Diffstat:
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/AUTHORS b/AUTHORS
@@ -344,3 +344,4 @@ contributors (in addition to the above; based on Changelog)
Frank Mueller
JP Guillonneau
Viatrix
+ Roland Haas
diff --git a/src/gtk/authors.h b/src/gtk/authors.h
@@ -164,6 +164,7 @@ static char *CONTRIBS_LIST[] = {
"Mitko Haralanov",
"Alexander Lyons Harkness",
"Hashimoto",
+"Roland Haas",
"Jacob Head",
"Federico Heinz",
"Geir Helland",
diff --git a/src/oauth2.c b/src/oauth2.c
@@ -35,6 +35,7 @@
#include <string.h>
#include <errno.h>
+#include "imap.h"
#include "oauth2.h"
#include "md5.h"
#include "utils.h"
@@ -653,7 +654,9 @@ gint oauth2_check_passwds (PrefsAccount *ac_prefs)
if (ret)
log_message(LOG_PROTOCOL, _("OAuth2 access token not obtained\n"));
else {
- passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_RECV, OAUTH2Data->access_token, FALSE);
+ if (ac_prefs->imap_auth_type == IMAP_AUTH_OAUTH2 ||
+ (ac_prefs->use_pop_auth && ac_prefs->pop_auth_type == POPAUTH_OAUTH2))
+ passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_RECV, OAUTH2Data->access_token, FALSE);
if (ac_prefs->use_smtp_auth && ac_prefs->smtp_auth_type == SMTPAUTH_OAUTH2)
passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_SEND, OAUTH2Data->access_token, FALSE);
passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_OAUTH2_EXPIRY, OAUTH2Data->expiry_str, FALSE);