summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/taler-merchant-httpd_helper.c24
-rw-r--r--src/backend/taler-merchant-httpd_helper.h11
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c7
-rw-r--r--src/backend/taler-merchant-httpd_private-post-products-ID-lock.c10
-rw-r--r--src/testing/test_reducer_home/.local/share/taler/exchange-offline/master.priv1
5 files changed, 45 insertions, 8 deletions
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
index 0120b7b3..cc6288f9 100644
--- a/src/backend/taler-merchant-httpd_helper.c
+++ b/src/backend/taler-merchant-httpd_helper.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2014--2020 Taler Systems SA
+ (C) 2014--2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
@@ -224,3 +224,25 @@ TMH_check_auth_config (struct MHD_Connection *connection,
}
return GNUNET_OK;
}
+
+
+/**
+ * Generate binary UUID from client-provided UUID-string.
+ *
+ * @param uuids string intpu
+ * @param[out] uuid set to binary UUID
+ */
+void
+TMH_uuid_from_string (const char *uuids,
+ struct GNUNET_Uuid *uuid)
+{
+ struct GNUNET_HashCode hc;
+
+ GNUNET_CRYPTO_hash (uuids,
+ strlen (uuids),
+ &hc);
+ GNUNET_static_assert (sizeof (hc) > sizeof (*uuid));
+ memcpy (uuid,
+ &hc,
+ sizeof (*uuid));
+}
diff --git a/src/backend/taler-merchant-httpd_helper.h b/src/backend/taler-merchant-httpd_helper.h
index 0460665b..cc5b3013 100644
--- a/src/backend/taler-merchant-httpd_helper.h
+++ b/src/backend/taler-merchant-httpd_helper.h
@@ -76,4 +76,15 @@ TMH_check_auth_config (struct MHD_Connection *connection,
const char **auth_token);
+/**
+ * Generate binary UUID from client-provided UUID-string.
+ *
+ * @param uuids string intpu
+ * @param[out] uuid set to binary UUID
+ */
+void
+TMH_uuid_from_string (const char *uuids,
+ struct GNUNET_Uuid *uuid);
+
+
#endif
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index 8a0ca347..22e6327f 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -1443,9 +1443,10 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
{
const char *error_name;
unsigned int error_line;
+ const char *uuidsi;
struct GNUNET_JSON_Specification ispec[] = {
- GNUNET_JSON_spec_fixed_auto ("uuid",
- &uuids[i]),
+ GNUNET_JSON_spec_string ("uuid",
+ &uuidsi),
GNUNET_JSON_spec_end ()
};
@@ -1474,6 +1475,8 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"lock_uuids");
}
+ TMH_uuid_from_string (uuidsi,
+ &uuids[i]);
}
}
diff --git a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
index 0fae6023..7fc7b0ac 100644
--- a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
+++ b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2020 Taler Systems SA
+ (C) 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@@ -35,12 +35,13 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
struct TMH_MerchantInstance *mi = hc->instance;
const char *product_id = hc->infix;
enum GNUNET_DB_QueryStatus qs;
+ const char *uuids;
struct GNUNET_Uuid uuid;
uint32_t quantity;
struct GNUNET_TIME_Relative duration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("lock_uuid",
- &uuid), // FIXME: use string?
+ GNUNET_JSON_spec_string ("lock_uuid",
+ &uuids),
TALER_JSON_spec_relative_time ("duration",
&duration),
GNUNET_JSON_spec_uint32 ("quantity",
@@ -61,7 +62,8 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
? MHD_YES
: MHD_NO;
}
-
+ TMH_uuid_from_string (uuids,
+ &uuid);
qs = TMH_db->lock_product (TMH_db->cls,
mi->settings.id,
product_id,
diff --git a/src/testing/test_reducer_home/.local/share/taler/exchange-offline/master.priv b/src/testing/test_reducer_home/.local/share/taler/exchange-offline/master.priv
deleted file mode 100644
index b442413a..00000000
--- a/src/testing/test_reducer_home/.local/share/taler/exchange-offline/master.priv
+++ /dev/null
@@ -1 +0,0 @@
-¹(®ã3–ýµîwê c õËšR9ª¥`>B¶ \ No newline at end of file