[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: fix charity_id types
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: fix charity_id types |
Date: |
Thu, 22 Feb 2024 14:17:51 +0100 |
This is an automated email from the git hooks/post-receive script.
johannes-casaburi pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 615a460 fix charity_id types
615a460 is described below
commit 615a4608fd15ea06e6a7d99007d1bf132b2a58e0
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Thu Feb 22 14:16:46 2024 +0100
fix charity_id types
---
contrib/gana | 2 +-
src/donau/donau-httpd_charity_delete.c | 7 +-
src/donau/donau-httpd_get-charity.c | 2 +-
src/donau/donau-httpd_keys.c | 218 +++++++++++++++++----------------
src/donaudb/pg_do_charity_delete.c | 2 +-
src/donaudb/pg_do_charity_delete.h | 2 +-
src/donaudb/pg_get_history.c | 2 +-
src/donaudb/pg_insert_history_entry.c | 2 +-
src/donaudb/pg_insert_history_entry.h | 2 +-
src/donaudb/pg_insert_issued_receipt.c | 2 +-
src/donaudb/pg_insert_issued_receipt.h | 2 +-
src/donaudb/pg_lookup_charity.c | 2 +-
src/donaudb/pg_lookup_charity.h | 2 +-
src/include/donaudb_plugin.h | 8 +-
14 files changed, 130 insertions(+), 125 deletions(-)
diff --git a/contrib/gana b/contrib/gana
index 8368009..72be9c8 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 836800945d80db9c0160a10a84edc1a086339187
+Subproject commit 72be9c8454abc39eb35e1019545ceda8ece7a6db
diff --git a/src/donau/donau-httpd_charity_delete.c
b/src/donau/donau-httpd_charity_delete.c
index 27ea928..b76fa12 100644
--- a/src/donau/donau-httpd_charity_delete.c
+++ b/src/donau/donau-httpd_charity_delete.c
@@ -59,7 +59,7 @@ DH_handler_charity_delete (
enum GNUNET_DB_QueryStatus qs;
qs = DH_plugin->do_charity_delete (DH_plugin->cls,
- charity_id);
+ (uint64_t) charity_id);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -78,8 +78,11 @@ DH_handler_charity_delete (
NULL,
0);
}
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
}
-
}
diff --git a/src/donau/donau-httpd_get-charity.c
b/src/donau/donau-httpd_get-charity.c
index 78f30d4..9e68c0a 100644
--- a/src/donau/donau-httpd_get-charity.c
+++ b/src/donau/donau-httpd_get-charity.c
@@ -64,7 +64,7 @@ DH_handler_charity_get (
MHD_RESULT result;
qs = DH_plugin->lookup_charity (DH_plugin->cls,
- charity_id,
+ (uint64_t) charity_id,
&meta);
switch (qs)
{
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index b632b96..d3d7761 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -645,7 +645,8 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
{
GNUNET_log (
GNUNET_ERROR_TYPE_WARNING,
- "No donation unit keys available. Refusing to generate /keys
response.\n");
+ "No donation unit keys available. Refusing to generate /keys
response.\n")
+ ;
GNUNET_CRYPTO_hash_context_abort (hash_context);
}
@@ -1612,112 +1613,113 @@ DH_RESPONSE_reply_not_modified (struct MHD_Connection
*connection,
}
-// MHD_RESULT
-// DH_keys_get_handler (struct DH_RequestContext *rc,
-// const char *const args[])
-// {
-// struct GNUNET_TIME_Timestamp last_issue_date;
-// const char *etag;
-
-// etag = MHD_lookup_connection_value (rc->connection,
-// MHD_HEADER_KIND,
-// MHD_HTTP_HEADER_IF_NONE_MATCH);
-// (void) args;
-// // {
-// // const char *have_cherrypick;
-
-// // have_cherrypick = MHD_lookup_connection_value (rc->connection,
-// // MHD_GET_ARGUMENT_KIND,
-// // "last_issue_date");
-// // if (NULL != have_cherrypick)
-// // {
-// // unsigned long long cherrypickn;
-
-// // if (1 !=
-// // sscanf (have_cherrypick,
-// // "%llu",
-// // &cherrypickn))
-// // {
-// // GNUNET_break_op (0);
-// // return TALER_MHD_reply_with_error (rc->connection,
-// // MHD_HTTP_BAD_REQUEST,
-// //
TALER_EC_GENERIC_PARAMETER_MALFORMED,
-// // have_cherrypick);
-// // }
-// // /* The following multiplication may overflow; but this should not
really
-// // be a problem, as giving back 'older' data than what the client
asks for
-// // (given that the client asks for data in the distant future) is
not
-// // problematic */
-// // last_issue_date = GNUNET_TIME_timestamp_from_s (cherrypickn);
-// // }
-// // else
-// // {
-// // last_issue_date = GNUNET_TIME_UNIT_ZERO_TS;
-// // }
-// // }
-
-// {
-// struct DH_KeyStateHandle *ksh;
-// const struct KeysResponseData *krd;
-
-// ksh = DH_keys_get_state ();
-// if ( (NULL == ksh) ||
-// (0 == ksh->krd_array_length) )
-// {
-// if ( ( (SKR_LIMIT == skr_size) &&
-// (rc->connection == skr_connection) ) ||
-// DH_suicide)
-// {
-// return TALER_MHD_reply_with_error (
-// rc->connection,
-// MHD_HTTP_SERVICE_UNAVAILABLE,
-// TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
-// DH_suicide
-// ? "server terminating"
-// : "too many connections suspended waiting on /keys");
-// }
-// return suspend_request (rc->connection);
-// }
-// krd = bsearch (&last_issue_date,
-// ksh->krd_array,
-// ksh->krd_array_length,
-// sizeof (struct KeysResponseData),
-// &krd_search_comparator);
-// GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-// "Filtering /keys by cherry pick date %s found entry
%u/%u\n",
-// GNUNET_TIME_timestamp2s (last_issue_date),
-// (unsigned int) (krd - ksh->krd_array),
-// ksh->krd_array_length);
-// if ( (NULL == krd) &&
-// (ksh->krd_array_length > 0) )
-// {
-// if (! GNUNET_TIME_absolute_is_zero (last_issue_date.abs_time))
-// GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-// "Client provided invalid cherry picking timestamp %s,
returning full response\n",
-// GNUNET_TIME_timestamp2s (last_issue_date));
-// krd = &ksh->krd_array[ksh->krd_array_length - 1];
-// }
-// if (NULL == krd)
-// {
-// /* Likely keys not ready *yet*.
-// Wait until they are. */
-// return suspend_request (rc->connection);
-// }
-// if ( (NULL != etag) &&
-// (0 == strcmp (etag,
-// krd->etag)) )
-// return DH_RESPONSE_reply_not_modified (rc->connection,
-// krd->etag,
-//
&setup_general_response_headers,
-// ksh);
-
-// return MHD_queue_response (rc->connection,
-// MHD_HTTP_OK,
-// (MHD_YES ==
-// TALER_MHD_can_compress (rc->connection))
-// ? krd->response_compressed
-// : krd->response_uncompressed);
-// }
-// }
+MHD_RESULT
+DH_keys_get_handler (struct DH_RequestContext *rc,
+ const char *const args[])
+{
+ struct GNUNET_TIME_Timestamp last_issue_date;
+ const char *etag;
+
+ etag = MHD_lookup_connection_value (rc->connection,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_IF_NONE_MATCH);
+ (void) args;
+ {
+ const char *have_cherrypick;
+
+ have_cherrypick = MHD_lookup_connection_value (rc->connection,
+ MHD_GET_ARGUMENT_KIND,
+ "last_issue_date");
+ if (NULL != have_cherrypick)
+ {
+ unsigned long long cherrypickn;
+
+ if (1 !=
+ sscanf (have_cherrypick,
+ "%llu",
+ &cherrypickn))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+
TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ have_cherrypick);
+ }
+ /* The following multiplication may overflow; but this should not really
+ be a problem, as giving back 'older' data than what the client asks
for
+ (given that the client asks for data in the distant future) is not
+ problematic */
+ last_issue_date = GNUNET_TIME_timestamp_from_s (cherrypickn);
+ }
+ else
+ {
+ last_issue_date = GNUNET_TIME_UNIT_ZERO_TS;
+ }
+ }
+
+ {
+ struct DH_KeyStateHandle *ksh;
+ const struct KeysResponseData *krd;
+
+ ksh = DH_keys_get_state ();
+ if ( (NULL == ksh) ||
+ (0 == ksh->krd_array_length) )
+ {
+ if ( ( (SKR_LIMIT == skr_size) &&
+ (rc->connection == skr_connection) ) ||
+ DH_suicide)
+ {
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_SERVICE_UNAVAILABLE,
+ TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
+ DH_suicide
+ ? "server terminating"
+ : "too many connections suspended waiting on /keys");
+ }
+ return suspend_request (rc->connection);
+ }
+ krd = bsearch (&last_issue_date,
+ ksh->krd_array,
+ ksh->krd_array_length,
+ sizeof (struct KeysResponseData),
+ &krd_search_comparator);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Filtering /keys by cherry pick date %s found entry %u/%u\n",
+ GNUNET_TIME_timestamp2s (last_issue_date),
+ (unsigned int) (krd - ksh->krd_array),
+ ksh->krd_array_length);
+ if ( (NULL == krd) &&
+ (ksh->krd_array_length > 0) )
+ {
+ if (! GNUNET_TIME_absolute_is_zero (last_issue_date.abs_time))
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Client provided invalid cherry picking timestamp %s,
returning full response\n",
+ GNUNET_TIME_timestamp2s (last_issue_date));
+ krd = &ksh->krd_array[ksh->krd_array_length - 1];
+ }
+ if (NULL == krd)
+ {
+ /* Likely keys not ready *yet*.
+ Wait until they are. */
+ return suspend_request (rc->connection);
+ }
+ if ( (NULL != etag) &&
+ (0 == strcmp (etag,
+ krd->etag)) )
+ return DH_RESPONSE_reply_not_modified (rc->connection,
+ krd->etag,
+ &setup_general_response_headers,
+ ksh);
+
+ return MHD_queue_response (rc->connection,
+ MHD_HTTP_OK,
+ (MHD_YES ==
+ TALER_MHD_can_compress (rc->connection))
+ ? krd->response_compressed
+ : krd->response_uncompressed);
+ }
+}
+
/* end of donau-httpd_keys.c */
diff --git a/src/donaudb/pg_do_charity_delete.c
b/src/donaudb/pg_do_charity_delete.c
index 2ee171e..3df9bfe 100644
--- a/src/donaudb/pg_do_charity_delete.c
+++ b/src/donaudb/pg_do_charity_delete.c
@@ -29,7 +29,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_do_charity_delete (
void *cls,
- unsigned long long charity_id)
+ uint64_t charity_id)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
diff --git a/src/donaudb/pg_do_charity_delete.h
b/src/donaudb/pg_do_charity_delete.h
index d5eeb55..1bdfa88 100644
--- a/src/donaudb/pg_do_charity_delete.h
+++ b/src/donaudb/pg_do_charity_delete.h
@@ -36,6 +36,6 @@
enum GNUNET_DB_QueryStatus
DH_PG_do_charity_delete (
void *cls,
- unsigned long long charity_id);
+ uint64_t charity_id);
#endif
diff --git a/src/donaudb/pg_get_history.c b/src/donaudb/pg_get_history.c
index 1036b36..e7f28ac 100644
--- a/src/donaudb/pg_get_history.c
+++ b/src/donaudb/pg_get_history.c
@@ -65,7 +65,7 @@ get_history_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
- unsigned long long charity_id;
+ uint64_t charity_id;
struct TALER_Amount final_amount;
uint64_t donation_year;
diff --git a/src/donaudb/pg_insert_history_entry.c
b/src/donaudb/pg_insert_history_entry.c
index 2c3bb61..872f859 100644
--- a/src/donaudb/pg_insert_history_entry.c
+++ b/src/donaudb/pg_insert_history_entry.c
@@ -27,7 +27,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_insert_history_entry (void *cls,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct TALER_Amount *final_amount,
const uint64_t donation_year)
{
diff --git a/src/donaudb/pg_insert_history_entry.h
b/src/donaudb/pg_insert_history_entry.h
index 193ae9c..009c4d5 100644
--- a/src/donaudb/pg_insert_history_entry.h
+++ b/src/donaudb/pg_insert_history_entry.h
@@ -36,7 +36,7 @@
*/
enum GNUNET_DB_QueryStatus
DH_PG_insert_history_entry (void *cls,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct TALER_Amount *final_amount,
const uint64_t donation_year);
diff --git a/src/donaudb/pg_insert_issued_receipt.c
b/src/donaudb/pg_insert_issued_receipt.c
index 6b2575f..fbcb45a 100644
--- a/src/donaudb/pg_insert_issued_receipt.c
+++ b/src/donaudb/pg_insert_issued_receipt.c
@@ -29,7 +29,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_insert_issued_receipt (void *cls,
const struct DONAU_CharitySignatureP *charity_sig,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct DONAU_DonationReceiptHashP
*h_receipt,
const struct TALER_Amount *amount)
{
diff --git a/src/donaudb/pg_insert_issued_receipt.h
b/src/donaudb/pg_insert_issued_receipt.h
index 0f7f9bf..781f283 100644
--- a/src/donaudb/pg_insert_issued_receipt.h
+++ b/src/donaudb/pg_insert_issued_receipt.h
@@ -38,7 +38,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_insert_issued_receipt (void *cls,
const struct DONAU_CharitySignatureP *charity_sig,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct DONAU_DonationReceiptHashP
*h_receipt,
const struct TALER_Amount *amount);
diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c
index bf678b8..b66c162 100644
--- a/src/donaudb/pg_lookup_charity.c
+++ b/src/donaudb/pg_lookup_charity.c
@@ -28,7 +28,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_lookup_charity (
void *cls,
- unsigned long long charity_id,
+ uint64_t charity_id,
struct DONAUDB_CharityMetaData *meta)
{
struct PostgresClosure *pg = cls;
diff --git a/src/donaudb/pg_lookup_charity.h b/src/donaudb/pg_lookup_charity.h
index 63df3d9..5e4c832 100644
--- a/src/donaudb/pg_lookup_charity.h
+++ b/src/donaudb/pg_lookup_charity.h
@@ -34,7 +34,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_lookup_charity (
void *cls,
- unsigned long long charity_id,
+ uint64_t charity_id,
struct DONAUDB_CharityMetaData *meta);
#endif
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index 6a785f4..989aaa6 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -384,7 +384,7 @@ struct DONAUDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_charity)(
void *cls,
- unsigned long long charity_id,
+ uint64_t charity_id,
struct DONAUDB_CharityMetaData *meta);
/**
@@ -399,7 +399,7 @@ struct DONAUDB_Plugin
enum GNUNET_DB_QueryStatus
(*do_charity_delete)(
void *cls,
- unsigned long long charity_id);
+ uint64_t charity_id);
/**
* Get charities.
@@ -516,7 +516,7 @@ struct DONAUDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_history_entry) (
void *cls,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct TALER_Amount *final_amount,
const uint64_t donation_year);
@@ -534,7 +534,7 @@ struct DONAUDB_Plugin
(*insert_issued_receipt) (
void *cls,
const struct DONAU_CharitySignatureP *charity_sig,
- const unsigned long long charity_id,
+ const uint64_t charity_id,
const struct DONAU_DonationReceiptHashP *h_receipt,
const struct TALER_Amount *amount);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: fix charity_id types,
gnunet <=