[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30301 - gnunet/src/gnsrecord
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30301 - gnunet/src/gnsrecord |
Date: |
Fri, 18 Oct 2013 13:39:51 +0200 |
Author: grothoff
Date: 2013-10-18 13:39:51 +0200 (Fri, 18 Oct 2013)
New Revision: 30301
Modified:
gnunet/src/gnsrecord/gnsrecord_crypto.c
Log:
-remove expired records immediately after decryption
Modified: gnunet/src/gnsrecord/gnsrecord_crypto.c
===================================================================
--- gnunet/src/gnsrecord/gnsrecord_crypto.c 2013-10-18 11:37:58 UTC (rev
30300)
+++ gnunet/src/gnsrecord/gnsrecord_crypto.c 2013-10-18 11:39:51 UTC (rev
30301)
@@ -204,6 +204,9 @@
}
{
struct GNUNET_GNSRECORD_Data rd[rd_count];
+ unsigned int i;
+ unsigned int j;
+ struct GNUNET_TIME_Absolute now;
if (GNUNET_OK !=
GNUNET_GNSRECORD_records_deserialize (payload_len - sizeof (uint32_t),
@@ -214,6 +217,25 @@
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ /* hide expired records */
+ now = GNUNET_TIME_absolute_get ();
+ j = 0;
+ for (i=0;i<rd_count;i++)
+ {
+ if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
+ {
+ /* encrypted blocks must never have relative expiration times, skip!
*/
+ GNUNET_break_op (0);
+ continue;
+ }
+ if (rd[i].expiration_time >= now.abs_value_us)
+ {
+ if (j != i)
+ rd[j] = rd[i];
+ j++;
+ }
+ }
+ rd_count = j;
if (NULL != proc)
proc (proc_cls, rd_count, (0 != rd_count) ? rd : NULL);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30301 - gnunet/src/gnsrecord,
gnunet <=