summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-01-31 15:13:43 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2019-01-31 15:13:43 +0100
commitdbffac740680e26e6a310ec7100e6bc0ae45af61 (patch)
tree7c43ca8f847fa78969f2bb9796bb551e492568f1 /src
parentd2ad8e7990975509a95471ca6f83c32e714df70b (diff)
downloadmerchant-dbffac740680e26e6a310ec7100e6bc0ae45af61.tar.gz
merchant-dbffac740680e26e6a310ec7100e6bc0ae45af61.tar.bz2
merchant-dbffac740680e26e6a310ec7100e6bc0ae45af61.zip
Proposal logic.
Checking if the instance(s) given by the frontend when it creates the proposal are the same.
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.c4
-rw-r--r--src/backend/taler-merchant-httpd_proposal.c14
2 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 44937fdc..1eb39261 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1052,7 +1052,9 @@ TMH_lookup_instance (const char *name)
/**
- * Extract merchant instance from the given JSON
+ * Extract merchant instance from the given JSON; if not
+ * 'instance' field was found, then "default" instance is
+ * returned.
*
* @param json the JSON to inspect; it is not required to
* comply with any particular format. It will only be checked
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c
index 0ce99287..b2dc610f 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -447,6 +447,20 @@ proposal_put (struct MHD_Connection *connection,
}
mi = TMH_lookup_instance_json (merchant);
+
+ /* The outer instance field, and the one included
+ * in the merchant object are different */
+ if (0 != strcmp (mi->id,
+ instance))
+ {
+ TALER_LOG_ERROR
+ ("Inconsistent instance specified by merchant\n");
+ return TMH_RESPONSE_reply_not_found
+ (connection,
+ TALER_EC_CONTRACT_INSTANCE_INCONSISTENT,
+ "Inconsistent instance given");
+ }
+
if (NULL == mi)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,