diff options
author | Alessio Vanni <vannilla@firemail.cc> | 2020-07-15 17:21:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-15 20:14:25 +0200 |
commit | 9bb2c1e3183bbdd6554fe51c0b0a3e90022b77e1 (patch) | |
tree | 00da61b118d8a051cfef1356ea399275d0088403 | |
parent | 0f2ac01f3d935435f9fa0e3d1fb7e038fb0c19fa (diff) | |
download | gnunet-9bb2c1e3183bbdd6554fe51c0b0a3e90022b77e1.tar.gz gnunet-9bb2c1e3183bbdd6554fe51c0b0a3e90022b77e1.zip |
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>
-rw-r--r-- | src/gnsrecord/gnsrecord.c | 16 |
1 files changed, 16 insertions, 0 deletions
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 () | |||
102 | if (1 == once) | 102 | if (1 == once) |
103 | return; | 103 | return; |
104 | once = 1; | 104 | once = 1; |
105 | struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); | ||
106 | struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); | ||
107 | |||
108 | if (pd != dpd) | ||
109 | GNUNET_OS_init(dpd); | ||
105 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL, | 110 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL, |
106 | &add_plugin, NULL); | 111 | &add_plugin, NULL); |
112 | if (pd != dpd) | ||
113 | GNUNET_OS_init(pd); | ||
107 | } | 114 | } |
108 | 115 | ||
109 | 116 | ||
@@ -114,6 +121,11 @@ void __attribute__ ((destructor)) | |||
114 | GNSRECORD_fini () | 121 | GNSRECORD_fini () |
115 | { | 122 | { |
116 | struct Plugin *plugin; | 123 | struct Plugin *plugin; |
124 | struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); | ||
125 | struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); | ||
126 | |||
127 | if (pd != dpd) | ||
128 | GNUNET_OS_init(dpd); | ||
117 | 129 | ||
118 | for (unsigned int i = 0; i < num_plugins; i++) | 130 | for (unsigned int i = 0; i < num_plugins; i++) |
119 | { | 131 | { |
@@ -125,6 +137,10 @@ GNSRECORD_fini () | |||
125 | GNUNET_free (plugin); | 137 | GNUNET_free (plugin); |
126 | } | 138 | } |
127 | GNUNET_free (gns_plugins); | 139 | GNUNET_free (gns_plugins); |
140 | |||
141 | if (pd != dpd) | ||
142 | GNUNET_OS_init(dpd); | ||
143 | |||
128 | gns_plugins = NULL; | 144 | gns_plugins = NULL; |
129 | once = 0; | 145 | once = 0; |
130 | num_plugins = 0; | 146 | num_plugins = 0; |