aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-05 14:21:53 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-05 14:21:53 +0100
commitdc742246151fa5a0fa3f2150e130d5122008cfae (patch)
tree0d7356fc25bd8a6660235cc5b557505a634b2a82 /src/util
parent7679c951c82f5fe1bb5025c483fe0ad7b7e8c54c (diff)
downloadexchange-dc742246151fa5a0fa3f2150e130d5122008cfae.tar.xz
add option -s to the CS secmod helper for DONAU to use a different path
Diffstat (limited to 'src/util')
-rw-r--r--src/util/crypto_helper_cs.c14
-rw-r--r--src/util/taler-exchange-secmod-cs.c22
-rw-r--r--src/util/test_helper_cs.c2
3 files changed, 33 insertions, 5 deletions
diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c
index dae0b6fc6..ac41f52c6 100644
--- a/src/util/crypto_helper_cs.c
+++ b/src/util/crypto_helper_cs.c
@@ -113,21 +113,27 @@ try_connect (struct TALER_CRYPTO_CsDenominationHelper *dh)
struct TALER_CRYPTO_CsDenominationHelper *
TALER_CRYPTO_helper_cs_connect (
const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
TALER_CRYPTO_CsDenominationKeyStatusCallback dkc,
void *dkc_cls)
{
struct TALER_CRYPTO_CsDenominationHelper *dh;
char *unixpath;
+ char *secname;
+ GNUNET_asprintf (&secname,
+ "%s-exchange-secmod-cs",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
- "taler-exchange-secmod-cs",
+ secname,
"UNIXPATH",
&unixpath))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"UNIXPATH");
+ GNUNET_free (secname);
return NULL;
}
/* we use >= here because we want the sun_path to always
@@ -135,12 +141,14 @@ TALER_CRYPTO_helper_cs_connect (
if (strlen (unixpath) >= sizeof (dh->sa.sun_path))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"UNIXPATH",
"path too long");
GNUNET_free (unixpath);
+ GNUNET_free (secname);
return NULL;
}
+ GNUNET_free (secname);
dh = GNUNET_new (struct TALER_CRYPTO_CsDenominationHelper);
dh->dkc = dkc;
dh->dkc_cls = dkc_cls;
diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c
index a9696ee84..89d1462f2 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -341,6 +341,13 @@ static struct GNUNET_TIME_Timestamp now_tmp;
static char *keydir;
/**
+ * Name of the configuration section prefix to use. Usually either "taler" or
+ * "donau". The actual configuration section will then be
+ * "$SECTION-exchange-secmod-cs".
+ */
+static const char *section = "taler";
+
+/**
* How much should coin creation (@e duration_withdraw) duration overlap
* with the next denomination? Basically, the starting time of two
* denominations is always @e duration_withdraw - #overlap_duration apart.
@@ -2157,6 +2164,7 @@ run (void *cls,
.updater = &cs_update_client_keys,
.init = &cs_client_init
};
+ char *secname;
(void) cls;
(void) args;
@@ -2171,18 +2179,23 @@ run (void *cls,
/* get current time again, we may be timetraveling! */
now = GNUNET_TIME_timestamp_get ();
}
+ GNUNET_asprintf (&secname,
+ "%s-exchange-secmod-cs",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
- "taler-exchange-secmod-cs",
+ secname,
"KEY_DIR",
&keydir))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"KEY_DIR");
+ GNUNET_free (secname);
global_ret = EXIT_NOTCONFIGURED;
return;
}
+ GNUNET_free (secname);
if (GNUNET_OK !=
load_durations (cfg))
{
@@ -2264,6 +2277,11 @@ main (int argc,
char **argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_option_string ('s',
+ "section",
+ "SECTION",
+ "name of the configuration section prefix to use, default is 'taler'",
+ &section),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_option_timestamp ('t',
diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c
index 2292cbfd1..07e9907b4 100644
--- a/src/util/test_helper_cs.c
+++ b/src/util/test_helper_cs.c
@@ -970,6 +970,7 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
int ret;
dh = TALER_CRYPTO_helper_cs_connect (cfg,
+ "taler",
&key_cb,
NULL);
GNUNET_assert (NULL != dh);
@@ -1027,6 +1028,7 @@ run_test (void)
nanosleep (&req,
NULL);
dh = TALER_CRYPTO_helper_cs_connect (cfg,
+ "taler",
&key_cb,
NULL);
if (NULL != dh)