[Commits] [SCM] claws branch, gtk2, updated. 3.19.0-54-gf15122fe7

paul at claws-mail.org paul at claws-mail.org
Sun Jul 24 10:44:31 UTC 2022


The branch, gtk2 has been updated
       via  f15122fe7760df567be94a007ba9e4072458ee0b (commit)
      from  72097400ab167b2c3fb007c41ba3d7b1753a8cf2 (commit)

Summary of changes:
 configure.ac            | 20 ++++++++++++++++++++
 src/common/smtp.c       |  6 ++++--
 src/etpan/imap-thread.c |  2 +-
 src/gtk/about.c         | 10 ++++++++++
 src/imap.c              |  4 ++--
 src/inc.c               |  4 ++--
 src/oauth2.c            |  2 +-
 src/oauth2.h            |  2 +-
 src/pop.c               | 13 +++++++++----
 src/prefs_account.c     | 46 +++++++++++++++++++++++++---------------------
 src/send_message.c      |  7 ++++---
 11 files changed, 79 insertions(+), 37 deletions(-)


- Log -----------------------------------------------------------------
commit f15122fe7760df567be94a007ba9e4072458ee0b
Author: Paul <paul at claws-mail.org>
Date:   Sun Jul 24 11:29:46 2022 +0100

    make oauth2 depend on gnutls at build time, but add --disable-oauth2 so the interface can be decluttered for those that will never need oauth2

diff --git a/configure.ac b/configure.ac
index 9721bdf17..b91e819a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,6 +277,10 @@ AC_ARG_ENABLE(gnutls,
 		[  --disable-gnutls                Do not build GnuTLS support for TLS],
 		    [enable_gnutls=$enableval], [enable_gnutls=yes])
 
+AC_ARG_ENABLE(oauth2,
+		[  --disable-oauth2                Do not build OAuth2 support],
+		    [enable_oauth2=$enableval], [enable_oauth2=yes])
+
 AC_ARG_ENABLE(enchant,
 		[  --disable-enchant               Do not build Enchant support for spell-checking],
 		[enable_enchant=$enableval], [enable_enchant=yes])
@@ -589,6 +593,21 @@ case $pwd_crypto in
 		;;
 esac
 
+AC_MSG_CHECKING([whether GnuTLS support is present for OAuth2])
+if test x"$enable_gnutls" = xyes; then
+	AC_MSG_RESULT([yes])
+	AC_MSG_CHECKING([whether to build oauth2 support])
+	if test x"$enable_oauth2" = xyes; then
+		AC_MSG_RESULT([yes])
+		AC_DEFINE(USE_OAUTH2, 1, [Define if OAuth2 is to be activated.])
+	else
+		AC_MSG_RESULT([no])
+		enable_oauth2=no
+	fi
+else
+	AC_MSG_RESULT([no])
+	enable_oauth2=no
+fi
 
 dnl ************************
 dnl ** GTK user interface **
@@ -2219,6 +2238,7 @@ else
 	echo "LDAP               : $enable_ldap"
 fi
 echo "gnuTLS             : $enable_gnutls"
+echo "OAuth2             : $enable_oauth2"
 echo "iconv              : $am_cv_func_iconv"
 echo "compface           : $enable_compface"
 echo "IPv6               : $enable_ipv6"
diff --git a/src/common/smtp.c b/src/common/smtp.c
index b01898653..c8f22ec9a 100644
--- a/src/common/smtp.c
+++ b/src/common/smtp.c
@@ -42,6 +42,8 @@ static void smtp_session_destroy(Session *session);
 static gint smtp_auth(SMTPSession *session);
 #ifdef USE_GNUTLS
 static gint smtp_starttls(SMTPSession *session);
+#endif
+#ifdef USE_OAUTH2
 static gint smtp_auth_oauth2(SMTPSession *session);
 #endif
 static gint smtp_auth_cram_md5(SMTPSession *session);
