-check all fields for matches before removing
authorChristian Grothoff <christian@grothoff.org>
Fri, 29 Jun 2012 12:46:11 +0000 (12:46 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 29 Jun 2012 12:46:11 +0000 (12:46 +0000)
src/namestore/gnunet-service-namestore.c

index dd1e3f69d092af9dbc0c345f3a88a80d1fb72e94..81639fcab6d4733e03570618a70854c78537dd18 100644 (file)
@@ -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;