From 0bfa843f3263626b52363aa0909affbc6eccc737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 7 Jan 2014 15:22:53 +0100 Subject: [PATCH] properties: fix an endless loop when selecting PKCS12 file (rh #997255) --- NetworkManager-openvpn.spec | 8 ++- rh997255-fix-pkcs12-endless-loop.patch | 82 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 rh997255-fix-pkcs12-endless-loop.patch diff --git a/NetworkManager-openvpn.spec b/NetworkManager-openvpn.spec index cb15175..4856f8d 100644 --- a/NetworkManager-openvpn.spec +++ b/NetworkManager-openvpn.spec @@ -4,11 +4,12 @@ Summary: NetworkManager VPN plugin for OpenVPN Name: NetworkManager-openvpn Epoch: 1 Version: 0.9.8.2 -Release: 3%{snapshot}%{?dist} +Release: 4%{snapshot}%{?dist} License: GPLv2+ URL: http://www.gnome.org/projects/NetworkManager/ Group: System Environment/Base Source0: http://ftp.gnome.org/pub/GNOME/sources/%{name}/0.9/%{name}-%{version}%{snapshot}.tar.bz2 +Patch1: rh997255-fix-pkcs12-endless-loop.patch BuildRequires: gtk3-devel BuildRequires: dbus-devel @@ -53,6 +54,8 @@ the OpenVPN server with NetworkManager (GNOME files). %prep %setup -q -n %{name}-%{version} +%patch1 -p1 -b .rh997255-fix-endless-loop + %build if [ ! -f configure ]; then ./autogen.sh @@ -85,6 +88,9 @@ rm -f %{buildroot}%{_libdir}/NetworkManager/lib*.la %{_datadir}/gnome-vpn-properties/openvpn/nm-openvpn-dialog.ui %changelog +* Tue Jan 7 2014 Jiří Klimeš - 1:0.9.8.2-4 +- properties: fix an endless loop when selecting PKCS12 file (rh #997255) + * Fri Jul 26 2013 Jiří Klimeš - 1:0.9.8.2-3 - Fixing Obsoletes to ensure NetworkManager-openvpn-gnome installs on update (rh #988131) diff --git a/rh997255-fix-pkcs12-endless-loop.patch b/rh997255-fix-pkcs12-endless-loop.patch new file mode 100644 index 0000000..ff92feb --- /dev/null +++ b/rh997255-fix-pkcs12-endless-loop.patch @@ -0,0 +1,82 @@ +From 522190ad916b301919535208193b9d69db0f5f8e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= +Date: Tue, 7 Jan 2014 14:50:57 +0100 +Subject: [PATCH] properties: fix an endless loop when selecting PKCS12 file + (rh #997255) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + +Signed-off-by: Jiří Klimeš +--- + properties/auth-helpers.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c +index d0c8844..2dcb2ea 100644 +--- a/properties/auth-helpers.c ++++ b/properties/auth-helpers.c +@@ -46,6 +46,8 @@ + #define PW_TYPE_ASK 1 + #define PW_TYPE_UNUSED 2 + ++#define BLOCK_HANDLER_ID "block-handler-id" ++ + static void + show_password (GtkToggleButton *togglebutton, GtkEntry *password_entry) + { +@@ -105,7 +107,10 @@ tls_cert_changed_cb (GtkWidget *widget, GtkWidget *next_widget) + next_fname = gtk_file_chooser_get_filename (next); + if (!next_fname || strcmp (fname, next_fname)) { + /* Next chooser was different, make it the same as the first */ ++ gulong id = GPOINTER_TO_SIZE (g_object_get_data (G_OBJECT (next_widget), BLOCK_HANDLER_ID)); ++ g_signal_handler_block (G_OBJECT (next_widget), id); + gtk_file_chooser_set_filename (next, fname); ++ g_signal_handler_unblock (G_OBJECT (next_widget), id); + } + g_free (fname); + g_free (next_fname); +@@ -117,8 +122,12 @@ tls_cert_changed_cb (GtkWidget *widget, GtkWidget *next_widget) + * file selectors that have PKCS#12 files in them. + */ + next_fname = gtk_file_chooser_get_filename (next); +- if (is_pkcs12 (next_fname)) ++ if (is_pkcs12 (next_fname)) { ++ gulong id = GPOINTER_TO_SIZE (g_object_get_data (G_OBJECT (next_widget), BLOCK_HANDLER_ID)); ++ g_signal_handler_block (G_OBJECT (next_widget), id); + gtk_file_chooser_set_filename (next, NULL); ++ g_signal_handler_unblock (G_OBJECT (next_widget), id); ++ } + g_free (next_fname); + } + +@@ -135,6 +144,7 @@ tls_setup (GtkBuilder *builder, + const char *value; + char *tmp; + GtkFileFilter *filter; ++ gulong id1, id2, id3; + + tmp = g_strdup_printf ("%s_user_cert_chooser", prefix); + cert = GTK_WIDGET (gtk_builder_get_object (builder, tmp)); +@@ -173,9 +183,14 @@ tls_setup (GtkBuilder *builder, + } + + /* Link choosers to the PKCS#12 changer callback */ +- g_signal_connect (ca_chooser, "selection-changed", G_CALLBACK (tls_cert_changed_cb), cert); +- g_signal_connect (cert, "selection-changed", G_CALLBACK (tls_cert_changed_cb), key); +- g_signal_connect (key, "selection-changed", G_CALLBACK (tls_cert_changed_cb), ca_chooser); ++ id1 = g_signal_connect (ca_chooser, "selection-changed", G_CALLBACK (tls_cert_changed_cb), cert); ++ id2 = g_signal_connect (cert, "selection-changed", G_CALLBACK (tls_cert_changed_cb), key); ++ id3 = g_signal_connect (key, "selection-changed", G_CALLBACK (tls_cert_changed_cb), ca_chooser); ++ ++ /* Store handler id to be able to block the signal in tls_cert_changed_cb() */ ++ g_object_set_data (ca_chooser, BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id1)); ++ g_object_set_data (cert, BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id2)); ++ g_object_set_data (key, BLOCK_HANDLER_ID, GSIZE_TO_POINTER (id3)); + + /* Fill in the private key password */ + tmp = g_strdup_printf ("%s_private_key_password_entry", prefix); +-- +1.7.11.7 +