[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 02/02: Fixed warnings during compilation
From: |
gnunet |
Subject: |
[taler-anastasis] 02/02: Fixed warnings during compilation |
Date: |
Wed, 26 Feb 2020 22:51:10 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 56769f22780caf0865abb03e0e6f925ac46bedb2
Author: Dennis Neufeld <address@hidden>
AuthorDate: Wed Feb 26 21:50:59 2020 +0000
Fixed warnings during compilation
---
src/backend/anastasis-httpd_policy.c | 11 +++++++++++
src/backend/anastasis-httpd_policy_upload.c | 2 +-
src/backend/anastasis-httpd_truth.c | 16 +++++++++++-----
src/backend/anastasis-httpd_truth_upload.c | 5 +++--
src/include/anastasis_database_plugin.h | 17 +++++++++--------
src/include/anastasis_service.h | 8 ++++----
src/lib/anastasis.c | 4 ++--
src/lib/anastasis_api_truth_store.c | 14 +++++++-------
src/lib/testing_api_cmd_truth_store.c | 12 ++++++------
src/stasis/plugin_anastasis_postgres.c | 13 +++++++------
10 files changed, 61 insertions(+), 41 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy.c
b/src/backend/anastasis-httpd_policy.c
index 8cc2292..ba29a9b 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -250,6 +250,17 @@ AH_handler_policy_get (struct MHD_Connection *connection,
case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
GNUNET_assert (NULL != res_recovery_data);
break;
+ case ANASTASIS_DB_STATUS_PAYMENT_REQUIRED:
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_NOT_FOUND,
+ 42 /*FIXME Unknown account */,
+ "account");
+ case ANASTASIS_DB_STATUS_OLD_RECOVERY_UPLOAD_MISSMATCH:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_INTERNAL_INVARIANT_FAILURE,
+ "unexpected return status (backup
missmatch)");
}
// BUILD reply
diff --git a/src/backend/anastasis-httpd_policy_upload.c
b/src/backend/anastasis-httpd_policy_upload.c
index 1d1f26f..432c9dd 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -827,7 +827,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
ret = MHD_queue_response (connection,
MHD_HTTP_NOT_MODIFIED,
resp);
- (MHD_YES == ret);
+ GNUNET_break (MHD_YES == ret);
MHD_destroy_response (resp);
return ret;
}
diff --git a/src/backend/anastasis-httpd_truth.c
b/src/backend/anastasis-httpd_truth.c
index dcf3cbd..0b251ee 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -95,12 +95,13 @@ AH_handler_truth_get (struct MHD_Connection *connection,
{
// load encrypted truth from db
enum ANASTASIS_DB_QueryStatus qs;
+ size_t encrypted_truth_size;
qs = db->get_escrow_challenge (db->cls,
&uuid,
encrypted_truth,
- sizeof (encrypted_truth),
- &aes_gcm_tag,
+ &encrypted_truth_size,
+ aes_gcm_tag,
&nonce,
&truth_mime,
&method);
@@ -140,7 +141,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
}
{
// validate challenge response
- if (method == "Secure Question")
+ if (strcmp (method, "Secure Question") == 0)
{
GNUNET_CRYPTO_hash_from_string (challenge_response_s,
&challenge_response);
@@ -149,17 +150,22 @@ AH_handler_truth_get (struct MHD_Connection *connection,
decrypted_truth))
{
GNUNET_break (0);
- return;
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ // FIXME: find error code
+ TALER_EC_SYNC_BAD_IF_MATCH,
+ "Authentication failed"); // FIXME:
How much should we tell?
}
else
{
// load encrypted keyshare from db
enum ANASTASIS_DB_QueryStatus qs;
+ size_t encrypted_keyshare_size;
qs = db->get_key_share (db->cls,
&uuid,
&encrypted_keyshare,
- sizeof (&encrypted_keyshare));
+ &encrypted_keyshare_size);
if (qs != ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT)
{
diff --git a/src/backend/anastasis-httpd_truth_upload.c
b/src/backend/anastasis-httpd_truth_upload.c
index 05a10da..e1282e0 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -50,11 +50,12 @@ verify_and_execute_truth (struct MHD_Connection *connection,
truth->truth_mime,
truth->encrypted_truth,
sizeof (&truth->encrypted_truth),
- &truth->aes_gcm_tag,
- &truth->truth_hash,
+ truth->truth_hash,
+ truth->aes_gcm_tag,
&truth->nonce,
truth->method,
AH_truth_expiration);
+ return qs;
}
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index df0a68c..54b7c8a 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -39,11 +39,11 @@ struct ANASTASIS_DB_Truth
uint32_t nonce;
// AES_GCM_Tag
- const unsigned char aes_gcm_tag[16];
+ unsigned char aes_gcm_tag[16];
- const struct GNUNET_HashCode *truth_hash;
+ struct GNUNET_HashCode *truth_hash;
- const void *encrypted_truth;
+ void *encrypted_truth;
const char *truth_mime;
@@ -61,7 +61,7 @@ struct ANASTASIS_DB_Truth
typedef void
(*ANASTASIS_DB_PaymentPendingIterator)(void *cls,
struct GNUNET_TIME_Absolute timestamp,
- void *payment_identifier,
+ const char *payment_identifier,
const struct TALER_Amount *amount);
/**
@@ -104,14 +104,15 @@ struct ANASTASIS_DatabasePlugin
* truth and financial records older than @a fin_expire.
*
* @param cls closure
- * @param fin_expire financial records older than the given
- * time stamp should be garbage collected (usual
- * values might be something like 6-10 years in the past)
+ * @param expire_backups backups older than the given time stamp should be
garbage collected
+ * @param expire_pending_payments payments still pending from since before
+ * this value should be garbage collected
* @return transaction status
*/
enum ANASTASIS_DB_QueryStatus
(*gc)(void *cls,
- struct GNUNET_TIME_Absolute fin_expire);
+ struct GNUNET_TIME_Absolute expire,
+ struct GNUNET_TIME_Absolute expire_pending_payments);
/**
* Do a pre-flight check that we are not in an uncommitted transaction.
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 3da21e4..b24d19e 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -87,12 +87,12 @@ struct ANASTASIS_UploadSignaturePS
/**
* Hash of the previous backup, all zeros for none.
*/
- struct GNUNET_HashCode old_recovery_data_hash GNUNET_PACKED;
+ struct GNUNET_HashCode old_recovery_data_hash;
/**
* Hash of the new backup.
*/
- struct GNUNET_HashCode new_recovery_data_hash GNUNET_PACKED;
+ struct GNUNET_HashCode new_recovery_data_hash;
};
@@ -500,10 +500,10 @@ typedef void
struct ANASTASIS_TruthStoreOperation *
ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- uuid_t *truth_uuid,
+ const uuid_t truth_uuid,
const struct
GNUNET_HashCode *prev_truth_data_hash,
- json_t *truth_data,
+ const json_t *truth_data,
int payment_requested,
const char *paid_order_id,
ANASTASIS_TruthStoreCallback cb,
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index d8c3e8f..ec8bd5c 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1,4 +1,4 @@
-struct ANASTASIS_Policy *
+/*struct ANASTASIS_Policy *
ANASTASIS_policy_create ()
{
-}
+}*/
diff --git a/src/lib/anastasis_api_truth_store.c
b/src/lib/anastasis_api_truth_store.c
index 85e0823..12bc30c 100644
--- a/src/lib/anastasis_api_truth_store.c
+++ b/src/lib/anastasis_api_truth_store.c
@@ -256,10 +256,10 @@ handle_header (char *buffer,
struct ANASTASIS_TruthStoreOperation *
ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- uuid_t *truth_uuid,
+ const uuid_t truth_uuid,
const struct
GNUNET_HashCode *prev_truth_data_hash,
- json_t *truth_data,
+ const json_t *truth_data,
int payment_requested,
const char *paid_order_id,
ANASTASIS_TruthStoreCallback cb,
@@ -387,11 +387,11 @@ ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
curl_easy_setopt (eh,
CURLOPT_HEADERDATA,
tso));
- tso->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- job_headers,
- &handle_truth_store_finished,
- tso);
+ tso->job = GNUNET_CURL_job_add_raw (ctx,
+ eh,
+ job_headers,
+ &handle_truth_store_finished,
+ tso);
curl_slist_free_all (job_headers);
return tso;
}
diff --git a/src/lib/testing_api_cmd_truth_store.c
b/src/lib/testing_api_cmd_truth_store.c
index 712044f..eb6d370 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -53,7 +53,7 @@ struct TruthStoreState
*/
struct GNUNET_HashCode prev_hash;
- uuid_t truth_uuid;
+ const uuid_t truth_uuid;
/**
* Hash of the current upload.
@@ -294,19 +294,19 @@ truth_store_run (void *cls,
}
}
}
- {
- // Create an uuid
- uuid_generate (tss->truth_uuid);
- }
{
// create json
// FIXME: create an example TruthUploadRequest-Json-Object
json_t *truth_json;
+ truth_json = json_pack ("");
tss->truth_data = truth_json;
}
+ // Create an uuid
+ uuid_t truth_uuid;
+ uuid_generate (truth_uuid);
tss->tso = ANASTASIS_truth_store (is->ctx,
tss->anastasis_url,
- &tss->truth_uuid,
+ truth_uuid,
( ( (NULL != tss->prev_upload) &&
(0 != GNUNET_is_zero (
&tss->prev_hash)) ) ||
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index 4592f9d..4896f54 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -330,7 +330,7 @@ payment_by_account_cb (void *cls,
pic->qs = GNUNET_DB_STATUS_HARD_ERROR;
return;
}
- const char *order_id;
+ char *order_id;
order_id = GNUNET_STRINGS_data_to_string_alloc (&payment_identifier,
sizeof (struct
ANASTASIS_PaymentSecretP));
@@ -393,7 +393,6 @@ postgres_lookup_pending_payments_by_account (void *cls,
* @param cls closure
* @param anastasis_pub public key of the user's account
* @param account_sig signature affirming storage request
- * @param old_data_hash hash of the previous uploaded recovery data (must
match)
* @param data_hash hash of @a data
* @param data contains encrypted_recovery_document
* @param data_size size of data blob
@@ -1044,10 +1043,11 @@ postgres_get_escrow_challenge (void *cls,
GNUNET_PQ_result_spec_variable_size ("encrypted_truth",
truth,
truth_size),
- GNUNET_PQ_result_spec_string ("aes_gcm_tag",
- aes_gcm_tag),
+ GNUNET_PQ_result_spec_fixed_size ("aes_gcm_tag",
+ aes_gcm_tag,
+ 16),
GNUNET_PQ_result_spec_uint32 ("nonce",
- nonce),
+ *nonce),
GNUNET_PQ_result_spec_string ("truth_mime",
truth_mime),
GNUNET_PQ_result_spec_string ("method",
@@ -1125,7 +1125,7 @@ postgres_lookup_account (void *cls,
params,
rs);
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
+ GNUNET_break (ANASTASIS_DB_STATUS_HARD_ERROR != qs);
switch (qs)
{
@@ -1538,6 +1538,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
plugin = GNUNET_new (struct ANASTASIS_DatabasePlugin);
plugin->cls = pg;
plugin->drop_tables = &postgres_drop_tables;
+ plugin->gc = &postgres_gc;
plugin->preflight = &postgres_preflight;
plugin->rollback = &rollback;
plugin->commit = &commit_transaction;
--
To stop receiving notification emails like this one, please contact
address@hidden.