commit 2b86b51b1cb535f75882ca70ee884adca8e6949c
parent 616a9f9c000e9e80f2de059cce1caf6d0997329f
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 27 Oct 2022 11:33:59 +0200
disallow ANY for block type in PUTs; do return HELLOs for ANY in GET requests (see recent clarifications to R5N specification)
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
@@ -111,7 +111,7 @@ struct PeerPutMessage
struct GNUNET_MessageHeader header;
/**
- * Content type.
+ * Content type, must not be zero.
*/
uint32_t type GNUNET_PACKED;
@@ -1924,6 +1924,11 @@ check_dht_p2p_put (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ if (GNUNET_BLOCK_TYPE_ANY == htonl (put->type))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
return GNUNET_OK;
}
@@ -2357,7 +2362,8 @@ handle_dht_p2p_get (void *cls,
(GDS_am_closest_peer (&get->key,
peer_bf)) )
{
- if (GNUNET_BLOCK_TYPE_DHT_URL_HELLO == type)
+ if ( (GNUNET_BLOCK_TYPE_DHT_URL_HELLO == type) ||
+ (GNUNET_BLOCK_TYPE_ANY == type) )
{
GNUNET_STATISTICS_update (GDS_stats,
"# P2P HELLO lookup requests processed",
@@ -2481,7 +2487,8 @@ process_reply_with_path (const struct GNUNET_DATACACHE_Block *bd,
if (NULL != bd->put_path)
GNUNET_memcpy (xput_path,
bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
+ bd->put_path_length * sizeof(struct
+ GNUNET_DHT_PathElement));
GNUNET_memcpy (&xput_path[bd->put_path_length],
get_path,
get_path_length * sizeof(struct GNUNET_DHT_PathElement));