From 832b1a2cf43ed62dbd17827ca7d60a6cebd0066d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 29 Jun 2012 12:46:11 +0000 Subject: [PATCH] -check all fields for matches before removing --- src/namestore/gnunet-service-namestore.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index dd1e3f69d..81639fcab 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -1229,20 +1229,11 @@ handle_record_remove_it (void *cls, found = -1; for (c = 0; c < rd_count; c++) { - /* FIXME: shouldn't we test for all fields to match? Otherwise - we might remove the wrong record, just because the type matches! */ - /* - if (rd[c].flags != rrc->rd->flags) - continue;*/ - if (rd[c].record_type != rrc->rd->record_type) - continue; - /* - if (rd[c].data_size != rrc->rd->data_size) - continue; - GNUNET_break(0); - if (0 != memcmp (rd[c].data, rrc->rd->data, rrc->rd->data_size)) - continue; - GNUNET_break(0); */ + if ( (rd[c].flags != rrc->rd->flags) || + (rd[c].record_type != rrc->rd->record_type) || + (rd[c].data_size != rrc->rd->data_size) || + (0 != memcmp (rd[c].data, rrc->rd->data, rrc->rd->data_size)) ) + continue; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found record to remove!\n", rd_count); found = c; break; -- 2.25.1