[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 01/03: fixed api test
From: |
gnunet |
Subject: |
[taler-anastasis] 01/03: fixed api test |
Date: |
Mon, 13 Apr 2020 09:18:08 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 9ccfb8104631f8566a394a26c99fc33b33d70130
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Apr 13 06:47:07 2020 +0000
fixed api test
---
src/backend/anastasis-httpd_policy_upload.c | 2 +-
src/backend/anastasis-httpd_truth_upload.c | 29 +++++++++++++++++++++++++----
src/include/anastasis_database_plugin.h | 5 ++---
src/lib/test_anastasis_api.c | 5 ++---
src/lib/testing_api_cmd_truth_store.c | 7 -------
src/stasis/plugin_anastasis_postgres.c | 6 +++---
src/stasis/test_anastasis_db.c | 1 -
7 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy_upload.c
b/src/backend/anastasis-httpd_policy_upload.c
index 3dd049c..07ca302 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -794,7 +794,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
struct ANASTASIS_UploadSignaturePS usp = {
.purpose.size = htonl (sizeof (usp)),
.purpose.purpose = htonl (TALER_SIGNATURE_ANASTASIS_POLICY_UPLOAD),
- // .old_recovery_data_hash = puc->old_policy_upload_hash,
+ // usp.old_recovery_data_hash = puc->old_policy_upload_hash,
.new_recovery_data_hash = puc->new_policy_upload_hash
};
if (GNUNET_OK !=
diff --git a/src/backend/anastasis-httpd_truth_upload.c
b/src/backend/anastasis-httpd_truth_upload.c
index f9c8e41..a464a84 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -45,10 +45,9 @@ verify_and_execute_truth (struct MHD_Connection *connection,
qs = db->store_truth (db->cls,
uuid,
&truth->keyshare_data,
- sizeof (&truth->keyshare_data),
truth->truth_mime,
truth->encrypted_truth,
- sizeof (&truth->encrypted_truth),
+ truth->encrypted_truth_size,
&truth->aes_gcm_tag,
&truth->nonce,
truth->method,
@@ -76,6 +75,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
size_t *truth_data_size)
{
json_t *json;
+ MHD_RESULT ret;
uuid_t uuid;
int res;
struct ANASTASIS_DB_Truth truth;
@@ -126,7 +126,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
"Truth json from upload: %s\nResult: %i\n",
json_dumps (json, JSON_COMPACT),
res);
- json_decref (json);
+
if (GNUNET_SYSERR == res)
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
@@ -134,7 +134,28 @@ AH_handler_truth_post (struct MHD_Connection *connection,
res = verify_and_execute_truth (connection,
&truth,
&uuid);
+ json_decref (json);
GNUNET_JSON_parse_free (spec);
- return res;
+ if (GNUNET_OK == res)
+ {
+ {
+ struct MHD_Response *resp;
+
+ resp = MHD_create_response_from_buffer (0,
+ NULL,
+ MHD_RESPMEM_PERSISTENT);
+ TALER_MHD_add_global_headers (resp);
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_NO_CONTENT,
+ resp);
+ MHD_destroy_response (resp);
+ }
+ return ret;
+ }
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_SYNC_DB_FETCH_ERROR,
+ "database failure");
}
}
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index 0553bb0..9929b66 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -245,7 +245,6 @@ struct ANASTASIS_DatabasePlugin
* @param cls closure
* @param uuid the identifier for the Truth
* @param key_share_data contains information of an EncryptedKeyShare
- * @param key_share_data_size size of key_share_data
* @param method name of method
* @param nonce nonce used to compute encryption key for encrypted_truth
* @param aes_gcm_tag authentication tag of encrypted_truth
@@ -257,8 +256,8 @@ struct ANASTASIS_DatabasePlugin
enum ANASTASIS_DB_QueryStatus
(*store_truth)(void *cls,
const uuid_t *uuid,
- const void *key_share_data,
- size_t key_share_data_size,
+ const struct
+ ANASTASIS_CRYPTO_EncryptedKeyShare *key_share_data,
const char *mime_type,
const void *encrypted_truth,
size_t encrypted_truth_size,
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index d24c90f..0a0605f 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -260,18 +260,17 @@ run (void *cls,
" s:s," /* method */
" s:o," /* nonce */
" s:o," /* aes_gcm_tag */
- " s:o," /* truth_hash */
" s:o," /* encrypted_truth */
" s:s}", /* truth_mime */
"keyshare_data", GNUNET_JSON_from_data_auto (
&keyshare_data),
- "method", "Truth test (method)",
+ "method", "Truth test method",
"nonce", GNUNET_JSON_from_data_auto (&nonce),
"aes_gcm_tag", GNUNET_JSON_from_data_auto (
&aes_gcm_tag),
"encrypted_truth", GNUNET_JSON_from_data (
encrypted_truth, strlen (encrypted_truth)),
- "truth_mime", "Truth test (mime)"
+ "truth_mime", "Truth test mime"
);
if (NULL == truth_data)
{
diff --git a/src/lib/testing_api_cmd_truth_store.c
b/src/lib/testing_api_cmd_truth_store.c
index 2f3286f..f975d32 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -139,13 +139,6 @@ truth_store_cb (void *cls,
switch (ud->us)
{
case ANASTASIS_US_SUCCESS:
- if (0 != GNUNET_memcmp (&tss->curr_hash,
- ud->details.curr_backup_hash))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (tss->is);
- return;
- }
break;
case ANASTASIS_US_PAYMENT_REQUIRED:
{
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index 3a544aa..569a3bf 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -979,8 +979,8 @@ postgres_record_payment (void *cls,
static enum ANASTASIS_DB_QueryStatus
postgres_store_truth (void *cls,
const uuid_t *uuid,
- const void *key_share_data,
- size_t key_share_data_size,
+ const struct
+ ANASTASIS_CRYPTO_EncryptedKeyShare *key_share_data,
const char *mime_type,
const void *encrypted_truth,
size_t encrypted_truth_size,
@@ -1009,7 +1009,7 @@ postgres_store_truth (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (uuid),
- GNUNET_PQ_query_param_fixed_size (key_share_data, key_share_data_size),
+ GNUNET_PQ_query_param_auto_from_type (key_share_data),
GNUNET_PQ_query_param_string (method),
GNUNET_PQ_query_param_auto_from_type (nonce),
GNUNET_PQ_query_param_auto_from_type (aes_gcm_tag),
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 0f6a03a..1f08d1c 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -260,7 +260,6 @@ run (void *cls)
plugin->store_truth (plugin->cls,
&uuid,
"key_share_data",
- sizeof ("key_share_data"),
mime_type,
"encrypted_truth",
sizeof ("encrypted_truth"),
--
To stop receiving notification emails like this one, please contact
address@hidden.