gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -fix issue with tombstone deletion when


From: gnunet
Subject: [gnunet] branch master updated: -fix issue with tombstone deletion when records are added
Date: Sat, 05 Feb 2022 18:56:07 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 2c3a47c48 -fix issue with tombstone deletion when records are added
2c3a47c48 is described below

commit 2c3a47c48049f78a9ce467f21dff20ae3a0ae494
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sat Feb 5 18:56:01 2022 +0100

    -fix issue with tombstone deletion when records are added
---
 src/namestore/gnunet-service-namestore.c           | 25 +++++++++++-----------
 src/zonemaster/gnunet-service-zonemaster-monitor.c |  4 ++--
 src/zonemaster/gnunet-service-zonemaster.c         |  5 ++---
 3 files changed, 16 insertions(+), 18 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)
                 "Creating %u records for name `%s'\n",
                 (unsigned int) rd_count,
                 conv_name);
-    if ((0 == rd_count) &&
-        (GNUNET_NO == GSN_database->lookup_records (GSN_database->cls,
+    if ((GNUNET_NO == GSN_database->lookup_records (GSN_database->cls,
                                                     &rp_msg->private_key,
                                                     conv_name,
                                                     &lookup_tombstone_it,
-                                                    &tombstone)))
+                                                    &tombstone)) &&
+        (rd_count == 0))
     {
       /* This name does not exist, so cannot be removed */
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1573,19 +1573,17 @@ handle_record_store (void *cls, const struct 
RecordStoreMessage *rp_msg)
       have_tombstone = GNUNET_NO;
       for (unsigned int i = 0; i < rd_count; i++)
       {
-        rd_clean[rd_clean_off] = rd[i];
-        if (GNUNET_YES == GNUNET_GNSRECORD_is_critical (rd[i].record_type))
-          rd_clean[rd_clean_off].flags |= GNUNET_GNSRECORD_RF_CRITICAL;
         /* Do not allow to set tombstone records unless zonemaster */
         if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
         {
-          if (1 == ntohs (rp_msg->is_zonemaster))
-          {
-            have_tombstone = GNUNET_YES;
-            rd_clean_off++;
-          }
-          continue;
+          if (1 != ntohs (rp_msg->is_zonemaster))
+            continue;
+          have_tombstone = GNUNET_YES;
         }
+        rd_clean[rd_clean_off] = rd[i];
+        if (GNUNET_YES == GNUNET_GNSRECORD_is_critical (rd[i].record_type))
+          rd_clean[rd_clean_off].flags |= GNUNET_GNSRECORD_RF_CRITICAL;
+
         if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) ||
             (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type))
           rd_clean_off++;
@@ -1598,7 +1596,8 @@ handle_record_store (void *cls, const struct 
RecordStoreMessage *rp_msg)
         }
       }
       /* At this point we are either zonemaster and have set a new tombstone
-       * (have_tombstone) or we are not zonemaster and we may want to
+       * (have_tombstone)
+       * or we are not zonemaster and we may want to
        * add the old tombstone (if there was any and if it is not already
        * old).
        */
diff --git a/src/zonemaster/gnunet-service-zonemaster-monitor.c 
b/src/zonemaster/gnunet-service-zonemaster-monitor.c
index 081398f0e..b51d1cb97 100644
--- a/src/zonemaster/gnunet-service-zonemaster-monitor.c
+++ b/src/zonemaster/gnunet-service-zonemaster-monitor.c
@@ -265,13 +265,13 @@ convert_records_for_export (const struct 
GNUNET_GNSRECORD_Data *rd,
   now = GNUNET_TIME_absolute_get ();
   for (unsigned int i = 0; i < rd_count; i++)
   {
-    if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
-      continue;
     if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
     {
       tombstone = rd[i].data;
       continue;
     }
+    if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
+      continue;
     if ((0 == (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) &&
         (rd[i].expiration_time < now.abs_value_us))
       continue;   /* record already expired, skip it */
diff --git a/src/zonemaster/gnunet-service-zonemaster.c 
b/src/zonemaster/gnunet-service-zonemaster.c
index e478ceeab..3a8ac4be1 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -596,14 +596,13 @@ convert_records_for_export (const struct 
GNUNET_GNSRECORD_Data *rd,
   now = GNUNET_TIME_absolute_get ();
   for (unsigned int i = 0; i < rd_count; i++)
   {
-    if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
-      continue;
-    /* Should always be private but just to be sure */
     if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
     {
       tombstone = rd[i].data;
       continue;
     }
+    if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
+      continue;
     if ((0 == (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) &&
         (rd[i].expiration_time < now.abs_value_us))
       continue;   /* record already expired, skip it */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]