[gnome-control-center] network: use VPN plugin paths as specified in the .name files



commit 675ac22c443bfbdd9d062664c8aca2b79f0bda4b
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue May 20 15:29:24 2014 +0200

    network: use VPN plugin paths as specified in the .name files
    
    Since LIBDIR of gnome-control-center 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.
    
    Patch from Debian package, by Michael Biebl <biebl debian org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764509

 panels/network/connection-editor/vpn-helpers.c |   29 ++++++++++++++----------
 1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/panels/network/connection-editor/vpn-helpers.c b/panels/network/connection-editor/vpn-helpers.c
index 7dc23c2..b000a7e 100644
--- a/panels/network/connection-editor/vpn-helpers.c
+++ b/panels/network/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_build_filename (NM_VPN_MODULE_DIR, so_name, NULL);
-               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, G_IO_ERROR, G_IO_ERROR_FAILED, "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_build_filename (NM_VPN_MODULE_DIR, so_name, NULL);
+                       g_free (so_name);
+
+                       module = g_module_open (so_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+                       if (!module) {
+                               g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "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)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]