@@ -176,7 +178,7 @@ static gint smtp_auth(SMTPSession *session)
                  &&
 		  (session->avail_auth_type & SMTPAUTH_PLAIN) != 0)
 		smtp_auth_plain(session);
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 	else if ((session->forced_auth_type == SMTPAUTH_OAUTH2
 		  || session->forced_auth_type == 0)
                  &&
@@ -403,7 +405,7 @@ static gint smtp_auth_plain(SMTPSession *session)
 	return SM_OK;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static gint smtp_auth_oauth2(SMTPSession *session)
 {
 	gchar buf[MESSAGEBUFSIZE], *b64buf, *out;
diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
index a043f2c78..973656cdc 100644
--- a/src/etpan/imap-thread.c
+++ b/src/etpan/imap-thread.c
@@ -1001,7 +1001,7 @@ static void login_run(struct etpan_thread_op * op)
 			param->type, NULL, NULL, NULL,
 			NULL, param->login,
 			param->password, NULL);
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 	else if (!strcmp(param->type, "XOAUTH2"))
                 r = mailimap_oauth2_authenticate(param->imap, param->login, param->password);
 #endif
diff --git a/src/gtk/about.c b/src/gtk/about.c
index 0e55dee34..2a715f0dd 100644
--- a/src/gtk/about.c
+++ b/src/gtk/about.c
@@ -450,6 +450,16 @@ static GtkWidget *about_create_child_page_features(void)
 	gtk_text_buffer_insert(buffer, &iter, 
 		(gchar *)C_("GnuTLS", "adds support for encrypted connections to servers\n"), -1);
 
+#if USE_OAUTH2
+	gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
+#else
+	gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
+#endif
+	gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" OAuth2 "), -1,
+						 "bold", NULL);
+	gtk_text_buffer_insert(buffer, &iter,
+		(gchar *)C_("OAuth2", "adds support for OAuth2 authentication\n"), -1);
+
 #if INET6
 	gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
diff --git a/src/imap.c b/src/imap.c
index ce2ed4a70..a261c2eda 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -72,7 +72,7 @@
 #include "main.h"
 #include "passwordstore.h"
 #include "file-utils.h"
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 #include "oauth2.h"
 #endif
 
