Remove plugin path from commandline parameters to plugin loader
authorAlexander Kanavin <alexander.kanavin@intel.com>
Thu, 6 Feb 2014 17:19:33 +0000 (19:19 +0200)
committerAlexander Kanavin <alexander.kanavin@intel.com>
Thu, 6 Feb 2014 17:19:33 +0000 (19:19 +0200)
src/daemon/plugins/Makefile.am
src/daemon/plugins/gsignond-plugin-remote.c
src/gplugind/Makefile.am
src/gplugind/gsignond-plugin-daemon.c
src/gplugind/main.c

index 2b3e85c..66b08ea 100644 (file)
@@ -8,7 +8,6 @@ libgsignond_plugins_la_CPPFLAGS = \
     -I$(top_srcdir)/include \
     -I$(top_builddir)/src \
     -DGSIGNOND_PLUGINLOADERS_DIR='"$(pluginloadersdir)"' \
-    -DGSIGNOND_GPLUGINS_DIR='"$(gpluginsdir)"' \
     $(GSIGNOND_CFLAGS)
 
 libgsignond_plugins_la_LIBADD =    \
index bc12063..11f5399 100644 (file)
@@ -563,15 +563,11 @@ gsignond_plugin_remote_new (
     GSignondPipeStream *stream = NULL;
     gboolean ret = FALSE;
     const gchar *bin_path = GSIGNOND_PLUGINLOADERS_DIR;
-    const gchar *plugin_path = GSIGNOND_GPLUGINS_DIR;
 
 #   ifdef ENABLE_DEBUG
     const gchar *env_val = g_getenv("SSO_BIN_DIR");
     if (env_val)
         bin_path = env_val;
-    env_val = g_getenv("SSO_GPLUGINS_DIR");
-    if (env_val)
-        plugin_path = env_val;
 #   endif
 
     /* This guarantees that writes to a pipe will never cause
@@ -580,10 +576,9 @@ gsignond_plugin_remote_new (
     signal(SIGPIPE, SIG_IGN);
 
     /* Spawn child process */
-    argv = g_malloc0 ((3 + 1) * sizeof (gchar *));
+    argv = g_malloc0 ((2 + 1) * sizeof (gchar *));
     argv[0] = g_build_filename (bin_path, GSIGNOND_PLUGIND_NAME, NULL);
-    argv[1] = g_module_build_path (plugin_path, plugin_type);
-    argv[2] = g_strdup(plugin_type);
+    argv[1] = g_strdup(plugin_type);
     ret = g_spawn_async_with_pipes (NULL, argv, NULL,
             G_SPAWN_DO_NOT_REAP_CHILD, NULL,
             NULL, &cpid, &cin_fd, &cout_fd, NULL, &error);
index 8179ce0..2de7052 100644 (file)
@@ -31,6 +31,7 @@ gsignond_plugind_CFLAGS = \
     -I$(top_builddir) \
     -I$(top_srcdir)/include/ \
     -I$(top_srcdir)/src/ \
+    -DGSIGNOND_GPLUGINS_DIR='"$(gpluginsdir)"' \
     $(GSIGNOND_CFLAGS) \
     $(NULL)
 
index 6629499..ea9f9eb 100644 (file)
@@ -355,7 +355,7 @@ gsignond_plugin_daemon_new (
 
     /* Load plugin */
     daemon->priv->plugin = gsignond_load_plugin_with_filename (
-            (gchar *)plugin_type, (gchar *)filename);
+            (gchar *)plugin_type, (gchar*)filename);
     if (!daemon->priv->plugin) {
         DBG ("failed to load plugin");
         g_object_unref (daemon);
index f3a83d3..cc01a0d 100644 (file)
@@ -130,7 +130,7 @@ int main (int argc, char **argv)
     g_type_init ();
 #endif
 
-    opt_context = g_option_context_new ("<plugin_path> <plugin_name>");
+    opt_context = g_option_context_new ("<plugin_name>");
     g_option_context_set_summary (opt_context, "gSSO helper plugin daemon");
     g_option_context_add_main_entries (opt_context, opt_entries, NULL);
     g_option_context_set_ignore_unknown_options (opt_context, TRUE);
@@ -140,13 +140,21 @@ int main (int argc, char **argv)
         WARN ("Error in arguments parsing: %s", error->message);
         g_error_free (error);
     }
-    if (!plugin_args || !plugin_args[0] || !plugin_args[1]) {
-        WARN ("plugin path or plugin type missing");
+    if (!plugin_args || !plugin_args[0] ) {
+        WARN ("plugin type missing");
         if (plugin_args) g_strfreev(plugin_args);
         return -1;
     }
 
-    _daemon = gsignond_plugin_daemon_new (plugin_args[0], plugin_args[1], in_fd,
+    const gchar *plugin_path = GSIGNOND_GPLUGINS_DIR;
+#   ifdef ENABLE_DEBUG
+    const gchar *env_val = g_getenv("SSO_GPLUGINS_DIR");
+    if (env_val)
+        plugin_path = env_val;
+#endif
+    gchar* filename = g_module_build_path (plugin_path, plugin_args[0]);
+
+    _daemon = gsignond_plugin_daemon_new (filename, plugin_args[0], in_fd,
             out_fd);
     g_strfreev(plugin_args);
     if (_daemon == NULL) {