talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 55619cef1418e3b8f1f88ac8923ae7c8e01e9335
parent 1608444ca48f8db3ec731805d330a5b13b05a6a3
Author: Michael Rasmussen <mir@datanom.net>
Date:   Tue,  6 Feb 2024 23:58:03 +0100

Fix bug #4765 oauth2: only store smtp auth if authorization method is OAUTH2 fix bug #4766 oauth2: preserve the expiry value of SMTP auth type is not OAUTH2 patches by Olaf Hering

Signed-off-by: Michael Rasmussen <mir@datanom.net>

Diffstat:
Msrc/prefs_account.c | 23+++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/prefs_account.c b/src/prefs_account.c @@ -3722,7 +3722,8 @@ static gint prefs_send_apply(void) FALSE); #ifdef USE_OAUTH2 /* Manual password change - reset expiry on OAUTH2 tokens*/ - passwd_store_set_account(tmp_ac_prefs.account_id, PWS_ACCOUNT_OAUTH2_EXPIRY, "0", FALSE); + if (tmp_ac_prefs.use_smtp_auth && tmp_ac_prefs.smtp_auth_type == SMTPAUTH_OAUTH2) + passwd_store_set_account(tmp_ac_prefs.account_id, PWS_ACCOUNT_OAUTH2_EXPIRY, "0", FALSE); #endif return 0; @@ -5260,13 +5261,14 @@ static void prefs_account_oauth2_obtain_tokens(GtkButton *button, gpointer data) if(OAUTH2Data->access_token != NULL){ passwd_store_set_account(tmp_ac_prefs.account_id, PWS_ACCOUNT_RECV, OAUTH2Data->access_token, FALSE); + gtk_entry_set_text(GTK_ENTRY(basic_page.pass_entry), OAUTH2Data->access_token); - passwd_store_set_account(tmp_ac_prefs.account_id, - PWS_ACCOUNT_SEND, OAUTH2Data->access_token, FALSE); + if (tmp_ac_prefs.use_smtp_auth && tmp_ac_prefs.smtp_auth_type == SMTPAUTH_OAUTH2) { + passwd_store_set_account(tmp_ac_prefs.account_id, + PWS_ACCOUNT_SEND, OAUTH2Data->access_token, FALSE); + gtk_entry_set_text(GTK_ENTRY(send_page.smtp_pass_entry), OAUTH2Data->access_token); + } log_message(LOG_PROTOCOL, "OAuth2 access token stored\n"); - - gtk_entry_set_text(GTK_ENTRY(basic_page.pass_entry), OAUTH2Data->access_token); - gtk_entry_set_text(GTK_ENTRY(send_page.smtp_pass_entry), OAUTH2Data->access_token); } if(OAUTH2Data->expiry_str != NULL){ @@ -6210,10 +6212,11 @@ static void prefs_account_oauth2_callback(GObject *source, GAsyncResult *res, gp PWS_ACCOUNT_RECV, oauth2_listener_data->OAUTH2Data->access_token, FALSE); - passwd_store_set_account(tmp_ac_prefs.account_id, - PWS_ACCOUNT_SEND, - oauth2_listener_data->OAUTH2Data->access_token, - FALSE); + if (tmp_ac_prefs.use_smtp_auth && tmp_ac_prefs.smtp_auth_type == SMTPAUTH_OAUTH2) + passwd_store_set_account(tmp_ac_prefs.account_id, + PWS_ACCOUNT_SEND, + oauth2_listener_data->OAUTH2Data->access_token, + FALSE); log_message(LOG_PROTOCOL, "OAuth2 access token stored\n"); }