@@ -1330,7 +1330,7 @@ static gint imap_session_authenticate(IMAPSession *session,
 	gboolean failed = FALSE;
 	gint ok = MAILIMAP_NO_ERROR;
 	g_return_val_if_fail(account->userid != NULL, MAILIMAP_ERROR_BAD_STATE);
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 	if(account->imap_auth_type == IMAP_AUTH_OAUTH2)
 	        oauth2_check_passwds (account);
 #endif
diff --git a/src/inc.c b/src/inc.c
index 9ede6c5a1..2b43e036c 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -61,7 +61,7 @@
 #include "hooks.h"
 #include "logwindow.h"
 #include "passwordstore.h"
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 #include "oauth2.h"
 #endif
 
@@ -635,7 +635,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 			manage_window_focus_in
 				(inc_dialog->dialog->window,
 				 NULL, NULL);
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 		if(pop3_session->ac_prefs->use_pop_auth && 
 		   pop3_session->ac_prefs->pop_auth_type == POPAUTH_OAUTH2)
 		     oauth2_check_passwds (pop3_session->ac_prefs);
diff --git a/src/oauth2.c b/src/oauth2.c
index 26491db31..b9d177a7f 100644
--- a/src/oauth2.c
+++ b/src/oauth2.c
@@ -22,7 +22,7 @@
 #include "claws-features.h"
 #endif
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 
 #include <glib.h>
 #ifdef ENABLE_NLS
diff --git a/src/oauth2.h b/src/oauth2.h
index ccef56770..51eb60dcf 100644
--- a/src/oauth2.h
+++ b/src/oauth2.h
@@ -21,7 +21,7 @@
 #include "claws-features.h"
 #endif
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 
 #include <glib.h>
 
diff --git a/src/pop.c b/src/pop.c
index 1117084bb..b4f907fc3 100644
--- a/src/pop.c
+++ b/src/pop.c
@@ -178,7 +178,7 @@ static gint pop3_getauth_apop_send(Pop3Session *session)
 	return PS_SUCCESS;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static gint pop3_getauth_oauth2_send(Pop3Session *session)
 {
 	gchar buf[MESSAGEBUFSIZE], *b64buf, *out;
@@ -535,7 +535,7 @@ static void pop3_gen_send(Pop3Session *session, const gchar *format, ...)
 
 	if (!g_ascii_strncasecmp(buf, "PASS ", 5))
 		log_print(LOG_PROTOCOL, "POP> PASS ********\n");
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
         else if  (!g_ascii_strncasecmp(buf, "AUTH XOAUTH2 ", 13))
 		log_print(LOG_PROTOCOL, "POP> AUTH XOAUTH2  ********\n");
 #endif
@@ -993,7 +993,10 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
 #ifdef USE_GNUTLS
 		if (pop3_session->ac_prefs->ssl_pop == SSL_STARTTLS)
 			val = pop3_stls_send(pop3_session);
-                else if (pop3_session->ac_prefs->use_pop_auth && pop3_session->ac_prefs->pop_auth_type == POPAUTH_OAUTH2)
+		else
+#endif
+#ifdef USE_OAUTH2
+                if (pop3_session->ac_prefs->use_pop_auth && pop3_session->ac_prefs->pop_auth_type == POPAUTH_OAUTH2)
 			val = pop3_getauth_oauth2_send(pop3_session);
 		else
 #endif
@@ -1008,8 +1011,10 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
 			return -1;
 		if (pop3_session->ac_prefs->use_pop_auth && pop3_session->ac_prefs->pop_auth_type == POPAUTH_APOP)
 			val = pop3_getauth_apop_send(pop3_session);
+#ifdef USE_OAUTH2
                 else if (pop3_session->ac_prefs->use_pop_auth && pop3_session->ac_prefs->pop_auth_type == POPAUTH_OAUTH2)
 			val = pop3_getauth_oauth2_send(pop3_session);
+#endif
 		else
 			val = pop3_getauth_user_send(pop3_session);
 		break;
@@ -1019,7 +1024,7 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
 		break;
 	case POP3_GETAUTH_PASS:
 	case POP3_GETAUTH_APOP:
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
         case POP3_GETAUTH_OAUTH2:
 #endif
 		if (!pop3_session->pop_before_smtp)
diff --git a/src/prefs_account.c b/src/prefs_account.c
index ec9f8c099..0bc85caa0 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -62,7 +62,7 @@
 #include "smtp.h"
 #include "imap.h"
 #include "pop.h"
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 #include "oauth2.h"
 #endif
 #include "remotefolder.h"
@@ -105,7 +105,7 @@ struct AutocheckWidgets {
 
 static GSList *prefs_pages = NULL;
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static GTask *oauth2_listener_task;
 static int oauth2_listener_cancel = 0;
 static int oauth2_listener_closed = 0;
@@ -216,7 +216,7 @@ typedef struct SendPage
 	GtkWidget *pop_auth_minutes_lbl;
 } SendPage;
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 typedef struct Oauth2Page
 {
 	PrefsPage page;
@@ -390,7 +390,7 @@ typedef struct AdvancedPage
 static BasicPage basic_page;
 static ReceivePage receive_page;
 static SendPage send_page;
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static Oauth2Page oauth2_page;
 #endif
 static ComposePage compose_page;
@@ -418,7 +418,7 @@ static char *protocol_names[] = {
 	N_("None (SMTP only)")
 };
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 struct Oauth2Listener {
 	int success;
   	Oauth2Service service;
@@ -440,7 +440,7 @@ static void prefs_account_smtp_auth_type_set_data_from_optmenu (PrefParam *ppara
 static void prefs_account_smtp_auth_type_set_optmenu	(PrefParam *pparam);
 static void prefs_account_pop_auth_type_set_data_from_optmenu (PrefParam *pparam);
 static void prefs_account_pop_auth_type_set_optmenu	(PrefParam *pparam);
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void prefs_account_oauth2_provider_set_data_from_optmenu	(PrefParam *pparam);
 static void prefs_account_oauth2_provider_set_optmenu	(PrefParam *pparam);
 static void prefs_account_oauth2_copy_url                       (GtkButton *button, gpointer data);
@@ -671,7 +671,7 @@ static PrefParam send_param[] = {
 };
 
 static PrefParam oauth2_param[] = {
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 	{"oauth2_auth_provider", "0", &tmp_ac_prefs.oauth2_provider, P_ENUM,
 	 &oauth2_page.oauth2_auth_optmenu,
 	 prefs_account_oauth2_provider_set_data_from_optmenu,
@@ -1684,9 +1684,11 @@ static void receive_create_widget_func(PrefsPage * _page,
 	COMBOBOX_ADD (menu2, _("Select"), 0);
 	COMBOBOX_ADD (menu2, NULL, 0);
 	COMBOBOX_ADD (menu2, "APOP", POPAUTH_APOP);
-#ifdef USE_GNUTLS
 	COMBOBOX_ADD (menu2, "OAuth2", POPAUTH_OAUTH2);
+#ifndef USE_OAUTH2
+	gtk_list_store_set(menu2, &iter, COMBOBOX_SENS, FALSE, -1);
 #endif
+
 	SET_TOGGLE_SENSITIVITY (pop_auth_checkbtn, vbox5);
 
 	PACK_CHECK_BUTTON (vbox2, rmmail_checkbtn,
@@ -1824,8 +1826,9 @@ static void receive_create_widget_func(PrefsPage * _page,
 	COMBOBOX_ADD (menu, "SCRAM-SHA-1", IMAP_AUTH_SCRAM_SHA1);
 	COMBOBOX_ADD (menu, "PLAIN", IMAP_AUTH_PLAIN);
 	COMBOBOX_ADD (menu, "LOGIN", IMAP_AUTH_LOGIN);
-#ifdef USE_GNUTLS
 	COMBOBOX_ADD (menu, "OAUTH2", IMAP_AUTH_OAUTH2);
+#ifndef USE_OAUTH2
+	gtk_list_store_set(menu, &iter, COMBOBOX_SENS, FALSE, -1);
 #endif
 
 	hbox1 = gtk_hbox_new (FALSE, 8);
@@ -2083,8 +2086,9 @@ static void send_create_widget_func(PrefsPage * _page,
 	COMBOBOX_ADD (menu, "PLAIN", SMTPAUTH_PLAIN);
 	COMBOBOX_ADD (menu, "LOGIN", SMTPAUTH_LOGIN);
 	COMBOBOX_ADD (menu, "CRAM-MD5", SMTPAUTH_CRAM_MD5);
-#ifdef USE_GNUTLS
 	COMBOBOX_ADD (menu, "OAUTH2", SMTPAUTH_OAUTH2);
+#ifndef USE_OAUTH2
+	gtk_list_store_set(menu, &iter, COMBOBOX_SENS, FALSE, -1);
 #endif
 	COMBOBOX_ADD (menu, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5);
 	gtk_list_store_set(menu, &iter, COMBOBOX_SENS, FALSE, -1);
@@ -2231,7 +2235,7 @@ static void send_create_widget_func(PrefsPage * _page,
 	page->page.widget = vbox1;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void oauth2_create_widget_func(PrefsPage * _page,
                                            GtkWindow * window,
                                            gpointer data)
@@ -3695,7 +3699,7 @@ static gint prefs_basic_apply(void)
 			gtk_entry_get_text(GTK_ENTRY(basic_page.pass_entry)),
 			FALSE);
 
-#ifdef USE_GNUTLS
+#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);
 #endif
@@ -3741,7 +3745,7 @@ static gint prefs_send_apply(void)
 			PWS_ACCOUNT_SEND,
 			gtk_entry_get_text(GTK_ENTRY(send_page.smtp_pass_entry)),
 			FALSE);
-#ifdef USE_GNUTLS
+#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);
 #endif
@@ -3749,7 +3753,7 @@ static gint prefs_send_apply(void)
 	return 0;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static gint prefs_oauth2_apply(void)
 {
 	prefs_set_data_from_dialog(oauth2_param);
@@ -3861,7 +3865,7 @@ static void send_destroy_widget_func(PrefsPage *_page)
 	/* SendPage *page = (SendPage *) _page; */
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void oauth2_destroy_widget_func(PrefsPage *_page)
 {
 	/* Oauth2Page *page = (Oauth2Page *) _page; */
@@ -3935,7 +3939,7 @@ static gboolean send_can_close_func(PrefsPage *_page)
 	return prefs_send_apply() >= 0;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static gboolean oauth2_can_close_func(PrefsPage *_page)
 {	
 	Oauth2Page *page = (Oauth2Page *) _page;
@@ -4042,7 +4046,7 @@ static void send_save_func(PrefsPage *_page)
 		cancelled = FALSE;
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void oauth2_save_func(PrefsPage *_page)
 {
 	Oauth2Page *page = (Oauth2Page *) _page;
@@ -4189,7 +4193,7 @@ static void register_send_page(void)
 	prefs_account_register_page((PrefsPage *) &send_page);
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void register_oauth2_page(void)
 {
 	static gchar *path[3];
@@ -4397,7 +4401,7 @@ void prefs_account_init()
 	hooks_register_hook(SSL_CERT_GET_PASSWORD, sslcert_get_password, NULL);
 #endif
 	register_proxy_page();
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 	register_oauth2_page();
 #endif
 	register_advanced_page();
@@ -5139,7 +5143,7 @@ static void prefs_account_pop_auth_type_set_optmenu(PrefParam *pparam)
 	combobox_select_by_data(optmenu, type);
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 static void prefs_account_oauth2_provider_set_data_from_optmenu(PrefParam *pparam)
 {
 	*((Oauth2Service *)pparam->data) =
@@ -6192,7 +6196,7 @@ static void prefs_account_receive_itv_spinbutton_value_changed_cb(GtkWidget *w,
 	}
 }
 
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 //Automation of the oauth2 authorisation process to receive loopback callback generated by redirect in browser
 static void prefs_account_oauth2_listener(GTask *task, gpointer source, gpointer task_data, GCancellable *cancellable)
 {
diff --git a/src/send_message.c b/src/send_message.c
index cdd265601..58be1e0df 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -57,7 +57,7 @@
 #include "log.h"
 #include "passwordstore.h"
 #include "file-utils.h"
-#ifdef USE_GNUTLS
+#ifdef USE_OAUTH2
 #include "oauth2.h"
 #endif
 
@@ -284,9 +284,10 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
 		    strlen(ac_prefs->gnutls_priority))
 			session->gnutls_priority = g_strdup(ac_prefs->gnutls_priority);
 		session->use_tls_sni = ac_prefs->use_tls_sni;
-
+#ifdef USE_OAUTH2
 		if (ac_prefs->use_smtp_auth && ac_prefs->smtp_auth_type == SMTPAUTH_OAUTH2)
-		        oauth2_check_passwds (ac_prefs);
+		        oauth2_check_passwds(ac_prefs);
+#endif
 #else
 		if (ac_prefs->ssl_smtp != SSL_NONE) {
 			if (alertpanel_full(_("Insecure connection"),

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list