commit b0cabecca0e7a9f2992b40e88d855f1ccb4d7846
parent 51de308a2979e9247cd74d5a991395bc9c8b1498
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Thu, 23 Oct 2025 17:02:39 +0200
fix #10025
Diffstat:
1 file changed, 79 insertions(+), 5 deletions(-)
diff --git a/src/merchant-tools/taler-merchant-passwd.c b/src/merchant-tools/taler-merchant-passwd.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2023 Taler Systems SA
+ Copyright (C) 2023, 2025 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -113,10 +113,84 @@ run (void *cls,
}
break;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- fprintf (stderr,
- "Instance `%s' unknown, cannot reset token\n",
- instance);
- global_ret = 2;
+ if (0 ==
+ strcmp (instance,
+ "admin"))
+ {
+ struct TALER_MerchantPrivateKeyP merchant_priv;
+ struct TALER_MerchantPublicKeyP merchant_pub;
+ struct TALER_MERCHANTDB_InstanceSettings is = {
+ .id = "admin",
+ .name = "Administrator",
+ .use_stefan = true,
+ .address = json_object (),
+ .jurisdiction = json_object (),
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (config,
+ "merchant",
+ "DEFAULT_WIRE_TRANSFER_DELAY",
+ &is.default_wire_transfer_delay)
+ )
+ {
+ is.default_wire_transfer_delay = GNUNET_TIME_UNIT_MONTHS;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (config,
+ "merchant",
+ "DEFAULT_PAY_DELAY",
+ &is.default_pay_delay))
+ {
+ is.default_pay_delay = GNUNET_TIME_UNIT_DAYS;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (config,
+ "merchant",
+ "DEFAULT_REFUND_DELAY",
+ &is.default_refund_delay))
+ {
+ is.default_refund_delay = GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_DAYS,
+ 15);
+ }
+
+ GNUNET_CRYPTO_eddsa_key_create (&merchant_priv.eddsa_priv);
+ GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv.eddsa_priv,
+ &merchant_pub.eddsa_pub);
+ qs = plugin->insert_instance (plugin->cls,
+ &merchant_pub,
+ &merchant_priv,
+ &is,
+ &ias,
+ false);
+ json_decref (is.address);
+ json_decref (is.jurisdiction);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ fprintf (stderr,
+ "`%s' instance created with default settings\n",
+ instance);
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_break (0);
+ break;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ fprintf (stderr,
+ "Internal database error.\n");
+ global_ret = 3;
+ break;
+ }
+ }
+ else
+ {
+ fprintf (stderr,
+ "Instance `%s' unknown, cannot reset token\n",
+ instance);
+ global_ret = 2;
+ }
break;
case GNUNET_DB_STATUS_SOFT_ERROR:
case GNUNET_DB_STATUS_HARD_ERROR: