-fix
[oweals/gnunet.git] / src / gns / plugin_block_gns.c
index ba1fd56e176fd19809b865008195174ae30d0726..637467a5cfe8af8de982a80a4d5e01cf9e1714f2 100644 (file)
@@ -135,7 +135,8 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
   {
     struct GNUNET_NAMESTORE_RecordData rd[rd_count];
     unsigned int i;
-    struct GNUNET_TIME_Absolute exp = GNUNET_TIME_UNIT_FOREVER_ABS;
+    uint64_t exp = UINT64_MAX;
+    struct GNUNET_TIME_Absolute et = GNUNET_TIME_UNIT_FOREVER_ABS;
     
     if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_len,
                                                                rd_data,
@@ -144,7 +145,6 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
     {
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
                  "Data invalid (%d bytes, %d records)\n", rd_len, rd_count);
-      GNUNET_break_op (0);
       return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
     }
 
@@ -154,32 +154,32 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
       record_xquery = ntohl(*((uint32_t*)xquery));
     
     for (i=0; i<rd_count; i++)
-    {
-      
-      exp = GNUNET_TIME_absolute_min (exp, rd[i].expiration);
-      
+    {     
+      GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
+      exp = GNUNET_MIN (exp, rd[i].expiration_time);
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-                 "Got record of size %d\n", rd[i].data_size);
-
+                "Got record of size %d expiration %u\n",
+     rd[i].data_size, rd[i].expiration_time);
       if ((record_xquery != 0)
           && (rd[i].record_type == record_xquery))
       {
         record_match++;
       }
     }
+    et.abs_value = exp;
     
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-               "Verifying signature of %d records for name %s\n",
-               rd_count, name);
+        "Verifying signature of %d records for name %s with expiration of %u\n",
+               rd_count, name, et.abs_value);
 
     if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (&nrb->public_key,
-                                                        exp,
+                                                        et,
                                                         name,
                                                         rd_count,
                                                         rd,
                                                         &nrb->signature))
     {
-      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Signature invalid for name %s\n");
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Signature invalid for %s\n", name);
       GNUNET_break_op (0);
       return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
     }