summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Zwahlen <cedric.zwahlen@students.bfh.ch>2024-04-16 22:56:25 +0200
committerCedric Zwahlen <cedric.zwahlen@students.bfh.ch>2024-04-16 22:56:25 +0200
commit3b055c24839c59268936caa4caaa08b9c10dcad1 (patch)
tree22843f61d32b978cb7115ba25bf1a4b2cb50afb6
parentbbdd1f59092373e4bf6931811770bbc67a9dec4b (diff)
downloadexchange-3b055c24839c59268936caa4caaa08b9c10dcad1.tar.gz
exchange-3b055c24839c59268936caa4caaa08b9c10dcad1.tar.bz2
exchange-3b055c24839c59268936caa4caaa08b9c10dcad1.zip
Fix various CRUD bugs
-rw-r--r--src/auditor/taler-auditor-httpd_closure-lags-get.c72
-rw-r--r--src/auditor/taler-auditor-httpd_coin-inconsistency-get.c70
-rw-r--r--src/auditor/taler-auditor-httpd_deposit-confirmation-get.c56
-rw-r--r--src/auditor/taler-auditor-httpd_emergency-by-count-get.c73
-rw-r--r--src/auditor/taler-auditor-httpd_emergency-get.c73
5 files changed, 99 insertions, 245 deletions
diff --git a/src/auditor/taler-auditor-httpd_closure-lags-get.c b/src/auditor/taler-auditor-httpd_closure-lags-get.c
index b43cf7afa..549f1a754 100644
--- a/src/auditor/taler-auditor-httpd_closure-lags-get.c
+++ b/src/auditor/taler-auditor-httpd_closure-lags-get.c
@@ -46,11 +46,6 @@ process_closure_lags (void *cls,
obj = GNUNET_JSON_PACK (
- // TODO: fill in
-
- // GNUNET_JSON_pack_... ("", &dc->),
- // TALER_JSON_pack_... ("", &dc->),
-
TALER_JSON_pack_amount ("amount", &dc->amount),
GNUNET_JSON_pack_int64 ("deadline", dc->deadline),
GNUNET_JSON_pack_int64 ("wtid", dc->wtid),
@@ -87,10 +82,6 @@ TAH_CLOSURE_LAGS_handler_get (struct TAH_RequestHandler *rh,
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
- (void) rh;
- (void) connection_cls;
- (void) upload_data;
- (void) upload_data_size;
if (GNUNET_SYSERR ==
TAH_plugin->preflight (TAH_plugin->cls))
{
@@ -102,57 +93,30 @@ TAH_CLOSURE_LAGS_handler_get (struct TAH_RequestHandler *rh,
}
ja = json_array ();
GNUNET_break (NULL != ja);
- int64_t limit = -20;
- uint64_t offset;
-
- TALER_MHD_parse_request_snumber (connection,
- "limit",
- &limit);
- if (limit < 0)
- offset = INT64_MAX;
- else
- offset = 0;
+ int64_t limit = -20;
+ uint64_t offset;
- TALER_MHD_parse_request_number (connection,
- "offset",
- &offset);
+ TALER_MHD_parse_request_snumber (connection,
+ "limit",
+ &limit);
- bool return_suppressed = false;
+ if (limit < 0)
+ offset = INT64_MAX;
+ else
+ offset = 0;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed),
- GNUNET_JSON_spec_end ()
- };
+ TALER_MHD_parse_request_number (connection,
+ "offset",
+ &offset);
- // read the input json
- json_t *json_in;
+ bool return_suppressed = false;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
qs = TAH_plugin->get_auditor_closure_lags (
diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
index 84f7a6f60..b8179e1ee 100644
--- a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
+++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
@@ -44,7 +44,6 @@ add_coin_inconsistency (void *cls,
obj));
-
return GNUNET_OK;
}
@@ -70,10 +69,6 @@ TAH_COIN_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh,
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
- (void) rh;
- (void) connection_cls;
- (void) upload_data;
- (void) upload_data_size;
if (GNUNET_SYSERR ==
TAH_plugin->preflight (TAH_plugin->cls))
{
@@ -85,61 +80,32 @@ TAH_COIN_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh,
}
ja = json_array ();
GNUNET_break (NULL != ja);
- int64_t limit = -20;
- uint64_t offset;
-
- TALER_MHD_parse_request_snumber (connection,
- "limit",
- &limit);
- if (limit < 0)
- offset = INT64_MAX;
- else
- offset = 0;
+ int64_t limit = -20;
+ uint64_t offset;
- TALER_MHD_parse_request_number (connection,
- "offset",
- &offset);
+ TALER_MHD_parse_request_snumber (connection,
+ "limit",
+ &limit);
- bool return_suppressed = false;
+ if (limit < 0)
+ offset = INT64_MAX;
+ else
+ offset = 0;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed),
- GNUNET_JSON_spec_end ()
- };
+ TALER_MHD_parse_request_number (connection,
+ "offset",
+ &offset);
-
- // read the input json
- json_t *json_in;
+ bool return_suppressed = false;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
-
qs = TAH_plugin->get_coin_inconsistency (
TAH_plugin->cls,
limit,
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
index 2ca5e8f8e..d8844cead 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
@@ -95,51 +95,33 @@ TAH_DEPOSIT_CONFIRMATION_handler_get (struct TAH_RequestHandler *rh,
GNUNET_break (NULL != ja);
uint64_t row_id = 0;
- bool return_suppressed;
+ bool return_suppressed = false;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_uint64 ("row_id",
- &row_id),
+ int64_t limit = -20; // unused here
+ uint64_t offset;
- GNUNET_JSON_spec_bool ("return_suppressed",
- &return_suppressed),
+ TALER_MHD_parse_request_snumber (connection,
+ "limit",
+ &limit);
- GNUNET_JSON_spec_end ()
- };
+ if (limit < 0)
+ offset = INT64_MAX;
+ else
+ offset = 0;
+ TALER_MHD_parse_request_number (connection,
+ "offset",
+ &offset);
- // read the input json
- json_t *json_in;
+
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
- // printf ("row_id from json: %lu\n", row_id);
-
qs = TAH_plugin->get_deposit_confirmations (
TAH_plugin->cls,
diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-get.c b/src/auditor/taler-auditor-httpd_emergency-by-count-get.c
index e4f9f65ba..ddf830426 100644
--- a/src/auditor/taler-auditor-httpd_emergency-by-count-get.c
+++ b/src/auditor/taler-auditor-httpd_emergency-by-count-get.c
@@ -107,58 +107,29 @@ TAH_EMERGENCY_BY_COUNT_handler_get (struct TAH_RequestHandler *rh,
ja = json_array ();
GNUNET_break (NULL != ja);
- int64_t limit = -20;
- uint64_t offset;
-
- TALER_MHD_parse_request_snumber (connection,
- "limit",
- &limit);
-
- if (limit < 0)
- offset = INT64_MAX;
- else
- offset = 0;
-
- TALER_MHD_parse_request_number (connection,
- "offset",
- &offset);
-
- bool return_suppressed = false;
-
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed),
- GNUNET_JSON_spec_end ()
- };
-
-
- // read the input json
- json_t *json_in;
+ int64_t limit = -20;
+ uint64_t offset;
+
+ TALER_MHD_parse_request_snumber (connection,
+ "limit",
+ &limit);
+
+ if (limit < 0)
+ offset = INT64_MAX;
+ else
+ offset = 0;
+
+ TALER_MHD_parse_request_number (connection,
+ "offset",
+ &offset);
+
+ bool return_suppressed = false;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
qs = TAH_plugin->get_emergency_by_count (
diff --git a/src/auditor/taler-auditor-httpd_emergency-get.c b/src/auditor/taler-auditor-httpd_emergency-get.c
index 64db84857..3afb4f639 100644
--- a/src/auditor/taler-auditor-httpd_emergency-get.c
+++ b/src/auditor/taler-auditor-httpd_emergency-get.c
@@ -107,58 +107,29 @@ TAH_EMERGENCY_handler_get (struct TAH_RequestHandler *rh,
ja = json_array ();
GNUNET_break (NULL != ja);
- int64_t limit = -20;
- uint64_t offset;
-
- TALER_MHD_parse_request_snumber (connection,
- "limit",
- &limit);
-
- if (limit < 0)
- offset = INT64_MAX;
- else
- offset = 0;
-
- TALER_MHD_parse_request_number (connection,
- "offset",
- &offset);
-
- bool return_suppressed = false;
-
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed),
- GNUNET_JSON_spec_end ()
- };
-
-
- // read the input json
- json_t *json_in;
+ int64_t limit = -20;
+ uint64_t offset;
+
+ TALER_MHD_parse_request_snumber (connection,
+ "limit",
+ &limit);
+
+ if (limit < 0)
+ offset = INT64_MAX;
+ else
+ offset = 0;
+
+ TALER_MHD_parse_request_number (connection,
+ "offset",
+ &offset);
+
+ bool return_suppressed = false;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
qs = TAH_plugin->get_emergency (