From 7c8c596991f6397ec3ca1911638acb2de721c7a7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 1 Feb 2017 16:57:36 +0100 Subject: [PATCH] use NULL as flag for evaluation of query, ensure we pass non-NULL for reply_block to evaluate reply even if reply is zero bytes long --- src/dht/gnunet-service-dht_datacache.c | 5 +++++ src/dht/plugin_block_dht.c | 3 +-- src/dns/plugin_block_dns.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 9b4dace67..74fa1cc29 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c @@ -170,9 +170,14 @@ datacache_get_iterator (void *cls, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path) { + static char non_null; struct GetRequestContext *ctx = cls; enum GNUNET_BLOCK_EvaluationResult eval; + if ( (NULL == data) && + (0 == data_size) ) + data = &non_null; /* point anywhere, but not to NULL */ + eval = GNUNET_BLOCK_evaluate (GDS_block_context, type, diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 8bb533961..4256a0fe6 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c @@ -75,8 +75,7 @@ block_plugin_dht_evaluate (void *cls, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; } - if ( (NULL == reply_block) || - (0 == reply_block_size) ) + if (NULL == reply_block) return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; if (reply_block_size < sizeof (struct GNUNET_MessageHeader)) { diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c index dc339dd25..8c6ec93ee 100644 --- a/src/dns/plugin_block_dns.c +++ b/src/dns/plugin_block_dns.c @@ -69,7 +69,7 @@ block_plugin_dns_evaluate (void *cls, if (0 != xquery_size) return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; - if (0 == reply_block_size) + if (NULL == reply_block) return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; if (sizeof (struct GNUNET_DNS_Advertisement) != reply_block_size) -- 2.25.1