From 1090389d6f5deec84c25a7fdf8aa98c91079711a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Sun, 6 Feb 2022 20:01:24 +0100 Subject: [PATCH] =?UTF-8?q?Narf,=20letzter=20commit=20war=20unvollst=C3=A4?= =?UTF-8?q?ndig=20durch=20uncrustify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Towards a complete test with age restriction - substantial amount of fixes in various parts - slight refactoring of extensions - fixes of post handler for /management/extensions - fixes for offline tool extensions signing State: - compiles, runs and tests succeed when age restriction is not enabled - compiles, runs and tests fail, when age restriction is enabled --- src/exchange/taler-exchange-httpd.c | 2 +- src/exchange/taler-exchange-httpd_keys.c | 13 ++++++++----- .../taler-exchange-httpd_management_extensions.c | 13 ++++++------- src/json/json_helper.c | 1 + src/testing/test_exchange_api.c | 2 +- .../testing_api_cmd_offline_sign_extensions.c | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 0a1276c7b..6a6e7aae7 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -740,7 +740,7 @@ handle_post_management (struct TEH_RequestContext *rc, "extensions")) { return TEH_handler_management_post_extensions (rc->connection, - root); + root); } GNUNET_break_op (0); return r404 (rc->connection, diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 6e25876dc..98242e869 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -1858,8 +1858,8 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh) struct GNUNET_TIME_Timestamp last_cpd; struct GNUNET_CONTAINER_Heap *heap; struct GNUNET_HashContext *hash_context; - bool age_restriction_active = - TALER_extensions_is_enabled_type (TALER_Extension_AgeRestriction); + bool age_restriction_active = + TALER_extensions_is_enabled_type (TALER_Extension_AgeRestriction); sctx.signkeys = json_array (); GNUNET_assert (NULL != sctx.signkeys); @@ -1976,10 +1976,13 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh) * depending on the settings and the properties of the denomination */ if (age_restriction_active && (0 != dk->denom_pub.age_mask.mask)) - { - GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "got agerestricted denom %p with mask %d\n", &dk->denom_pub, dk->denom_pub.age_mask.mask); + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "got agerestricted denom %p with mask %d\n", + &dk->denom_pub, + dk->denom_pub.age_mask.mask); array = age_restricted_denoms; - } + } else array = denoms; diff --git a/src/exchange/taler-exchange-httpd_management_extensions.c b/src/exchange/taler-exchange-httpd_management_extensions.c index ce3ab3f13..ca009f60d 100644 --- a/src/exchange/taler-exchange-httpd_management_extensions.c +++ b/src/exchange/taler-exchange-httpd_management_extensions.c @@ -91,7 +91,7 @@ set_extensions (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } - GNUNET_assert(NULL != ext->config); + GNUNET_assert (NULL != ext->config); config = json_dumps (ext->config, JSON_COMPACT | JSON_SORT_KEYS); if (NULL == config) @@ -142,7 +142,6 @@ set_extensions (void *cls, } - static enum GNUNET_GenericReturnValue verify_extensions_from_json ( json_t *extensions, @@ -150,7 +149,7 @@ verify_extensions_from_json ( { const char*name; const struct TALER_Extension *extension; - size_t i=0; + size_t i = 0; json_t *blob; GNUNET_assert (NULL != extensions); @@ -158,12 +157,12 @@ verify_extensions_from_json ( sec->num_extensions = json_object_size (extensions); sec->extensions = GNUNET_new_array (sec->num_extensions, - struct Extension); + struct Extension); json_object_foreach (extensions, name, blob) { int critical = 0; - json_t *config; + json_t *config; const char *version = NULL; /* load and verify criticality, version, etc. */ @@ -259,8 +258,8 @@ TEH_handler_management_post_extensions ( "Received /management/extensions\n"); /* Now parse individual extensions and signatures from those objects. */ - if (GNUNET_OK != - verify_extensions_from_json (extensions, &sec)) + if (GNUNET_OK != + verify_extensions_from_json (extensions, &sec)) { GNUNET_JSON_parse_free (top_spec); return TALER_MHD_reply_with_error ( diff --git a/src/json/json_helper.c b/src/json/json_helper.c index c777f69c9..949354e24 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -658,4 +658,5 @@ TALER_JSON_spec_i18n_str (const char *name, return ret; } + /* end of json/json_helper.c */ diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index 5e72070e4..83f7cb4b7 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -988,7 +988,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_extensions ("offline-sign-extensions", - CONFIG_FILE), + CONFIG_FILE), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", CONFIG_FILE), TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", diff --git a/src/testing/testing_api_cmd_offline_sign_extensions.c b/src/testing/testing_api_cmd_offline_sign_extensions.c index 973c495f9..f39679f97 100644 --- a/src/testing/testing_api_cmd_offline_sign_extensions.c +++ b/src/testing/testing_api_cmd_offline_sign_extensions.c @@ -72,7 +72,7 @@ extensionssign_run (void *cls, "-L", "INFO", "extensions", "sign", - "upload", + "upload", NULL); if (NULL == ks->extensionssign_proc) {