challenger

OAuth 2.0-based authentication service that validates user can receive messages at a certain address
Log | Files | Refs | Submodules | README | LICENSE

commit 2ed440fe100395fd85d5af7a7b824db103af8653
parent 69fd977733bc07909553f6710a06b515f1e65674
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 15 Nov 2024 11:17:07 +0100

adapt to latest GNUnet API

Diffstat:
Msrc/challenger/challenger-admin.c | 8++------
Msrc/challenger/challenger-httpd.c | 8++------
Msrc/challenger/challenger-httpd_spa.c | 4+++-
Msrc/challengerdb/challenger-dbinit.c | 8++------
Msrc/challengerdb/challenger_db_plugin.c | 75+++------------------------------------------------------------------------
Msrc/include/challenger_util.h | 4++--
Msrc/util/os_installation.c | 16+---------------
7 files changed, 15 insertions(+), 108 deletions(-)

diff --git a/src/challenger/challenger-admin.c b/src/challenger/challenger-admin.c @@ -253,12 +253,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* FIRST get the libtalerutil initialization out - of the way. Then throw that one away, and force - the CHALLENGER defaults to be used! */ - (void) TALER_project_data_default (); - GNUNET_OS_init (CHALLENGER_project_data_default ()); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (CHALLENGER_project_data (), + argc, argv, "challenger-admin CLIENT_REDIRECT_URI", "Tool to add, modify or remove clients from challenger", options, diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c @@ -734,12 +734,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* FIRST get the libtalerutil initialization out - of the way. Then throw that one away, and force - the CHALLENGER defaults to be used! */ - (void) TALER_project_data_default (); - GNUNET_OS_init (CHALLENGER_project_data_default ()); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (CHALLENGER_project_data (), + argc, argv, "challenger-httpd", "challenger REST and OAuth 2.0 API", options, diff --git a/src/challenger/challenger-httpd_spa.c b/src/challenger/challenger-httpd_spa.c @@ -24,6 +24,7 @@ #include <taler/taler_util.h> #include <taler/taler_mhd_lib.h> #include <gnunet/gnunet_mhd_compat.h> +#include "challenger_util.h" #include "challenger-httpd_spa.h" @@ -307,7 +308,8 @@ CH_spa_init () { char *path; - path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); + path = GNUNET_OS_installation_get_path (CHALLENGER_project_data (), + GNUNET_OS_IPK_DATADIR); if (NULL == path) { GNUNET_break (0); diff --git a/src/challengerdb/challenger-dbinit.c b/src/challengerdb/challenger-dbinit.c @@ -126,12 +126,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* FIRST get the libtalerutil initialization out - of the way. Then throw that one away, and force - the CHALLENGER defaults to be used! */ - (void) TALER_project_data_default (); - GNUNET_OS_init (CHALLENGER_project_data_default ()); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (CHALLENGER_project_data (), + argc, argv, "challenger-dbinit", "Initialize challenger database", options, diff --git a/src/challengerdb/challenger_db_plugin.c b/src/challengerdb/challenger_db_plugin.c @@ -20,6 +20,7 @@ * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ #include "platform.h" +#include "challenger_util.h" #include "challenger_database_lib.h" #include <ltdl.h> @@ -47,7 +48,8 @@ CHALLENGER_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg, "libchallenger_plugin_db_%s", plugin_name); GNUNET_free (plugin_name); - plugin = GNUNET_PLUGIN_load (lib_name, + plugin = GNUNET_PLUGIN_load (CHALLENGER_project_data (), + lib_name, (void *) cfg); if (NULL != plugin) plugin->library_name = lib_name; @@ -80,75 +82,4 @@ CHALLENGER_DB_plugin_unload (struct CHALLENGER_DatabasePlugin *plugin) } -/** - * Libtool search path before we started. - */ -static char *old_dlsearchpath; - - -/** - * Setup libtool paths. - */ -void __attribute__ ((constructor)) -plugin_init (void); - -/* Declaration to avoid compiler warnings */ -void __attribute__ ((constructor)) -plugin_init () -{ - int err; - const char *opath; - char *path; - char *cpath; - - err = lt_dlinit (); - if (err > 0) - { - fprintf (stderr, - "Initialization of plugin mechanism failed: %s!\n", - lt_dlerror ()); - return; - } - opath = lt_dlgetsearchpath (); - if (NULL != opath) - old_dlsearchpath = GNUNET_strdup (opath); - path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); - if (NULL != path) - { - if (NULL != opath) - { - GNUNET_asprintf (&cpath, "%s:%s", opath, path); - lt_dlsetsearchpath (cpath); - GNUNET_free (path); - GNUNET_free (cpath); - } - else - { - lt_dlsetsearchpath (path); - GNUNET_free (path); - } - } -} - - -/** - * Shutdown libtool. - */ -void __attribute__ ((destructor)) -plugin_fini (void); - -/* Declaration to avoid compiler warnings */ -void __attribute__ ((destructor)) -plugin_fini () -{ - lt_dlsetsearchpath (old_dlsearchpath); - if (NULL != old_dlsearchpath) - { - GNUNET_free (old_dlsearchpath); - old_dlsearchpath = NULL; - } - lt_dlexit (); -} - - /* end of challenger_db_plugin.c */ diff --git a/src/include/challenger_util.h b/src/include/challenger_util.h @@ -24,12 +24,12 @@ #include <gnunet/gnunet_util_lib.h> /** - * Return default project data used by Challenger. + * Return project data used by Challenger. * * @return project data for challenger */ const struct GNUNET_OS_ProjectData * -CHALLENGER_project_data_default (void); +CHALLENGER_project_data (void); #endif diff --git a/src/util/os_installation.c b/src/util/os_installation.c @@ -49,24 +49,10 @@ static const struct GNUNET_OS_ProjectData challenger_pd = { const struct GNUNET_OS_ProjectData * -CHALLENGER_project_data_default (void) +CHALLENGER_project_data (void) { return &challenger_pd; } -/** - * Initialize libchallengerutil. - */ -void __attribute__ ((constructor)) -CHALLENGER_OS_init (void); - -/* Declaration to avoid compiler warnings */ -void __attribute__ ((constructor)) -CHALLENGER_OS_init () -{ - GNUNET_OS_init (&challenger_pd); -} - - /* end of os_installation.c */