commit 9bb2c1e3183bbdd6554fe51c0b0a3e90022b77e1
parent 0f2ac01f3d935435f9fa0e3d1fb7e038fb0c19fa
Author: Alessio Vanni <vannilla@firemail.cc>
Date: Wed, 15 Jul 2020 17:21:39 +0200
Load GNSRECORD plugins within GNUnet's context
When applications set a new project data structure using `GNUNET_OS_init', the
plugin loader will look into a different path for plugins, instead of using
GNUnet's installation path.
Since applications don't normally come with the default DNS/GNS plugins for
GNSRECORD, the consequence is that GNSRECORD will always fail when operating
on a record from GNS.
Signed-off-by: Christian Grothoff <christian@grothoff.org>
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c
@@ -102,8 +102,15 @@ init ()
if (1 == once)
return;
once = 1;
+ struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
+ struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
+
+ if (pd != dpd)
+ GNUNET_OS_init(dpd);
GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL,
&add_plugin, NULL);
+ if (pd != dpd)
+ GNUNET_OS_init(pd);
}
@@ -114,6 +121,11 @@ void __attribute__ ((destructor))
GNSRECORD_fini ()
{
struct Plugin *plugin;
+ struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
+ struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
+
+ if (pd != dpd)
+ GNUNET_OS_init(dpd);
for (unsigned int i = 0; i < num_plugins; i++)
{
@@ -125,6 +137,10 @@ GNSRECORD_fini ()
GNUNET_free (plugin);
}
GNUNET_free (gns_plugins);
+
+ if (pd != dpd)
+ GNUNET_OS_init(dpd);
+
gns_plugins = NULL;
once = 0;
num_plugins = 0;