[network-manager-applet/f20] applet: load VPN plugins preferably from absolute paths

thaller thaller at fedoraproject.org
Fri Jul 25 19:34:29 UTC 2014


commit 880085dc93402d9453fa2dcd5cfacf436352308e
Author: Thomas Haller <thaller at redhat.com>
Date:   Fri Jul 25 21:09:15 2014 +0200

    applet: load VPN plugins preferably from absolute paths
    
    Signed-off-by: Thomas Haller <thaller at redhat.com>

 0005-prefer-absolute-path-for-vpn-plugin.patch |   80 ++++++++++++++++++++++++
 network-manager-applet.spec                    |    4 +
 2 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/0005-prefer-absolute-path-for-vpn-plugin.patch b/0005-prefer-absolute-path-for-vpn-plugin.patch
new file mode 100644
index 0000000..a877159
--- /dev/null
+++ b/0005-prefer-absolute-path-for-vpn-plugin.patch
@@ -0,0 +1,80 @@
+From 16464fea94b02563198eeb76e298f9086e76dbcf Mon Sep 17 00:00:00 2001
+From: Michael Biebl <biebl at debian.org>
+Date: Tue, 1 Apr 2014 20:10:16 +0200
+Subject: [PATCH 1/1] Use the paths specified in the VPN .name files
+
+Since LIBDIR of nm-applet and the VPN plugins aren't necessarily the
+same, use the paths as specified by the VPN plugins and only
+reconstruct the path if it is not absolute or we fail to load the plugin
+
+(cherry picked from commit eba8b9370b6387b1ff0996e9ae5bd689acb32dbc)
+---
+ src/applet-vpn-request.c            |  2 +-
+ src/connection-editor/vpn-helpers.c | 29 +++++++++++++++++------------
+ 2 files changed, 18 insertions(+), 13 deletions(-)
+
+diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
+index 4520fd4..09b94c0 100644
+--- a/src/applet-vpn-request.c
++++ b/src/applet-vpn-request.c
+@@ -220,7 +220,7 @@ find_auth_dialog_binary (const char *service,
+ 		             NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ 		             "Could not find the authentication dialog for VPN connection type '%s'",
+ 		             service);
+-	} else {
++	} else if (!g_path_is_absolute (prog)) {
+ 		char *prog_basename;
+ 
+ 		/* Remove any path component, then reconstruct path to the auth
+diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c
+index 3bef7f2..c8a3f11 100644
+--- a/src/connection-editor/vpn-helpers.c
++++ b/src/connection-editor/vpn-helpers.c
+@@ -75,7 +75,7 @@ vpn_get_plugins (GError **error)
+ 		char *path = NULL, *service = NULL;
+ 		char *so_path = NULL, *so_name = NULL;
+ 		GKeyFile *keyfile = NULL;
+-		GModule *module;
++		GModule *module = NULL;
+ 		NMVpnPluginUiFactory factory = NULL;
+ 
+ 		if (!g_str_has_suffix (f, ".name"))
+@@ -95,19 +95,24 @@ vpn_get_plugins (GError **error)
+ 		if (!so_path)
+ 			goto next;
+ 
+-		/* Remove any path and extension components, then reconstruct path
+-		 * to the SO in LIBDIR
+-		 */
+-		so_name = g_path_get_basename (so_path);
+-		g_free (so_path);
+-		so_path = g_strdup_printf ("%s/NetworkManager/%s", LIBDIR, so_name);
+-		g_free (so_name);
++		if (g_path_is_absolute (so_path))
++			module = g_module_open (so_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ 
+-		module = g_module_open (so_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ 		if (!module) {
+-			g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Cannot load the VPN plugin which provides the "
+-			             "service '%s'.", service);
+-			goto next;
++			/* Remove any path and extension components, then reconstruct path
++			 * to the SO in LIBDIR
++			 */
++			so_name = g_path_get_basename (so_path);
++			g_free (so_path);
++			so_path = g_strdup_printf ("%s/NetworkManager/%s", LIBDIR, so_name);
++			g_free (so_name);
++
++			module = g_module_open (so_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
++			if (!module) {
++				g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Cannot load the VPN plugin which provides the "
++				             "service '%s'.", service);
++				goto next;
++			}
+ 		}
+ 
+ 		if (g_module_symbol (module, "nm_vpn_plugin_ui_factory", (gpointer) &factory)) {
+-- 
+1.9.3
+
diff --git a/network-manager-applet.spec b/network-manager-applet.spec
index f5d9b0d..c19c86b 100644
--- a/network-manager-applet.spec
+++ b/network-manager-applet.spec
@@ -24,6 +24,7 @@ Patch1: nm-applet-wifi-dialog-ui-fixes.patch
 Patch2: applet-ignore-deprecated.patch
 Patch3: rh1099489-applet-fix-VPN-info.patch
 Patch4: rh1089765-applet-fix-crash-no-MM.patch
+Patch5: 0005-prefer-absolute-path-for-vpn-plugin.patch
 
 Requires: NetworkManager >= %{nm_version}
 Requires: NetworkManager-glib >= %{nm_version}
@@ -110,6 +111,7 @@ nm-applet, nm-connection-editor, and the GNOME control center.
 %patch2 -p1 -b .no-deprecated
 %patch3 -p1 -b .rh1099489-applet-fix-VPN-info
 %patch4 -p1 -b .rh1089765-applet-fix-crash-no-MM
+%patch5 -p1 -b .0005-prefer-absolute-path-for-vpn-plugin.orig
 
 %build
 autoreconf -i -f
@@ -227,6 +229,8 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
 %{_datadir}/gir-1.0/NMGtk-1.0.gir
 
 %changelog
+#- applet: load VPN plugins preferably from absolute paths
+
 * Thu Jun 12 2014 Jiří Klimeš <jklimes at redhat.com> - 0.9.9.0-10.git20140123
 - applet: fix displaying connection information for VPN (rh #1099489)
 - broadband: fix crash when ModemManager is not available (rh #1089765)


More information about the scm-commits mailing list