>From 998126274cca69b87dd58d04d7b62514d121e496 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Wed, 15 Jul 2020 17:21:39 +0200 Subject: [PATCH] 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. --- src/gnsrecord/gnsrecord.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c index c6ebd7c29..3ce10473b 100644 --- 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; -- 2.26.2