aboutsummaryrefslogtreecommitdiff
path: root/src/zonemaster/gnunet-service-zonemaster.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-13 21:17:12 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-13 21:17:12 +0200
commit98ac2b34f979cf10da24c984e690dabf7b34794b (patch)
treeed4fd15409066b5403f02c23aab9e14b179bc874 /src/zonemaster/gnunet-service-zonemaster.c
parentfa2978883e1585b1eeff3a22b7a9b4f174a45ca3 (diff)
add some extra GNS-record well-formedness checks if logging is enabled
Diffstat (limited to 'src/zonemaster/gnunet-service-zonemaster.c')
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index 0a562beb10..81d6fa2d96 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -540,24 +540,22 @@ convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd,
rd_public_count = 0;
now = GNUNET_TIME_absolute_get ();
for (unsigned int i=0;i<rd_count;i++)
- if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
+ {
+ 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 */
+ if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
{
- rd_public[rd_public_count] = rd[i];
- if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
- {
- /* GNUNET_GNSRECORD_block_create will convert to absolute time;
- we just need to adjust our iteration frequency */
- min_relative_record_time.rel_value_us =
- GNUNET_MIN (rd_public[rd_public_count].expiration_time,
- min_relative_record_time.rel_value_us);
- }
- else if (rd_public[rd_public_count].expiration_time < now.abs_value_us)
- {
- /* record already expired, skip it */
- continue;
- }
- rd_public_count++;
+ /* GNUNET_GNSRECORD_block_create will convert to absolute time;
+ we just need to adjust our iteration frequency */
+ min_relative_record_time.rel_value_us =
+ GNUNET_MIN (rd[i].expiration_time,
+ min_relative_record_time.rel_value_us);
}
+ rd_public[rd_public_count++] = rd[i];
+ }
return rd_public_count;
}