Narf, letzter commit war unvollständig durch uncrustify

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
This commit is contained in:
Özgür Kesim 2022-02-06 20:01:24 +01:00
parent 932dcde25c
commit 1090389d6f
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
6 changed files with 18 additions and 15 deletions

View File

@ -740,7 +740,7 @@ handle_post_management (struct TEH_RequestContext *rc,
"extensions")) "extensions"))
{ {
return TEH_handler_management_post_extensions (rc->connection, return TEH_handler_management_post_extensions (rc->connection,
root); root);
} }
GNUNET_break_op (0); GNUNET_break_op (0);
return r404 (rc->connection, return r404 (rc->connection,

View File

@ -1858,8 +1858,8 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
struct GNUNET_TIME_Timestamp last_cpd; struct GNUNET_TIME_Timestamp last_cpd;
struct GNUNET_CONTAINER_Heap *heap; struct GNUNET_CONTAINER_Heap *heap;
struct GNUNET_HashContext *hash_context; struct GNUNET_HashContext *hash_context;
bool age_restriction_active = bool age_restriction_active =
TALER_extensions_is_enabled_type (TALER_Extension_AgeRestriction); TALER_extensions_is_enabled_type (TALER_Extension_AgeRestriction);
sctx.signkeys = json_array (); sctx.signkeys = json_array ();
GNUNET_assert (NULL != sctx.signkeys); 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 */ * depending on the settings and the properties of the denomination */
if (age_restriction_active && if (age_restriction_active &&
(0 != dk->denom_pub.age_mask.mask)) (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; array = age_restricted_denoms;
} }
else else
array = denoms; array = denoms;

View File

@ -91,7 +91,7 @@ set_extensions (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR; 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); config = json_dumps (ext->config, JSON_COMPACT | JSON_SORT_KEYS);
if (NULL == config) if (NULL == config)
@ -142,7 +142,6 @@ set_extensions (void *cls,
} }
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
verify_extensions_from_json ( verify_extensions_from_json (
json_t *extensions, json_t *extensions,
@ -150,7 +149,7 @@ verify_extensions_from_json (
{ {
const char*name; const char*name;
const struct TALER_Extension *extension; const struct TALER_Extension *extension;
size_t i=0; size_t i = 0;
json_t *blob; json_t *blob;
GNUNET_assert (NULL != extensions); GNUNET_assert (NULL != extensions);
@ -158,12 +157,12 @@ verify_extensions_from_json (
sec->num_extensions = json_object_size (extensions); sec->num_extensions = json_object_size (extensions);
sec->extensions = GNUNET_new_array (sec->num_extensions, sec->extensions = GNUNET_new_array (sec->num_extensions,
struct Extension); struct Extension);
json_object_foreach (extensions, name, blob) json_object_foreach (extensions, name, blob)
{ {
int critical = 0; int critical = 0;
json_t *config; json_t *config;
const char *version = NULL; const char *version = NULL;
/* load and verify criticality, version, etc. */ /* load and verify criticality, version, etc. */
@ -259,8 +258,8 @@ TEH_handler_management_post_extensions (
"Received /management/extensions\n"); "Received /management/extensions\n");
/* Now parse individual extensions and signatures from those objects. */ /* Now parse individual extensions and signatures from those objects. */
if (GNUNET_OK != if (GNUNET_OK !=
verify_extensions_from_json (extensions, &sec)) verify_extensions_from_json (extensions, &sec))
{ {
GNUNET_JSON_parse_free (top_spec); GNUNET_JSON_parse_free (top_spec);
return TALER_MHD_reply_with_error ( return TALER_MHD_reply_with_error (

View File

@ -658,4 +658,5 @@ TALER_JSON_spec_i18n_str (const char *name,
return ret; return ret;
} }
/* end of json/json_helper.c */ /* end of json/json_helper.c */

View File

@ -988,7 +988,7 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_extensions ("offline-sign-extensions", 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", TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",

View File

@ -72,7 +72,7 @@ extensionssign_run (void *cls,
"-L", "INFO", "-L", "INFO",
"extensions", "extensions",
"sign", "sign",
"upload", "upload",
NULL); NULL);
if (NULL == ks->extensionssign_proc) if (NULL == ks->extensionssign_proc)
{ {