merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 9c2538f8616827491d1296305c18f6413bf18bde
parent a3daea66496095ad184a19a534d9f659858691ad
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Wed, 22 Jun 2016 20:14:59 +0200

checking if default instance is given

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 23+++++++++++++++++++----
Msrc/backend/taler-merchant-httpd.h | 6++++--
2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c @@ -471,10 +471,10 @@ instances_iterator_cb (void *cls, char *substr; char *token; struct MerchantInstance *mi; - struct GNUNET_CONFIGURATION_Handle *config; + struct IterateInstancesCls *iic; struct GNUNET_CRYPTO_EddsaPrivateKey *pk; - config = cls; + iic = cls; substr = strstr (section, "merchant-instance-"); if (NULL == substr) @@ -496,7 +496,7 @@ instances_iterator_cb (void *cls, mi = GNUNET_new (struct MerchantInstance); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (config, + GNUNET_CONFIGURATION_get_value_filename (iic->config, section, "KEYFILE", &mi->keyfile)) @@ -526,9 +526,13 @@ instances_iterator_cb (void *cls, /** To free or not to free **/ mi->id = token + 1; + if (0 == strcmp ("default", mi->id)) + iic->default_instance = GNUNET_YES; + /** - * Fill 'id' + * TODO + * * Fill wirething * Check if 'default' given */ @@ -572,6 +576,17 @@ iterate_instances (const struct GNUNET_CONFIGURATION_Handle *config, &instances_iterator_cb, (void *) iic); + if (GNUNET_NO == iic->default_instance) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No default merchant instance found\n"); + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; + } + else + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Congratulations, you have a default instance\n"); + GNUNET_free (lib_name); GNUNET_free (iic); return GNUNET_OK; diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h @@ -64,9 +64,11 @@ struct IterateInstancesCls { struct MerchantInstance { /** - * Instance's mnemonic identifier + * Instance's mnemonic identifier. This value lives as long as + * the configuration is kept in memory, as it's as substring of + * a section name */ - char *id; + const char *id; /** * File holding the merchant's private key