summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-01 23:38:53 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-01 23:38:53 +0100
commitc9c8caea1a716d7246853e69b0148ffa3bee696d (patch)
treedada332f4e98df9eafe48b6ee7de4431d034c1ac /src/backend
parente1d16d11269a1fae896e200afd70e38d0040928d (diff)
downloadmerchant-c9c8caea1a716d7246853e69b0148ffa3bee696d.tar.gz
merchant-c9c8caea1a716d7246853e69b0148ffa3bee696d.tar.bz2
merchant-c9c8caea1a716d7246853e69b0148ffa3bee696d.zip
fix fTBFS
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c9
-rw-r--r--src/backend/taler-merchant-httpd.h7
-rw-r--r--src/backend/taler-merchant-httpd_helper.c33
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c4
-rw-r--r--src/backend/taler-merchant-httpd_post-tips-ID-pickup.c25
-rw-r--r--src/backend/taler-merchant-httpd_private-get-instances-ID.c8
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-instances-ID.c5
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c23
8 files changed, 48 insertions, 66 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 6f3dc784..749fc253 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -218,7 +218,7 @@ instance_decref (struct TMH_MerchantInstance *mi)
GNUNET_CONTAINER_DLL_remove (mi->wm_head,
mi->wm_tail,
wm);
- json_decref (wm->j_wire);
+ GNUNET_free (wm->payto_uri);
GNUNET_free (wm->wire_method);
GNUNET_free (wm);
}
@@ -1545,11 +1545,8 @@ add_instance_cb (void *cls,
wm = GNUNET_new (struct TMH_WireMethod);
wm->h_wire = acc->h_wire;
- wm->j_wire = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("payto_uri",
- acc->payto_uri),
- GNUNET_JSON_pack_data_auto ("salt",
- &acc->salt));
+ wm->payto_uri = GNUNET_strdup (acc->payto_uri);
+ wm->wire_salt = acc->salt;
wm->wire_method = TALER_payto_get_method (acc->payto_uri);
wm->active = acc->active;
GNUNET_CONTAINER_DLL_insert (mi->wm_head,
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index 1b18cdd4..91d83c53 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -58,7 +58,12 @@ struct TMH_WireMethod
/**
* Wire details for this instance
*/
- struct json_t *j_wire;
+ char *payto_uri;
+
+ /**
+ * Salt to use when computing @e h_wire from @e payto_uri.
+ */
+ struct TALER_WireSalt wire_salt;
/**
* Hash of our wire format details as given in #j_wire.
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
index f4129e0e..8c15a542 100644
--- a/src/backend/taler-merchant-httpd_helper.c
+++ b/src/backend/taler-merchant-httpd_helper.c
@@ -315,26 +315,29 @@ TMH_taxes_array_valid (const json_t *taxes)
struct TMH_WireMethod *
TMH_setup_wire_account (const char *payto_uri)
{
- struct TALER_WireSalt salt;
struct TMH_WireMethod *wm;
+ char *emsg;
+
+ if (NULL != (emsg = TALER_payto_validate (payto_uri)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Invalid URI `%s': %s\n",
+ payto_uri,
+ emsg);
+ GNUNET_free (emsg);
+ return NULL;
+ }
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
- &salt,
- sizeof (salt));
wm = GNUNET_new (struct TMH_WireMethod);
- wm->j_wire = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("payto_uri",
- payto_uri),
- GNUNET_JSON_pack_data_auto ("salt",
- &salt));
- GNUNET_assert (NULL != wm->j_wire);
- /* This also tests for things like the IBAN being malformed */
- GNUNET_assert (GNUNET_OK ==
- TALER_JSON_merchant_wire_signature_hash (wm->j_wire,
- &wm->h_wire));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
+ &wm->wire_salt,
+ sizeof (wm->wire_salt));
+ wm->payto_uri = GNUNET_strdup (payto_uri);
+ TALER_merchant_wire_signature_hash (payto_uri,
+ &wm->wire_salt,
+ &wm->h_wire);
wm->wire_method
= TALER_payto_get_method (payto_uri);
- GNUNET_assert (NULL != wm->wire_method); /* checked earlier */
wm->active = true;
return wm;
}
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index 04d174eb..064b0be5 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -835,12 +835,12 @@ process_pay_with_exchange (void *cls,
dc->refund_fee = denom_details->fee_refund;
dc->wire_fee = *wire_fee;
GNUNET_assert (NULL != pc->wm);
- GNUNET_assert (NULL != pc->wm->j_wire);
TMH_db->preflight (TMH_db->cls);
dc->dh = TALER_EXCHANGE_deposit (exchange_handle,
&dc->amount_with_fee,
pc->wire_transfer_deadline,
- pc->wm->j_wire,
+ pc->wm->payto_uri,
+ &pc->wm->wire_salt,
&pc->h_contract_terms,
NULL, /* FIXME-Oec */
&dc->coin_pub,
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index 99d7957e..fc4c6bda 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -249,9 +249,6 @@ pick_context_cleanup (void *cls)
}
-/**
- * We are shutting down, force resuming all suspended pickup operations.
- */
void
TMH_force_tip_pickup_resume ()
{
@@ -278,7 +275,7 @@ TMH_force_tip_pickup_resume ()
static void
withdraw_cb (void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr,
- const struct GNUNET_CRYPTO_RsaSignature *blind_sig)
+ const struct TALER_BlindedDenominationSignature *blind_sig)
{
struct PlanchetOperation *po = cls;
struct PickupContext *pc = po->pc;
@@ -594,15 +591,6 @@ reply_lookup_tip_failed (struct MHD_Connection *connection,
}
-/**
- * Manages a POST /tips/$ID/pickup call, checking that the tip is authorized,
- * and if so, returning the blind signatures.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] hc context with further information about the request
- * @return MHD result code
- */
MHD_RESULT
TMH_post_tips_ID_pickup (const struct TMH_RequestHandler *rh,
struct MHD_Connection *connection,
@@ -782,7 +770,8 @@ RETRY:
NULL);
}
{
- struct GNUNET_CRYPTO_RsaSignature *sigs[GNUNET_NZL (pc->planchets_length)];
+ struct TALER_BlindedDenominationSignature sigs[
+ GNUNET_NZL (pc->planchets_length)];
memset (sigs,
0,
@@ -803,7 +792,7 @@ RETRY:
for (unsigned int i = 0; i< pc->planchets_length; i++)
{
- if (NULL != sigs[i])
+ if (TALER_DENOMINATION_INVALID == sigs[i].cipher)
continue;
if (! rollback)
{
@@ -847,9 +836,9 @@ RETRY:
json_array_append_new (
blind_sigs,
GNUNET_JSON_PACK (
- GNUNET_JSON_pack_rsa_signature ("blind_sig",
- sigs[i]))));
- GNUNET_CRYPTO_rsa_signature_free (sigs[i]);
+ TALER_JSON_pack_blinded_denom_sig ("blind_sig",
+ &sigs[i]))));
+ TALER_blinded_denom_sig_free (&sigs[i]);
}
return TALER_MHD_REPLY_JSON_PACK (
connection,
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
index 95a3e5ea..85b3c7df 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
@@ -51,14 +51,12 @@ get_instances_ID (struct TMH_MerchantInstance *mi,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string (
"payto_uri",
- json_string_value (json_object_get (wm->j_wire,
- "payto_uri"))),
+ wm->payto_uri),
GNUNET_JSON_pack_data_auto ("h_wire",
&wm->h_wire),
- GNUNET_JSON_pack_string (
+ GNUNET_JSON_pack_data_auto (
"salt",
- json_string_value (json_object_get (wm->j_wire,
- "salt"))),
+ &wm->wire_salt),
GNUNET_JSON_pack_bool ("active",
wm->active))));
}
diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
index 607c3593..d7ebc1f2 100644
--- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
@@ -42,7 +42,7 @@
static void
free_wm (struct TMH_WireMethod *wm)
{
- json_decref (wm->j_wire);
+ GNUNET_free (wm->payto_uri);
GNUNET_free (wm->wire_method);
GNUNET_free (wm);
}
@@ -208,8 +208,7 @@ patch_instances_ID (struct TMH_MerchantInstance *mi,
NULL != wm;
wm = wm->next)
{
- const char *uri = json_string_value (json_object_get (wm->j_wire,
- "payto_uri"));
+ const char *uri = wm->payto_uri;
GNUNET_assert (NULL != uri);
matched = false;
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
index 7951652a..71be2673 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -60,8 +60,7 @@ accounts_equal (const struct TMH_MerchantInstance *mi,
NULL != wm;
wm = wm->next)
{
- const char *uri = json_string_value (json_object_get (wm->j_wire,
- "payto_uri"));
+ const char *uri = wm->payto_uri;
GNUNET_assert (NULL != uri);
for (unsigned int i = 0; i<len; i++)
@@ -99,7 +98,7 @@ accounts_equal (const struct TMH_MerchantInstance *mi,
static void
free_wm (struct TMH_WireMethod *wm)
{
- json_decref (wm->j_wire);
+ GNUNET_free (wm->payto_uri);
GNUNET_free (wm->wire_method);
GNUNET_free (wm);
}
@@ -411,21 +410,13 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
NULL != wm;
wm = wm->next)
{
- struct TALER_MERCHANTDB_AccountDetails ad;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_string ("payto_uri",
- &ad.payto_uri),
- GNUNET_JSON_spec_fixed_auto ("salt",
- &ad.salt),
- GNUNET_JSON_spec_end ()
+ struct TALER_MERCHANTDB_AccountDetails ad = {
+ .payto_uri = wm->payto_uri,
+ .salt = wm->wire_salt,
+ .h_wire = wm->h_wire,
+ .active = wm->active
};
- GNUNET_assert (GNUNET_OK ==
- TALER_MHD_parse_json_data (NULL,
- wm->j_wire,
- spec));
- ad.h_wire = wm->h_wire;
- ad.active = wm->active;
qs = TMH_db->insert_account (TMH_db->cls,
mi->settings.id,
&ad);