gchar *seat_path;
} TlmSeatWatchClosure;
+static gchar*
+_g_module_build_path (const gchar *directory,
+ const gchar *module_name)
+{
+ if (directory && *directory) {
+ if (strncmp (module_name, "lib", 3) == 0)
+ return g_strconcat (directory, "/", module_name, NULL);
+ else
+ return g_strconcat (directory, "/lib", module_name, ".so", NULL);
+ } else if (strncmp (module_name, "lib", 3) == 0)
+ return g_strdup (module_name);
+ else
+ return g_strconcat ("lib", module_name, ".so", NULL);
+}
+
static void
_unref_auth_plugins (gpointer data)
{
{
GObjectClass *g_klass = G_OBJECT_CLASS (klass);
- g_klass->constructor = tlm_manager_constructor;
+ g_klass->constructor = tlm_manager_constructor;
g_klass->dispose = tlm_manager_dispose ;
g_klass->finalize = tlm_manager_finalize;
g_klass->set_property = _manager_set_property;
}
static GObject *
-_load_plugin_file (const gchar *file_path,
+_load_plugin_file (const gchar *file_path,
const gchar *plugin_name,
const gchar *plugin_type,
GHashTable *config)
accounts_config = tlm_config_get_group (self->priv->config, name);
plugin_file_name = g_strdup_printf ("libtlm-plugin-%s", name);
- plugin_file = g_module_build_path(plugins_path, plugin_file_name);
+ plugin_file = _g_module_build_path(plugins_path, plugin_file_name);
g_free (plugin_file_name);
self->priv->account_plugin = TLM_ACCOUNT_PLUGIN(
GError *error = NULL;
plugins_path = _get_plugins_path ();
-
+
DBG("plugins_path : %s", plugins_path);
plugins_dir = g_dir_open (plugins_path, 0, &error);
if (!plugins_dir) {
gchar *plugin_name = NULL;
GHashTable *plugin_config = NULL;
GObject *plugin = NULL;
-
- plugin_file_path = g_module_build_path(plugins_path,
+
+ plugin_file_path = _g_module_build_path(plugins_path,
plugin_file_name);
- if (!g_file_test (plugin_file_path,
+ if (!g_file_test (plugin_file_path,
G_FILE_TEST_IS_REGULAR && G_FILE_TEST_EXISTS)) {
WARN ("Ingnoring plugin : %s", plugin_file_path);
g_free (plugin_file_path);
}
DBG ("loading auth plugin '%s'", plugin_file_name);
-
+
plugin_name = g_strdup (plugin_file_name + 14); // truncate prefix
plugin_name[strlen(plugin_name) - 3] = '\0' ; // truncate suffix
plugin_config = tlm_config_get_group (self->priv->config,
plugin_name);
-
+
plugin = _load_plugin_file (plugin_file_path,
- plugin_name,
+ plugin_name,
"auth",
plugin_config);
if (plugin) {
g_hash_table_remove (manager->priv->seats, id);
g_signal_emit (manager, signals[SIG_SEAT_REMOVED], 0, id, NULL);
- }
+ }
g_free (id);
g_free (path);
}
manager->priv->account_plugin, user_name, FALSE);
}
else {
- DBG("Asking plugin to setup guest user '%s'", user_name);
+ DBG("Asking plugin to setup guest user '%s'", user_name);
return tlm_account_plugin_setup_guest_user_account (
manager->priv->account_plugin, user_name);
}