[network-manager-applet/nma-0-9-8] Use the paths specified in the VPN .name files



commit b9a852249a9e22dff32d729976bf389fb864ac92
Author: Michael Biebl <biebl debian org>
Date:   Tue Apr 1 20:10:16 2014 +0200

    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

 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 caf1626..d6b2be7 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -215,7 +215,7 @@ find_auth_dialog_binary (const char *service, GError **error)
                             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)) {


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