diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-14 22:19:12 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-14 22:19:25 +0100 |
commit | 703ac1cb83b060951c731eaafa07efa3959d651f (patch) | |
tree | 0c31005167ef7a4ebe7caf66c4f77019b0cf31ad | |
parent | e564533855d8c0e4ea8d96b1f9cca5764ebd23a3 (diff) |
adaptations of taler-exchange to GNUnet fix #8962
57 files changed, 123 insertions, 192 deletions
diff --git a/src/auditor/taler-auditor-dbinit.c b/src/auditor/taler-auditor-dbinit.c index 311959a40..b9a964df4 100644 --- a/src/auditor/taler-auditor-dbinit.c +++ b/src/auditor/taler-auditor-dbinit.c @@ -140,11 +140,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-auditor-dbinit", gettext_noop ("Initialize Taler auditor database"), diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index a7864e98b..aa8ffa4e7 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -1211,18 +1211,20 @@ main (int argc, "after how long do connections timeout by default (in seconds)", &connection_timeout), GNUNET_GETOPT_option_help ( + TALER_EXCHANGE_project_data (), "HTTP server providing a RESTful API to access a Taler auditor"), GNUNET_GETOPT_option_version (VERSION "-" VCS_VERSION), GNUNET_GETOPT_OPTION_END }; int ret; - TALER_OS_init (); - ret = GNUNET_PROGRAM_run (argc, argv, - "taler-auditor-httpd", - "Taler auditor HTTP service", - options, - &run, NULL); + ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), + argc, argv, + "taler-auditor-httpd", + "Taler auditor HTTP service", + options, + &run, NULL); if (GNUNET_SYSERR == ret) return EXIT_INVALIDARGUMENT; if (GNUNET_NO == ret) diff --git a/src/auditor/taler-auditor-sync.c b/src/auditor/taler-auditor-sync.c index d7f45e384..56d3c725a 100644 --- a/src/auditor/taler-auditor-sync.c +++ b/src/auditor/taler-auditor-sync.c @@ -463,7 +463,7 @@ load_config (const char *cfgfile) { struct GNUNET_CONFIGURATION_Handle *cfg; - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading config file: %s\n", cfgfile); @@ -572,6 +572,7 @@ main (int argc, GNUNET_GETOPT_option_mandatory ( option_cfgfile_dst (&dst_cfgfile)), GNUNET_GETOPT_option_help ( + TALER_EXCHANGE_project_data (), gettext_noop ("Make a safe copy of an exchange database")), GNUNET_GETOPT_option_uint ( 'b', @@ -591,7 +592,6 @@ main (int argc, GNUNET_GETOPT_OPTION_END }; - TALER_OS_init (); TALER_gcrypt_init (); /* must trigger initialization manually at this point! */ { int ret; diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c index f88665b9a..2d2efa876 100644 --- a/src/auditor/taler-helper-auditor-aggregation.c +++ b/src/auditor/taler-helper-auditor-aggregation.c @@ -1660,11 +1660,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-aggregation", diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index 8654d802e..45a979a32 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c @@ -3125,11 +3125,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-coins", diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c index dbe20487c..991c9a69f 100644 --- a/src/auditor/taler-helper-auditor-deposits.c +++ b/src/auditor/taler-helper-auditor-deposits.c @@ -402,11 +402,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-deposits", diff --git a/src/auditor/taler-helper-auditor-purses.c b/src/auditor/taler-helper-auditor-purses.c index 2ad99aacf..260d81360 100644 --- a/src/auditor/taler-helper-auditor-purses.c +++ b/src/auditor/taler-helper-auditor-purses.c @@ -1588,11 +1588,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-purses", diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c index c51c63416..c4c7a543c 100644 --- a/src/auditor/taler-helper-auditor-reserves.c +++ b/src/auditor/taler-helper-auditor-reserves.c @@ -2125,11 +2125,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-reserves", diff --git a/src/auditor/taler-helper-auditor-transfer.c b/src/auditor/taler-helper-auditor-transfer.c index e2ab47ffa..2ababb2d4 100644 --- a/src/auditor/taler-helper-auditor-transfer.c +++ b/src/auditor/taler-helper-auditor-transfer.c @@ -532,11 +532,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-transfer", diff --git a/src/auditor/taler-helper-auditor-wire-credit.c b/src/auditor/taler-helper-auditor-wire-credit.c index d070b055f..0020df3e5 100644 --- a/src/auditor/taler-helper-auditor-wire-credit.c +++ b/src/auditor/taler-helper-auditor-wire-credit.c @@ -1214,11 +1214,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-wire-credit", diff --git a/src/auditor/taler-helper-auditor-wire-debit.c b/src/auditor/taler-helper-auditor-wire-debit.c index f9c5be5c4..dcef35150 100644 --- a/src/auditor/taler-helper-auditor-wire-debit.c +++ b/src/auditor/taler-helper-auditor-wire-debit.c @@ -1889,11 +1889,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-helper-auditor-wire-debit", diff --git a/src/auditordb/auditordb_plugin.c b/src/auditordb/auditordb_plugin.c index 7aaeabf7b..554628e9a 100644 --- a/src/auditordb/auditordb_plugin.c +++ b/src/auditordb/auditordb_plugin.c @@ -47,7 +47,8 @@ TALER_AUDITORDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg, "libtaler_plugin_auditordb_%s", plugin_name); GNUNET_free (plugin_name); - plugin = GNUNET_PLUGIN_load (lib_name, + plugin = GNUNET_PLUGIN_load (TALER_EXCHANGE_project_data (), + lib_name, (void *) cfg); if (NULL != plugin) plugin->library_name = lib_name; diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index c8583add8..2eb60fbb4 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c @@ -487,7 +487,6 @@ main (int argc, GNUNET_log_setup (argv[0], "WARNING", NULL); - TALER_OS_init (); if (NULL == (plugin_name = strrchr (argv[0], (int) '-'))) { @@ -500,7 +499,7 @@ main (int argc, plugin_name); (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/auditordb/test_auditordb_checkpoints.c b/src/auditordb/test_auditordb_checkpoints.c index bf7c6efb1..173864890 100644 --- a/src/auditordb/test_auditordb_checkpoints.c +++ b/src/auditordb/test_auditordb_checkpoints.c @@ -370,7 +370,6 @@ main (int argc, (void) argc; result = -1; - TALER_OS_init (); GNUNET_log_setup (argv[0], "INFO", NULL); @@ -387,7 +386,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c index 477bb750e..a28962c73 100644 --- a/src/bank-lib/taler-exchange-wire-gateway-client.c +++ b/src/bank-lib/taler-exchange-wire-gateway-client.c @@ -749,12 +749,9 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); global_ret = 1; ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-wire-gateway-client", gettext_noop ("Client tool of the Taler Wire Gateway"), diff --git a/src/bank-lib/taler-fakebank-run.c b/src/bank-lib/taler-fakebank-run.c index c15145ecb..0c6141c1e 100644 --- a/src/bank-lib/taler-fakebank-run.c +++ b/src/bank-lib/taler-fakebank-run.c @@ -235,7 +235,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue iret; - iret = GNUNET_PROGRAM_run (argc, argv, + iret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-fakebank-run", "Runs the fakebank", options, diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c index 5fb9d1412..79865907d 100644 --- a/src/benchmark/taler-aggregator-benchmark.c +++ b/src/benchmark/taler-aggregator-benchmark.c @@ -642,13 +642,15 @@ main (int argc, unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); if (0 >= - (result = GNUNET_PROGRAM_run (argc, - argv, - "taler-aggregator-benchmark", - "generate database to benchmark the aggregator", - options, - &run, - NULL))) + (result = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), + argc, + argv, + "taler-aggregator-benchmark", + "generate database to benchmark the aggregator", + options, + &run, + NULL))) { if (GNUNET_NO == result) return EXIT_SUCCESS; diff --git a/src/benchmark/taler-bank-benchmark.c b/src/benchmark/taler-bank-benchmark.c index 9d7bd3e83..a7ed78c9b 100644 --- a/src/benchmark/taler-bank-benchmark.c +++ b/src/benchmark/taler-bank-benchmark.c @@ -438,7 +438,8 @@ main (int argc, "fakebank", "we are using fakebank", &use_fakebank), - GNUNET_GETOPT_option_help ("taler-bank benchmark"), + GNUNET_GETOPT_option_help (TALER_EXCHANGE_project_data (), + "taler-bank benchmark"), GNUNET_GETOPT_option_string ('l', "logfile", "LF", @@ -493,7 +494,7 @@ main (int argc, GNUNET_log_setup ("taler-bank-benchmark", loglev, logfile); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_filename)) diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index db1fadd1f..fb171dfea 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -493,6 +493,7 @@ main (int argc, "should all reserves be created first, before starting normal operations", &reserves_first), GNUNET_GETOPT_option_help ( + TALER_EXCHANGE_project_data (), "Exchange benchmark"), GNUNET_GETOPT_option_string ( 'l', @@ -558,14 +559,15 @@ main (int argc, loglev, logfile); if (NULL == cfg_filename) - cfg_filename = GNUNET_CONFIGURATION_default_filename (); + cfg_filename = GNUNET_CONFIGURATION_default_filename ( + TALER_EXCHANGE_project_data ()); if (NULL == cfg_filename) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Can't find default configuration file.\n"); return EXIT_NOTCONFIGURED; } - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_filename)) diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c index 2eb4596b8..4ddbb8edf 100644 --- a/src/exchange-tools/taler-auditor-offline.c +++ b/src/exchange-tools/taler-auditor-offline.c @@ -1470,11 +1470,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-auditor-offline", gettext_noop ("Operations for offline signing for a Taler exchange"), diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c index bd2c8d541..942b81953 100644 --- a/src/exchange-tools/taler-exchange-dbinit.c +++ b/src/exchange-tools/taler-exchange-dbinit.c @@ -196,11 +196,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-dbinit", gettext_noop ("Initialize Taler exchange database"), diff --git a/src/exchange-tools/taler-exchange-kyc-trigger.c b/src/exchange-tools/taler-exchange-kyc-trigger.c index eab732894..f6ff70182 100644 --- a/src/exchange-tools/taler-exchange-kyc-trigger.c +++ b/src/exchange-tools/taler-exchange-kyc-trigger.c @@ -300,12 +300,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-kyc-trigger", gettext_noop ( diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c index 67a4e0de7..8d5512976 100644 --- a/src/exchange-tools/taler-exchange-offline.c +++ b/src/exchange-tools/taler-exchange-offline.c @@ -5477,12 +5477,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - (void) TALER_project_data_default (); - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-offline", gettext_noop ("Operations for offline signing for a Taler exchange"), diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index bc3a4e9b1..a155eab08 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -1322,8 +1322,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-aggregator", gettext_noop ( diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index a24f8387b..fa601a108 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -550,8 +550,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-closer", gettext_noop ("background process that closes expired reserves"), diff --git a/src/exchange/taler-exchange-drain.c b/src/exchange/taler-exchange-drain.c index 52de43be9..a351f6310 100644 --- a/src/exchange/taler-exchange-drain.c +++ b/src/exchange/taler-exchange-drain.c @@ -410,8 +410,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-drain", gettext_noop ( diff --git a/src/exchange/taler-exchange-expire.c b/src/exchange/taler-exchange-expire.c index 248e4d2d4..49d93b2b4 100644 --- a/src/exchange/taler-exchange-expire.c +++ b/src/exchange/taler-exchange-expire.c @@ -477,8 +477,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-expire", gettext_noop ( diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index b3a80efa7..ff462d68f 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -2885,17 +2885,19 @@ main (int argc, &input_filename), #endif GNUNET_GETOPT_option_help ( + TALER_EXCHANGE_project_data (), "HTTP server providing a RESTful API to access a Taler exchange"), GNUNET_GETOPT_OPTION_END }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); - ret = GNUNET_PROGRAM_run (argc, argv, - "taler-exchange-httpd", - "Taler exchange HTTP service", - options, - &run, NULL); + ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), + argc, argv, + "taler-exchange-httpd", + "Taler exchange HTTP service", + options, + &run, NULL); if (GNUNET_SYSERR == ret) return EXIT_INVALIDARGUMENT; if (GNUNET_NO == ret) diff --git a/src/exchange/taler-exchange-router.c b/src/exchange/taler-exchange-router.c index 306a0e1f6..a7dcec817 100644 --- a/src/exchange/taler-exchange-router.c +++ b/src/exchange/taler-exchange-router.c @@ -427,8 +427,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-router", gettext_noop ( diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c index 6726a46dd..697374149 100644 --- a/src/exchange/taler-exchange-transfer.c +++ b/src/exchange/taler-exchange-transfer.c @@ -896,8 +896,8 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-transfer", gettext_noop ( diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index c1f7f5d75..72545e916 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -1098,8 +1098,8 @@ main (int argc, enum GNUNET_GenericReturnValue ret; longpoll_timeout = LONGPOLL_TIMEOUT; - TALER_OS_init (); ret = GNUNET_PROGRAM_run ( + TALER_EXCHANGE_project_data (), argc, argv, "taler-exchange-wirewatch", gettext_noop ( diff --git a/src/exchangedb/bench_db.c b/src/exchangedb/bench_db.c index 302d23062..f0a7aafaa 100644 --- a/src/exchangedb/bench_db.c +++ b/src/exchangedb/bench_db.c @@ -38,7 +38,8 @@ static int result; * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (*ptr)) + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ + ptr)) static bool @@ -508,8 +509,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - TALER_OS_init (); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/exchangedb/exchangedb_plugin.c b/src/exchangedb/exchangedb_plugin.c index 747a2ad1b..84e68820b 100644 --- a/src/exchangedb/exchangedb_plugin.c +++ b/src/exchangedb/exchangedb_plugin.c @@ -47,7 +47,8 @@ TALER_EXCHANGEDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg, "libtaler_plugin_exchangedb_%s", plugin_name); GNUNET_free (plugin_name); - plugin = GNUNET_PLUGIN_load (lib_name, + plugin = GNUNET_PLUGIN_load (TALER_EXCHANGE_project_data (), + lib_name, (void *) cfg); if (NULL != plugin) plugin->library_name = lib_name; diff --git a/src/exchangedb/perf_deposits_get_ready.c b/src/exchangedb/perf_deposits_get_ready.c index 316f45e6c..dfb930899 100644 --- a/src/exchangedb/perf_deposits_get_ready.c +++ b/src/exchangedb/perf_deposits_get_ready.c @@ -546,7 +546,7 @@ main (int argc, testname); GNUNET_free (testname); } - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/exchangedb/perf_get_link_data.c b/src/exchangedb/perf_get_link_data.c index 4e00d0a0b..cd10180ef 100644 --- a/src/exchangedb/perf_get_link_data.c +++ b/src/exchangedb/perf_get_link_data.c @@ -523,7 +523,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/exchangedb/perf_reserves_in_insert.c b/src/exchangedb/perf_reserves_in_insert.c index 6e3837fc7..c193520fd 100644 --- a/src/exchangedb/perf_reserves_in_insert.c +++ b/src/exchangedb/perf_reserves_in_insert.c @@ -214,7 +214,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/exchangedb/perf_select_refunds_by_coin.c b/src/exchangedb/perf_select_refunds_by_coin.c index fc22652b6..6a663fd7c 100644 --- a/src/exchangedb/perf_select_refunds_by_coin.c +++ b/src/exchangedb/perf_select_refunds_by_coin.c @@ -600,7 +600,7 @@ main (int argc, testname); GNUNET_free (testname); } - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index b63a7ce8d..c8aa83d34 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -2492,7 +2492,6 @@ main (int argc, GNUNET_log_setup (argv[0], "INFO", NULL); - TALER_OS_init (); plugin_name++; (void) GNUNET_asprintf (&testname, "test-exchange-db-%s", @@ -2500,7 +2499,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, config_filename)) diff --git a/src/extensions/extensions.c b/src/extensions/extensions.c index f3222178b..be14e0f18 100644 --- a/src/extensions/extensions.c +++ b/src/extensions/extensions.c @@ -159,7 +159,7 @@ TALER_extensions_verify_manifests_signature ( } -/* +/** * Closure used in TALER_extensions_load_taler_config during call to * GNUNET_CONFIGURATION_iterate_sections with configure_extension. */ @@ -170,7 +170,7 @@ struct LoadConfClosure }; -/* +/** * Used in TALER_extensions_load_taler_config during call to * GNUNET_CONFIGURATION_iterate_sections to load the configuration * of supported extensions. @@ -208,7 +208,8 @@ configure_extension ( for (unsigned int i = 0; i < strlen (lib_name); i++) lib_name[i] = tolower (lib_name[i]); - extension = GNUNET_PLUGIN_load (lib_name, + extension = GNUNET_PLUGIN_load (TALER_EXCHANGE_project_data (), + lib_name, (void *) col->cfg); if (NULL == extension) { diff --git a/src/include/taler_util.h b/src/include/taler_util.h index 994e09544..fe09097cf 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -337,17 +337,10 @@ TALER_getopt_get_amount (char shortName, /** - * Return default project data used by Taler. + * Return default project data used by Taler exchange. */ const struct GNUNET_OS_ProjectData * -TALER_project_data_default (void); - - -/** - * Initialize libtalerutil. - */ -void -TALER_OS_init (void); +TALER_EXCHANGE_project_data (void); /** diff --git a/src/json/test_conversion.c b/src/json/test_conversion.c index e148927f5..0d2463d4d 100644 --- a/src/json/test_conversion.c +++ b/src/json/test_conversion.c @@ -147,7 +147,6 @@ main (int argc, GNUNET_log_setup ("test-conversion", "INFO", NULL); - GNUNET_OS_init (TALER_project_data_default ()); global_ret = 1; GNUNET_SCHEDULER_run (&run, NULL); diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c index 4f6bde9db..fd010deb3 100644 --- a/src/kyclogic/kyclogic_api.c +++ b/src/kyclogic/kyclogic_api.c @@ -1675,7 +1675,8 @@ load_logic (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_free (lib_name); return kyc_logics[i]; } - plugin = GNUNET_PLUGIN_load (lib_name, + plugin = GNUNET_PLUGIN_load (TALER_EXCHANGE_project_data (), + lib_name, (void *) cfg); if (NULL == plugin) { diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c index 33bc0eb0d..a178ec8af 100644 --- a/src/kyclogic/taler-exchange-kyc-tester.c +++ b/src/kyclogic/taler-exchange-kyc-tester.c @@ -1761,6 +1761,7 @@ main (int argc, { const struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_option_help ( + TALER_EXCHANGE_project_data (), "tool to test KYC provider integrations"), GNUNET_GETOPT_option_flag ( 'M', @@ -1830,11 +1831,11 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cmd_line_h_payto, sizeof (cmd_line_h_payto)); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-exchange-kyc-tester", "tool to test KYC provider integrations", options, diff --git a/src/mhd/mhd_spa.c b/src/mhd/mhd_spa.c index c4aff281d..dbad05f2d 100644 --- a/src/mhd/mhd_spa.c +++ b/src/mhd/mhd_spa.c @@ -310,7 +310,8 @@ TALER_MHD_spa_load (const char *dir) { char *path; - path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); + path = GNUNET_OS_installation_get_path (TALER_EXCHANGE_project_data (), + GNUNET_OS_IPK_DATADIR); if (NULL == path) { GNUNET_break (0); diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c index 88a17c682..59e028e31 100644 --- a/src/templating/templating_api.c +++ b/src/templating/templating_api.c @@ -481,7 +481,8 @@ TALER_TEMPLATING_init (const char *subsystem) { char *path; - path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); + path = GNUNET_OS_installation_get_path (TALER_EXCHANGE_project_data (), + GNUNET_OS_IPK_DATADIR); if (NULL == path) { GNUNET_break (0); diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c index b8e380df0..144a35afd 100644 --- a/src/testing/testing_api_misc.c +++ b/src/testing/testing_api_misc.c @@ -62,7 +62,7 @@ TALER_TESTING_get_credentials ( unsigned long long port; struct TALER_FullPayto exchange_payto_uri; - ua->cfg = GNUNET_CONFIGURATION_create (); + ua->cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (ua->cfg, cfg_file)) diff --git a/src/testing/testing_api_twister_helpers.c b/src/testing/testing_api_twister_helpers.c index d5f61e87c..18b5cd1bb 100644 --- a/src/testing/testing_api_twister_helpers.c +++ b/src/testing/testing_api_twister_helpers.c @@ -25,6 +25,7 @@ */ #include "platform.h" #include <gnunet/gnunet_util_lib.h> +#include <taler/taler_twister_service.h> #include "taler_twister_testing_lib.h" @@ -42,8 +43,7 @@ TALER_TWISTER_prepare_twister (const char *config_filename) unsigned long long port; char *base_url; - cfg = GNUNET_CONFIGURATION_create (); - + cfg = GNUNET_CONFIGURATION_create (TWISTER_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, config_filename)) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 9c9a76b22..a9e377af0 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -26,21 +26,17 @@ EXTRA_DIST = \ bin_PROGRAMS = \ taler-exchange-secmod-eddsa \ taler-exchange-secmod-rsa \ - taler-exchange-secmod-cs - -bin_SCRIPTS = \ + taler-exchange-secmod-cs \ taler-config -edit_script = $(SED) -e 's,%libdir%,$(libdir),'g $(NULL) +taler_config_SOURCES = \ + taler-config.c +taler_config_LDADD = \ + libtalerutil.la \ + -lgnunetutil \ + $(XLIB) -taler-config: taler-config.in - rm -f $@ $@.tmp && \ - $(edit_script) $< >$@.tmp && \ - chmod a-w+x $@.tmp && \ - mv $@.tmp $@ -CLEANFILES = \ - taler-config taler_exchange_secmod_rsa_SOURCES = \ taler-exchange-secmod-rsa.c taler-exchange-secmod-rsa.h \ diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 79beba51c..cce8ec171 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c @@ -49,23 +49,13 @@ static const struct GNUNET_OS_ProjectData taler_pd = { /** - * Return default project data used by Taler. + * Return default project data used by Taler exchange. */ const struct GNUNET_OS_ProjectData * -TALER_project_data_default (void) +TALER_EXCHANGE_project_data (void) { return &taler_pd; } -/** - * Initialize libtalerutil. - */ -void __attribute__ ((constructor)) -TALER_OS_init () -{ - GNUNET_OS_init (&taler_pd); -} - - /* end of os_installation.c */ diff --git a/src/util/taler-config.c b/src/util/taler-config.c index e4ff22767..1a1bfb38a 100644 --- a/src/util/taler-config.c +++ b/src/util/taler-config.c @@ -1,6 +1,6 @@ /* This file is part of Taler. - Copyright (C) 2012-2021 Taler Systems SA + Copyright (C) 2012-2024 Taler Systems SA Taler is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -17,14 +17,15 @@ SPDX-License-Identifier: AGPL3.0-or-later */ - +/* FIXME: probably should have separate tool for taler-merchant + and taler-exchange! */ /** * @file util/taler-config.c * @brief tool to access and manipulate Taler configuration files * @author Christian Grothoff */ #include "platform.h" -#include "taler_util_lib.h" +#include "taler_util.h" /** @@ -43,12 +44,16 @@ main (int argc, .global_ret = EXIT_SUCCESS }; struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_option_help (TALER_EXCHANGE_project_data (), + "taler-config [OPTIONS]"), + GNUNET_GETOPT_option_version (TALER_EXCHANGE_project_data ()->version), + GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), GNUNET_GETOPT_OPTION_END }; enum GNUNET_GenericReturnValue ret; - TALER_OS_init (); - ret = GNUNET_PROGRAM_run (argc, + ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-config [OPTIONS]", gettext_noop ( diff --git a/src/util/taler-config.in b/src/util/taler-config.in deleted file mode 100644 index 3399aec10..000000000 --- a/src/util/taler-config.in +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -if ! type gnunet-config >/dev/null; then - echo "$0 needs gnunet-config to be installed" - exit 1 -fi - -GC=$(which gnunet-config) -SO=$(ls %libdir%/libtalerutil.so.* | sort -n | tail -n1) -export LD_PRELOAD=${LD_PRELOAD:-}:${SO} -exec gnunet-config "$@" diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c index f69acd890..a2308507e 100644 --- a/src/util/taler-exchange-secmod-cs.c +++ b/src/util/taler-exchange-secmod-cs.c @@ -2321,14 +2321,11 @@ main (int argc, /* Restrict permissions for the key files that we create. */ (void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH); section = GNUNET_strdup ("taler-exchange"); - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); global_now_tmp = global_now = GNUNET_TIME_timestamp_get (); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-exchange-secmod-cs", "Handle private CS key operations for a Taler exchange", options, diff --git a/src/util/taler-exchange-secmod-eddsa.c b/src/util/taler-exchange-secmod-eddsa.c index 401ac5835..6b314d21c 100644 --- a/src/util/taler-exchange-secmod-eddsa.c +++ b/src/util/taler-exchange-secmod-eddsa.c @@ -1185,12 +1185,9 @@ main (int argc, /* Restrict permissions for the key files that we create. */ (void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH); section = GNUNET_strdup ("taler-exchange"); - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); now_tmp = now = GNUNET_TIME_timestamp_get (); - ret = GNUNET_PROGRAM_run (argc, + ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-exchange-secmod-eddsa", "Handle private EDDSA key operations for a Taler exchange", diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c index 6be78b20e..dac04c815 100644 --- a/src/util/taler-exchange-secmod-rsa.c +++ b/src/util/taler-exchange-secmod-rsa.c @@ -2113,14 +2113,11 @@ main (int argc, /* Restrict permissions for the key files that we create. */ (void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH); section = GNUNET_strdup ("taler-exchange"); - /* force linker to link against libtalerutil; if we do - not do this, the linker may "optimize" libtalerutil - away and skip #TALER_OS_init(), which we do need */ - TALER_OS_init (); global_now_tmp = global_now = GNUNET_TIME_timestamp_get (); - ret = GNUNET_PROGRAM_run (argc, argv, + ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), + argc, argv, "taler-exchange-secmod-rsa", "Handle private RSA key operations for a Taler exchange", options, diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c index 93562e459..49e598a47 100644 --- a/src/util/test_helper_cs.c +++ b/src/util/test_helper_cs.c @@ -1013,7 +1013,7 @@ run_test (void) }; int ret; - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, "test_helper_cs.conf")) @@ -1120,8 +1120,8 @@ main (int argc, GNUNET_log_setup ("test-helper-cs", loglev, NULL); - GNUNET_OS_init (TALER_project_data_default ()); - libexec_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); + libexec_dir = GNUNET_OS_installation_get_path (TALER_EXCHANGE_project_data (), + GNUNET_OS_IPK_BINDIR); GNUNET_asprintf (&binary_name, "%s/%s", libexec_dir, diff --git a/src/util/test_helper_eddsa.c b/src/util/test_helper_eddsa.c index 0119e4278..def46596a 100644 --- a/src/util/test_helper_eddsa.c +++ b/src/util/test_helper_eddsa.c @@ -412,7 +412,7 @@ run_test (void) .tv_nsec = 250000000 }; - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, "test_helper_eddsa.conf")) @@ -500,8 +500,8 @@ main (int argc, GNUNET_log_setup ("test-helper-eddsa", "INFO", NULL); - GNUNET_OS_init (TALER_project_data_default ()); - libexec_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); + libexec_dir = GNUNET_OS_installation_get_path (TALER_EXCHANGE_project_data (), + GNUNET_OS_IPK_BINDIR); GNUNET_asprintf (&binary_name, "%s/%s", libexec_dir, diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c index 2bc15879f..860a0cd1a 100644 --- a/src/util/test_helper_rsa.c +++ b/src/util/test_helper_rsa.c @@ -840,7 +840,7 @@ run_test (void) }; int ret; - cfg = GNUNET_CONFIGURATION_create (); + cfg = GNUNET_CONFIGURATION_create (TALER_EXCHANGE_project_data ()); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, "test_helper_rsa.conf")) @@ -945,8 +945,8 @@ main (int argc, GNUNET_log_setup ("test-helper-rsa", "WARNING", NULL); - GNUNET_OS_init (TALER_project_data_default ()); - libexec_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); + libexec_dir = GNUNET_OS_installation_get_path (TALER_EXCHANGE_project_data (), + GNUNET_OS_IPK_BINDIR); GNUNET_asprintf (&binary_name, "%s/%s", libexec_dir, |