aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-02-05 18:56:01 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-02-05 18:56:01 +0100
commit2c3a47c48049f78a9ce467f21dff20ae3a0ae494 (patch)
tree604a9b373e1d9048d07f4b2436fd08afbbec91f0 /src/namestore
parentaa85ac347e31b22bcd86c6fbe9875dc4ffa93229 (diff)
downloadgnunet-2c3a47c48049f78a9ce467f21dff20ae3a0ae494.tar.gz
gnunet-2c3a47c48049f78a9ce467f21dff20ae3a0ae494.zip
-fix issue with tombstone deletion when records are added
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 2096c7bce..7669e90f5 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1542,12 +1542,12 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg)
1542 "Creating %u records for name `%s'\n", 1542 "Creating %u records for name `%s'\n",
1543 (unsigned int) rd_count, 1543 (unsigned int) rd_count,
1544 conv_name); 1544 conv_name);
1545 if ((0 == rd_count) && 1545 if ((GNUNET_NO == GSN_database->lookup_records (GSN_database->cls,
1546 (GNUNET_NO == GSN_database->lookup_records (GSN_database->cls,
1547 &rp_msg->private_key, 1546 &rp_msg->private_key,
1548 conv_name, 1547 conv_name,
1549 &lookup_tombstone_it, 1548 &lookup_tombstone_it,
1550 &tombstone))) 1549 &tombstone)) &&
1550 (rd_count == 0))
1551 { 1551 {
1552 /* This name does not exist, so cannot be removed */ 1552 /* This name does not exist, so cannot be removed */
1553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1573,19 +1573,17 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg)
1573 have_tombstone = GNUNET_NO; 1573 have_tombstone = GNUNET_NO;
1574 for (unsigned int i = 0; i < rd_count; i++) 1574 for (unsigned int i = 0; i < rd_count; i++)
1575 { 1575 {
1576 rd_clean[rd_clean_off] = rd[i];
1577 if (GNUNET_YES == GNUNET_GNSRECORD_is_critical (rd[i].record_type))
1578 rd_clean[rd_clean_off].flags |= GNUNET_GNSRECORD_RF_CRITICAL;
1579 /* Do not allow to set tombstone records unless zonemaster */ 1576 /* Do not allow to set tombstone records unless zonemaster */
1580 if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type) 1577 if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
1581 { 1578 {
1582 if (1 == ntohs (rp_msg->is_zonemaster)) 1579 if (1 != ntohs (rp_msg->is_zonemaster))
1583 { 1580 continue;
1584 have_tombstone = GNUNET_YES; 1581 have_tombstone = GNUNET_YES;
1585 rd_clean_off++;
1586 }
1587 continue;
1588 } 1582 }
1583 rd_clean[rd_clean_off] = rd[i];
1584 if (GNUNET_YES == GNUNET_GNSRECORD_is_critical (rd[i].record_type))
1585 rd_clean[rd_clean_off].flags |= GNUNET_GNSRECORD_RF_CRITICAL;
1586
1589 if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) || 1587 if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) ||
1590 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type)) 1588 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type))
1591 rd_clean_off++; 1589 rd_clean_off++;
@@ -1598,7 +1596,8 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg)
1598 } 1596 }
1599 } 1597 }
1600 /* At this point we are either zonemaster and have set a new tombstone 1598 /* At this point we are either zonemaster and have set a new tombstone
1601 * (have_tombstone) or we are not zonemaster and we may want to 1599 * (have_tombstone)
1600 * or we are not zonemaster and we may want to
1602 * add the old tombstone (if there was any and if it is not already 1601 * add the old tombstone (if there was any and if it is not already
1603 * old). 1602 * old).
1604 */ 1603 */