From f178ee5c79255d00eec5ed421d2e503b8d176fd0 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 12 Mar 2012 10:18:53 +0000 Subject: -fixes, added get_authority api --- src/gns/plugin_block_gns.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/gns/plugin_block_gns.c') diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index fd6fcc250..4c8ab3eb9 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c @@ -72,6 +72,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, uint32_t rd_count; char* rd_data = NULL; int rd_len; + uint32_t record_xquery; unsigned int record_match; if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) @@ -102,7 +103,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; unsigned int i; - uint32_t record_xquery = ntohl(*((uint32_t*)xquery)); + struct GNUNET_TIME_Absolute exp = GNUNET_TIME_absolute_get_forever(); if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_len, rd_data, @@ -113,18 +114,26 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, "Data invalid (%d bytes, %d records)\n", rd_len, rd_count); return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; } + + if (xquery_size < sizeof(uint32_t)) + record_xquery = 0; + else + record_xquery = ntohl(*((uint32_t*)xquery)); for (i=0; ipublic_key, - GNUNET_TIME_absolute_get_forever(), + exp, name, rd_count, rd, @@ -136,7 +145,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, } //No record matches query - if ((xquery_size > 0) && (record_match == 0)) + if ((record_xquery != 0) && (record_match == 0)) return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Records match\n"); -- cgit v1.2.3