Compare commits

...

2 Commits

Author SHA1 Message Date
6a16449d15
more steps taken 2021-12-27 10:32:15 +01:00
caa816c2f9
logic fixed 2021-12-27 10:31:08 +01:00
4 changed files with 24 additions and 25 deletions

View File

@ -23,7 +23,6 @@
#include <gnunet/gnunet_json_lib.h> #include <gnunet/gnunet_json_lib.h>
#include <jansson.h> #include <jansson.h>
#include <microhttpd.h> #include <microhttpd.h>
#include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler_signatures.h" #include "taler_signatures.h"
@ -269,14 +268,13 @@ TEH_handler_management_post_extensions (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const json_t *root) const json_t *root)
{ {
#if 0 json_t *extensions;
json_t *denom_sigs; json_t *extensions_sigs;
json_t *signkey_sigs;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("denom_sigs", GNUNET_JSON_spec_json ("extensions",
&denom_sigs), &extensions),
GNUNET_JSON_spec_json ("signkey_sigs", GNUNET_JSON_spec_json ("extensions_sigs",
&signkey_sigs), &extensions_sigs),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
bool ok; bool ok;
@ -293,8 +291,8 @@ TEH_handler_management_post_extensions (
if (GNUNET_NO == res) if (GNUNET_NO == res)
return MHD_YES; /* failure */ return MHD_YES; /* failure */
} }
if (! (json_is_array (denom_sigs) && if (! (json_is_array (extensions) &&
json_is_array (signkey_sigs)) ) json_is_array (extensions_sigs)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
@ -302,10 +300,11 @@ TEH_handler_management_post_extensions (
connection, connection,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED, TALER_EC_GENERIC_PARAMETER_MALFORMED,
"array expected for denom_sigs and signkey_sigs"); "array expected for extensions and extensions_sig");
} }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received /management/keys\n"); "Received /management/keys\n");
#if 0
akc.nd_sigs = json_array_size (denom_sigs); akc.nd_sigs = json_array_size (denom_sigs);
akc.d_sigs = GNUNET_new_array (akc.nd_sigs, akc.d_sigs = GNUNET_new_array (akc.nd_sigs,
struct DenomSig); struct DenomSig);

View File

@ -2680,7 +2680,7 @@ TALER_EXCHANGE_post_management_keys_cancel (
struct TALER_EXCHANGE_ManagementPostExtensionsData struct TALER_EXCHANGE_ManagementPostExtensionsData
{ {
struct TALER_Extension *extensions; struct TALER_Extension *extensions;
struct TALER_MasterSignatureP *extension_sigs; struct TALER_MasterSignatureP *extensions_sigs;
uint32_t num_extensions; uint32_t num_extensions;
}; };

View File

@ -134,7 +134,7 @@ TALER_EXCHANGE_management_post_extensions (
CURL *eh = NULL; CURL *eh = NULL;
json_t *body; json_t *body;
json_t *extensions = NULL; json_t *extensions = NULL;
json_t *extension_sigs = NULL; json_t *extensions_sigs = NULL;
ph = GNUNET_new (struct TALER_EXCHANGE_ManagementPostExtensionsHandle); ph = GNUNET_new (struct TALER_EXCHANGE_ManagementPostExtensionsHandle);
ph->cb = cb; ph->cb = cb;
@ -183,16 +183,16 @@ TALER_EXCHANGE_management_post_extensions (
config) config)
))); )));
} }
extension_sigs = json_array (); extensions_sigs = json_array ();
GNUNET_assert (NULL != extension_sigs); GNUNET_assert (NULL != extensions_sigs);
for (unsigned int i = 0; i<pkd->num_extensions; i++) for (unsigned int i = 0; i<pkd->num_extensions; i++)
{ {
const struct TALER_MasterSignatureP *sks const struct TALER_MasterSignatureP *sks
= &pkd->extension_sigs[i]; = &pkd->extensions_sigs[i];
GNUNET_assert (0 == GNUNET_assert (0 ==
json_array_append_new ( json_array_append_new (
extension_sigs, extensions_sigs,
GNUNET_JSON_PACK ( GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("extension_sig", GNUNET_JSON_pack_data_auto ("extension_sig",
&sks->eddsa_signature)))); &sks->eddsa_signature))));
@ -200,8 +200,8 @@ TALER_EXCHANGE_management_post_extensions (
body = GNUNET_JSON_PACK ( body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_array_steal ("extensions", GNUNET_JSON_pack_array_steal ("extensions",
extensions), extensions),
GNUNET_JSON_pack_array_steal ("extension_sigs", GNUNET_JSON_pack_array_steal ("extensions_sigs",
extension_sigs)); extensions_sigs));
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh); GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=

View File

@ -38,12 +38,12 @@ TALER_get_age_mask (const struct GNUNET_CONFIGURATION_Handle *cfg,
char *groups; char *groups;
enum TALER_Extension_ReturnValue ret = TALER_Extension_ERROR_SYS; enum TALER_Extension_ReturnValue ret = TALER_Extension_ERROR_SYS;
if ((GNUNET_NO == GNUNET_CONFIGURATION_have_value (cfg, if ((GNUNET_YES != GNUNET_CONFIGURATION_have_value (cfg,
TALER_EXTENSION_SECTION_AGE_RESTRICTION, TALER_EXTENSION_SECTION_AGE_RESTRICTION,
"ENABLED")) || "ENABLED")) ||
(GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (cfg, (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (cfg,
TALER_EXTENSION_SECTION_AGE_RESTRICTION, TALER_EXTENSION_SECTION_AGE_RESTRICTION,
"ENABLED"))) "ENABLED")))
{ {
/* Age restriction is not enabled */ /* Age restriction is not enabled */
mask->mask = 0; mask->mask = 0;