[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 01/03: fix: should calculate contract hash when was not
From: |
gnunet |
Subject: |
[taler-merchant] 01/03: fix: should calculate contract hash when was not send as req param |
Date: |
Wed, 11 May 2022 20:51:23 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository merchant.
commit 4b77ed9f39cd0512735dee9f4f9daeb80f4c1f97
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed May 11 15:47:00 2022 -0300
fix: should calculate contract hash when was not send as req param
used in lookup_refunds_detailed
---
src/backend/taler-merchant-httpd_get-orders-ID.c | 64 ++++++++++++++++--------
1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index c563f7c2..1cc0098d 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -1052,33 +1052,53 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
/* Check if client provided the right hash code of the contract terms */
if (NULL != god->contract_terms)
{
- struct TALER_PrivateContractHashP h;
-
contract_available = true;
- if (GNUNET_OK !=
- TALER_JSON_contract_hash (god->contract_terms,
- &h))
+
+ if (GNUNET_YES == GNUNET_is_zero (&god->h_contract_terms))
{
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
-
TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
- "contract terms");
+
+ if (GNUNET_OK !=
+ TALER_JSON_contract_hash (god->contract_terms,
+ &god->h_contract_terms))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+
TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
+ "contract terms");
+ }
+
}
- contract_match = (0 ==
- GNUNET_memcmp (&h,
- &god->h_contract_terms));
- if ( (GNUNET_NO ==
- GNUNET_is_zero (&god->h_contract_terms)) &&
- (! contract_match) )
+ else
{
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER,
- NULL);
+
+ struct TALER_PrivateContractHashP h;
+
+ if (GNUNET_OK !=
+ TALER_JSON_contract_hash (god->contract_terms,
+ &h))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+
TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
+ "contract terms");
+ }
+ contract_match = (0 ==
+ GNUNET_memcmp (&h,
+ &god->h_contract_terms));
+ if ( !contract_match )
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER,
+ NULL);
+ }
+
}
+
}
if (contract_available)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.