From 83095b7bbf49263d66ab1d89d0535e8fee2a9d01 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 1 Aug 2018 03:26:50 +0200 Subject: -fix json and namestore --- src/json/json_generator.c | 2 +- src/json/json_gnsrecord.c | 12 ++++++++++-- src/namestore/plugin_rest_namestore.c | 10 +--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/json/json_generator.c b/src/json/json_generator.c index 7b24a3c12..d8c82bc86 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c @@ -166,7 +166,7 @@ GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig) */ json_t * GNUNET_JSON_from_gns_record (const char* rname, - const struct GNUNET_GNSRECORD_Data *rd) + const struct GNUNET_GNSRECORD_Data *rd) { struct GNUNET_TIME_Absolute expiration_time; const char *expiration_time_str; diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c index 48b78f38b..4f6d30748 100644 --- a/src/json/json_gnsrecord.c +++ b/src/json/json_gnsrecord.c @@ -23,7 +23,6 @@ */ #include "platform.h" #include "gnunet_util_lib.h" -#include "gnunet_gnsrecord_lib.h" #include "gnunet_json_lib.h" #define GNUNET_JSON_GNSRECORD_VALUE "value" @@ -111,7 +110,16 @@ parse_gnsrecordobject (void *cls, } else { - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Value invalid for expiration time"); + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Expiration time invalid"); + return GNUNET_SYSERR; + } + // check if flag is a valid enum value + if ((GNUNET_GNSRECORD_RF_NONE != flag) + && (GNUNET_GNSRECORD_RF_PRIVATE != flag) + && (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION != flag) + && (GNUNET_GNSRECORD_RF_SHADOW_RECORD) != flag) + { + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Flag invalid"); return GNUNET_SYSERR; } gnsrecord_object->flags = (enum GNUNET_GNSRECORD_Flags)flag; diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 6924c53a4..90928165e 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -32,6 +32,7 @@ #include "microhttpd.h" #include + #define GNUNET_REST_API_NS_NAMESTORE "/namestore" #define GNUNET_REST_SUBSYSTEM_NAMESTORE "namestore" @@ -40,8 +41,6 @@ #define GNUNET_REST_NAMESTORE_RD_COUNT 1 -//TODO define other variables - /** * The configuration handle */ @@ -60,8 +59,6 @@ struct Plugin const struct GNUNET_CONFIGURATION_Handle *cfg; }; -//TODO add specific structs - /** * The default namestore ego */ @@ -86,8 +83,6 @@ struct EgoEntry struct RequestHandle { - //TODO add specific entries - /** * Records to store */ @@ -180,8 +175,6 @@ struct RequestHandle }; - -//TODO add specific cleanup /** * Cleanup lookup handle * @param handle Handle to clean up @@ -638,7 +631,6 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, static void init_cont (struct RequestHandle *handle) { - //TODO specify parameter of init_cont if necessary struct GNUNET_REST_RequestHandlerError err; static const struct GNUNET_REST_RequestHandler handlers[] = { {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_NAMESTORE, &namestore_get}, -- cgit v1.2.3