diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-29 15:55:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-29 15:55:08 +0000 |
commit | 20bef67d7b8a216bd2ebaafb30dbb19770e549c2 (patch) | |
tree | 8470bed089ee511e844b726aa0a3171b54aa76fe /src | |
parent | b510c934e38ef0eb4ea959af5be94f4490ddb667 (diff) | |
download | gnunet-20bef67d7b8a216bd2ebaafb30dbb19770e549c2.tar.gz gnunet-20bef67d7b8a216bd2ebaafb30dbb19770e549c2.zip |
-more fixes to namestore
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_namestore_service.h | 52 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 240 | ||||
-rw-r--r-- | src/namestore/namestore_common.c | 16 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_create.c | 9 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 5 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_specific_type.c | 9 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_specific_zone.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_stop.c | 2 |
10 files changed, 218 insertions, 123 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 00c8ba26b..aa3ad8017 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -162,7 +162,13 @@ enum GNUNET_NAMESTORE_RecordFlags | |||
162 | * This expiration time of the record is a relative | 162 | * This expiration time of the record is a relative |
163 | * time (not an absolute time). | 163 | * time (not an absolute time). |
164 | */ | 164 | */ |
165 | GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8 | 165 | GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8, |
166 | |||
167 | /** | ||
168 | * This record should not be used unless all (other) records with an absolute | ||
169 | * expiration time have expired. | ||
170 | */ | ||
171 | GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16 | ||
166 | 172 | ||
167 | }; | 173 | }; |
168 | 174 | ||
@@ -256,6 +262,7 @@ GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyBinary | |||
256 | * Store an item in the namestore. If the item is already present, | 262 | * Store an item in the namestore. If the item is already present, |
257 | * the expiration time is updated to the max of the existing time and | 263 | * the expiration time is updated to the max of the existing time and |
258 | * the new time. This API is used by the authority of a zone. | 264 | * the new time. This API is used by the authority of a zone. |
265 | * FIXME: consider allowing to pass multiple records in one call! | ||
259 | * | 266 | * |
260 | * @param h handle to the namestore | 267 | * @param h handle to the namestore |
261 | * @param pkey private key of the zone | 268 | * @param pkey private key of the zone |
@@ -325,7 +332,14 @@ typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | |||
325 | 332 | ||
326 | /** | 333 | /** |
327 | * Get a result for a particular key from the namestore. The processor | 334 | * Get a result for a particular key from the namestore. The processor |
328 | * will only be called once. | 335 | * will only be called once. When using this functions, relative expiration |
336 | * times will be converted to absolute expiration times and a signature | ||
337 | * will be created if we are the authority. The record data and signature | ||
338 | * passed to 'proc' is thus always suitable for passing on to other peers | ||
339 | * (if we are the authority). If the record type is NOT set to 'ANY' and | ||
340 | * if we are NOT the authority, then non-matching records may be omitted | ||
341 | * from the result and no valid signature can be created; in this case, | ||
342 | * 'signature' will be NULL and the result cannot be given to other peers. | ||
329 | * | 343 | * |
330 | * @param h handle to the namestore | 344 | * @param h handle to the namestore |
331 | * @param zone zone to look up a record from | 345 | * @param zone zone to look up a record from |
@@ -339,10 +353,10 @@ typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | |||
339 | */ | 353 | */ |
340 | struct GNUNET_NAMESTORE_QueueEntry * | 354 | struct GNUNET_NAMESTORE_QueueEntry * |
341 | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | 355 | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, |
342 | const struct GNUNET_CRYPTO_ShortHashCode *zone, | 356 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
343 | const char *name, | 357 | const char *name, |
344 | uint32_t record_type, | 358 | uint32_t record_type, |
345 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls); | 359 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls); |
346 | 360 | ||
347 | 361 | ||
348 | /** | 362 | /** |
@@ -378,10 +392,12 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |||
378 | * | 392 | * |
379 | * 0) If the bit is clear, all relative expriation times are converted to | 393 | * 0) If the bit is clear, all relative expriation times are converted to |
380 | * absolute expiration times. This is useful for performing DHT PUT | 394 | * absolute expiration times. This is useful for performing DHT PUT |
381 | * operations (and zone transfers) of our zone. | 395 | * operations (and zone transfers) of our zone. The generated signatures |
396 | * will be valid for other peers. | ||
382 | * 1) if it is set, it means that relative expiration times should be | 397 | * 1) if it is set, it means that relative expiration times should be |
383 | * preserved when returned (this is useful for the zone editor user | 398 | * preserved when returned (this is useful for the zone editor user |
384 | * interface). | 399 | * interface). No signatures will be created in this case, as |
400 | * signatures must not cover records with relative expiration times. | ||
385 | * | 401 | * |
386 | * Note that not all queries against this interface are equally performant | 402 | * Note that not all queries against this interface are equally performant |
387 | * as for some combinations no efficient index may exist. | 403 | * as for some combinations no efficient index may exist. |
@@ -416,7 +432,9 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it); | |||
416 | 432 | ||
417 | 433 | ||
418 | /** | 434 | /** |
419 | * Stops iteration and releases the namestore handle for further calls. | 435 | * Stops iteration and releases the namestore handle for further calls. Must |
436 | * be called on any iteration that has not yet completed prior to calling | ||
437 | * 'GNUNET_NAMESTORE_disconnect'. | ||
420 | * | 438 | * |
421 | * @param it the iterator | 439 | * @param it the iterator |
422 | */ | 440 | */ |
@@ -426,7 +444,9 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it); | |||
426 | 444 | ||
427 | /** | 445 | /** |
428 | * Cancel a namestore operation. The final callback from the | 446 | * Cancel a namestore operation. The final callback from the |
429 | * operation must not have been done yet. | 447 | * operation must not have been done yet. Must be called on any |
448 | * namestore operation that has not yet completed prior to calling | ||
449 | * 'GNUNET_NAMESTORE_disconnect'. | ||
430 | * | 450 | * |
431 | * @param qe operation to cancel | 451 | * @param qe operation to cancel |
432 | */ | 452 | */ |
@@ -451,6 +471,7 @@ size_t | |||
451 | GNUNET_NAMESTORE_records_get_size (unsigned int rd_count, | 471 | GNUNET_NAMESTORE_records_get_size (unsigned int rd_count, |
452 | const struct GNUNET_NAMESTORE_RecordData *rd); | 472 | const struct GNUNET_NAMESTORE_RecordData *rd); |
453 | 473 | ||
474 | |||
454 | /** | 475 | /** |
455 | * Serialize the given records to the given destination buffer. | 476 | * Serialize the given records to the given destination buffer. |
456 | * | 477 | * |
@@ -494,6 +515,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, | |||
494 | int | 515 | int |
495 | GNUNET_NAMESTORE_check_name (const char * name); | 516 | GNUNET_NAMESTORE_check_name (const char * name); |
496 | 517 | ||
518 | |||
497 | /** | 519 | /** |
498 | * Convert the 'value' of a record to a string. | 520 | * Convert the 'value' of a record to a string. |
499 | * | 521 | * |
@@ -545,6 +567,16 @@ const char * | |||
545 | GNUNET_NAMESTORE_number_to_typename (uint32_t type); | 567 | GNUNET_NAMESTORE_number_to_typename (uint32_t type); |
546 | 568 | ||
547 | 569 | ||
570 | /** | ||
571 | * Test if a given record is expired. | ||
572 | * | ||
573 | * @return GNUNET_YES if the record is expired, | ||
574 | * GNUNET_NO if not | ||
575 | */ | ||
576 | int | ||
577 | GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd); | ||
578 | |||
579 | |||
548 | #if 0 /* keep Emacsens' auto-indent happy */ | 580 | #if 0 /* keep Emacsens' auto-indent happy */ |
549 | { | 581 | { |
550 | #endif | 582 | #endif |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index b8714f08d..a03f70d2a 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -24,8 +24,8 @@ | |||
24 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_getopt_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_service_lib.h" | 28 | #include "gnunet_dnsparser_lib.h" |
29 | #include "gnunet_namestore_service.h" | 29 | #include "gnunet_namestore_service.h" |
30 | #include "gnunet_namestore_plugin.h" | 30 | #include "gnunet_namestore_plugin.h" |
31 | #include "gnunet_signatures.h" | 31 | #include "gnunet_signatures.h" |
@@ -553,6 +553,7 @@ handle_lookup_name_it (void *cls, | |||
553 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 553 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
554 | struct GNUNET_CRYPTO_RsaSignature *signature_new; | 554 | struct GNUNET_CRYPTO_RsaSignature *signature_new; |
555 | struct GNUNET_TIME_Absolute e; | 555 | struct GNUNET_TIME_Absolute e; |
556 | struct GNUNET_TIME_Relative re; | ||
556 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; | 557 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; |
557 | struct GNUNET_HashCode long_hash; | 558 | struct GNUNET_HashCode long_hash; |
558 | char *rd_tmp; | 559 | char *rd_tmp; |
@@ -563,79 +564,139 @@ handle_lookup_name_it (void *cls, | |||
563 | int copied_elements; | 564 | int copied_elements; |
564 | int contains_signature; | 565 | int contains_signature; |
565 | int authoritative; | 566 | int authoritative; |
566 | int c; | 567 | int rd_modified; |
568 | unsigned int c; | ||
569 | |||
570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
571 | "Found %u records under name `%s'\n", | ||
572 | rd_count, | ||
573 | name); | ||
574 | authoritative = GNUNET_NO; | ||
575 | signature_new = NULL; | ||
576 | cc = NULL; | ||
577 | if (NULL != zone_key) | ||
578 | { | ||
579 | GNUNET_CRYPTO_short_hash (zone_key, | ||
580 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | ||
581 | &zone_key_hash); | ||
582 | GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash); | ||
583 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get (zonekeys, &long_hash))) | ||
584 | { | ||
585 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
586 | "Am authoritative for zone `%s'\n", | ||
587 | GNUNET_short_h2s (&zone_key_hash)); | ||
588 | authoritative = GNUNET_YES; | ||
589 | } | ||
590 | } | ||
567 | 591 | ||
568 | name_len = (NULL == name) ? 0 : strlen(name) + 1; | ||
569 | copied_elements = 0; | 592 | copied_elements = 0; |
593 | rd_modified = GNUNET_NO; | ||
570 | rd_selected = NULL; | 594 | rd_selected = NULL; |
571 | /* count records to copy */ | 595 | /* count records to copy */ |
572 | if (0 != lnc->record_type) | 596 | for (c = 0; c < rd_count; c++) |
597 | { | ||
598 | if ( (GNUNET_YES == authoritative) && | ||
599 | (GNUNET_YES == | ||
600 | GNUNET_NAMESTORE_is_expired (&rd[c]) ) ) | ||
601 | { | ||
602 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
603 | "Skipping expired record\n"); | ||
604 | continue; | ||
605 | } | ||
606 | if ( (GNUNET_NAMESTORE_TYPE_ANY == lnc->record_type) || | ||
607 | (rd[c].record_type == lnc->record_type) ) | ||
608 | copied_elements++; /* found matching record */ | ||
609 | else | ||
610 | { | ||
611 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
612 | "Skipping non-mtaching record\n"); | ||
613 | rd_modified = GNUNET_YES; | ||
614 | } | ||
615 | } | ||
616 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
617 | "Found %u records with type %u for name `%s' in zone `%s'\n", | ||
618 | copied_elements, | ||
619 | lnc->record_type, | ||
620 | lnc->name, | ||
621 | GNUNET_short_h2s(lnc->zone)); | ||
622 | if (copied_elements > 0) | ||
573 | { | 623 | { |
574 | /* special record type needed */ | 624 | rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
625 | copied_elements = 0; | ||
575 | for (c = 0; c < rd_count; c++) | 626 | for (c = 0; c < rd_count; c++) |
576 | if (rd[c].record_type == lnc->record_type) | ||
577 | copied_elements++; /* found matching record */ | ||
578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
579 | "Found %u records with type %u for name `%s' in zone `%s'\n", | ||
580 | copied_elements, | ||
581 | lnc->record_type, | ||
582 | lnc->name, | ||
583 | GNUNET_short_h2s(lnc->zone)); | ||
584 | if (copied_elements > 0) | ||
585 | { | 627 | { |
586 | rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 628 | if ( (GNUNET_YES == authoritative) && |
587 | copied_elements = 0; | 629 | (GNUNET_YES == |
588 | for (c = 0; c < rd_count; c++) | 630 | GNUNET_NAMESTORE_is_expired (&rd[c])) ) |
631 | continue; | ||
632 | if ( (GNUNET_NAMESTORE_TYPE_ANY == lnc->record_type) || | ||
633 | (rd[c].record_type == lnc->record_type) ) | ||
589 | { | 634 | { |
590 | if (rd[c].record_type == lnc->record_type) | 635 | if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) |
591 | { | 636 | { |
592 | /* found matching record */ | 637 | GNUNET_break (GNUNET_YES == authoritative); |
593 | rd_selected[copied_elements] = rd[c]; /* shallow copy! */ | 638 | rd_modified = GNUNET_YES; |
594 | copied_elements++; | 639 | re.rel_value = rd[c].expiration_time; |
640 | e = GNUNET_TIME_relative_to_absolute (re); | ||
595 | } | 641 | } |
642 | else | ||
643 | { | ||
644 | e.abs_value = rd[c].expiration_time; | ||
645 | } | ||
646 | /* found matching record, copy and convert flags to public format */ | ||
647 | rd_selected[copied_elements] = rd[c]; /* shallow copy! */ | ||
648 | rd_selected[copied_elements].expiration_time = e.abs_value; | ||
649 | if (0 != (rd_selected[copied_elements].flags & | ||
650 | (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION | GNUNET_NAMESTORE_RF_AUTHORITY))) | ||
651 | { | ||
652 | rd_selected[copied_elements].flags &= ~ (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION | | ||
653 | GNUNET_NAMESTORE_RF_AUTHORITY); | ||
654 | rd_modified = GNUNET_YES; | ||
655 | } | ||
656 | copied_elements++; | ||
657 | } | ||
658 | else | ||
659 | { | ||
660 | rd_modified = GNUNET_YES; | ||
596 | } | 661 | } |
597 | } | 662 | } |
598 | } | 663 | } |
599 | else | 664 | else |
600 | { | 665 | rd_selected = NULL; |
601 | copied_elements = rd_count; | 666 | |
602 | rd_selected = (struct GNUNET_NAMESTORE_RecordData *) rd; | ||
603 | } | ||
604 | // FIXME: need to adjust 'rd' from relative to absolute times! | ||
605 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 667 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
606 | "Found %u records for name `%s' in zone `%s'\n", | 668 | "Found %u matching records for name `%s' in zone `%s'\n", |
607 | copied_elements, | 669 | copied_elements, |
608 | lnc->name, | 670 | lnc->name, |
609 | GNUNET_short_h2s (lnc->zone)); | 671 | GNUNET_short_h2s (lnc->zone)); |
610 | 672 | contains_signature = GNUNET_NO; | |
611 | if ((copied_elements == rd_count) && (NULL != signature)) | 673 | if (copied_elements > 0) |
612 | contains_signature = GNUNET_YES; /* returning all records, so include signature */ | ||
613 | else | ||
614 | contains_signature = GNUNET_NO; /* returning not all records, so do not include signature */ | ||
615 | |||
616 | authoritative = GNUNET_NO; | ||
617 | signature_new = NULL; | ||
618 | if ((NULL != zone_key) && (copied_elements == rd_count)) | ||
619 | { | 674 | { |
620 | GNUNET_CRYPTO_short_hash (zone_key, | 675 | if (GNUNET_YES == authoritative) |
621 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | ||
622 | &zone_key_hash); | ||
623 | GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash); | ||
624 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash))) | ||
625 | { | 676 | { |
677 | GNUNET_assert (NULL != cc); | ||
626 | e = get_block_expiration_time (rd_count, rd); | 678 | e = get_block_expiration_time (rd_count, rd); |
627 | signature_new = GNUNET_NAMESTORE_create_signature (cc->privkey, e, name, rd, rd_count); | 679 | signature_new = GNUNET_NAMESTORE_create_signature (cc->privkey, e, name, rd_selected, copied_elements); |
628 | GNUNET_assert (NULL != signature_new); | 680 | GNUNET_assert (NULL != signature_new); |
629 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
630 | "Creating signature for name `%s' with %u records in zone `%s'\n", | 682 | "Creating signature for name `%s' with %u records in zone `%s'\n", |
631 | name, | 683 | name, |
632 | copied_elements, | 684 | copied_elements, |
633 | GNUNET_short_h2s(&zone_key_hash)); | 685 | GNUNET_short_h2s(&zone_key_hash)); |
634 | authoritative = GNUNET_YES; | 686 | } |
687 | else | ||
688 | { | ||
689 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
690 | "Not authoritative, records modified is %d, have sig is %d\n", | ||
691 | rd_modified, | ||
692 | NULL != signature); | ||
693 | if ((GNUNET_NO == rd_modified) && (NULL != signature)) | ||
694 | contains_signature = GNUNET_YES; /* returning all records, so include signature */ | ||
635 | } | 695 | } |
636 | } | 696 | } |
637 | 697 | ||
638 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (copied_elements, rd_selected); | 698 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (copied_elements, rd_selected); |
699 | name_len = (NULL == name) ? 0 : strlen(name) + 1; | ||
639 | r_size = sizeof (struct LookupNameResponseMessage) + | 700 | r_size = sizeof (struct LookupNameResponseMessage) + |
640 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) + | 701 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) + |
641 | name_len + | 702 | name_len + |
@@ -656,13 +717,12 @@ handle_lookup_name_it (void *cls, | |||
656 | memcpy (name_tmp, name, name_len); | 717 | memcpy (name_tmp, name, name_len); |
657 | rd_tmp = &name_tmp[name_len]; | 718 | rd_tmp = &name_tmp[name_len]; |
658 | GNUNET_NAMESTORE_records_serialize (copied_elements, rd_selected, rd_ser_len, rd_tmp); | 719 | GNUNET_NAMESTORE_records_serialize (copied_elements, rd_selected, rd_ser_len, rd_tmp); |
659 | |||
660 | if (rd_selected != rd) | 720 | if (rd_selected != rd) |
661 | GNUNET_free_non_null (rd_selected); | 721 | GNUNET_free_non_null (rd_selected); |
662 | |||
663 | if (NULL != zone_key) | 722 | if (NULL != zone_key) |
664 | lnr_msg->public_key = *zone_key; | 723 | lnr_msg->public_key = *zone_key; |
665 | if (GNUNET_YES == authoritative) | 724 | if ( (GNUNET_YES == authoritative) && |
725 | (copied_elements > 0) ) | ||
666 | { | 726 | { |
667 | /* use new created signature */ | 727 | /* use new created signature */ |
668 | lnr_msg->contains_sig = htons (GNUNET_YES); | 728 | lnr_msg->contains_sig = htons (GNUNET_YES); |
@@ -957,35 +1017,31 @@ handle_create_record_it (void *cls, | |||
957 | update = GNUNET_NO; | 1017 | update = GNUNET_NO; |
958 | for (c = 0; c < rd_count; c++) | 1018 | for (c = 0; c < rd_count; c++) |
959 | { | 1019 | { |
960 | if (crc->rd->record_type != rd[c].record_type) | 1020 | if ( (crc->rd->record_type != rd[c].record_type) || |
1021 | ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) | ||
1022 | != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) ) | ||
961 | continue; /* no match */ | 1023 | continue; /* no match */ |
962 | if ( (GNUNET_NAMESTORE_TYPE_PKEY == crc->rd->record_type) || | 1024 | if ( (GNUNET_NAMESTORE_TYPE_PKEY == crc->rd->record_type) || |
963 | (GNUNET_NAMESTORE_TYPE_PSEU == crc->rd->record_type) ) | 1025 | (GNUNET_NAMESTORE_TYPE_PSEU == crc->rd->record_type) || |
1026 | (GNUNET_DNSPARSER_TYPE_CNAME == crc->rd->record_type) ) | ||
964 | { | 1027 | { |
965 | /* Update unique PKEY or PSEU */ | 1028 | /* Update unique PKEY, PSEU or CNAME record; for these |
966 | /* FIXME: should we do this test here? Is this not something | 1029 | record types, only one can be active at any time */ |
967 | that should be handled closer to the UI? If not, what | ||
968 | about othrer 'unique' record types like CNAME? */ | ||
969 | exist = c; | 1030 | exist = c; |
970 | if ( (crc->rd->data_size != rd[c].data_size) || | 1031 | if ( (crc->rd->data_size != rd[c].data_size) || |
971 | (0 != memcmp (crc->rd->data, rd[c].data, rd[c].data_size)) || | 1032 | (0 != memcmp (crc->rd->data, rd[c].data, rd[c].data_size)) || |
972 | (crc->rd->expiration_time != rd[c].expiration_time) || | 1033 | (crc->rd->expiration_time != rd[c].expiration_time) ) |
973 | ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) | ||
974 | != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) ) | ||
975 | update = GNUNET_YES; | 1034 | update = GNUNET_YES; |
976 | break; | 1035 | break; |
977 | } | 1036 | } |
978 | if ( (crc->rd->data_size == rd[c].data_size) && | 1037 | if ( (crc->rd->data_size == rd[c].data_size) && |
979 | (0 == memcmp (crc->rd->data, rd[c].data, rd[c].data_size))) | 1038 | (0 == memcmp (crc->rd->data, rd[c].data, rd[c].data_size))) |
980 | { | 1039 | { |
981 | /* FIXME: again, do we need to handle this special case here? */ | ||
982 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1040 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
983 | "Found matching existing record for `%s'; only updating expiration date!\n", | 1041 | "Found matching existing record for `%s'; only updating expiration date!\n", |
984 | crc->name); | 1042 | crc->name); |
985 | exist = c; | 1043 | exist = c; |
986 | if ( (crc->rd->expiration_time != rd[c].expiration_time) && | 1044 | if (crc->rd->expiration_time != rd[c].expiration_time) |
987 | ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) | ||
988 | == (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) ) ) | ||
989 | update = GNUNET_YES; | 1045 | update = GNUNET_YES; |
990 | break; | 1046 | break; |
991 | } | 1047 | } |
@@ -1682,7 +1738,7 @@ zone_iteraterate_proc (void *cls, | |||
1682 | { | 1738 | { |
1683 | // FIXME: new expiration flags need additional special treatment here! | 1739 | // FIXME: new expiration flags need additional special treatment here! |
1684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1740 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1685 | "Record %i has flags: 0x%x must have 0x%x \n", | 1741 | "Record %i has flags: 0x%x must have 0x%x\n", |
1686 | c, rd[c].flags, | 1742 | c, rd[c].flags, |
1687 | proc->zi->must_have_flags); | 1743 | proc->zi->must_have_flags); |
1688 | include = GNUNET_YES; | 1744 | include = GNUNET_YES; |
@@ -1719,43 +1775,39 @@ zone_iteraterate_proc (void *cls, | |||
1719 | "Included %u of %u records\n", | 1775 | "Included %u of %u records\n", |
1720 | rd_count_filtered, rd_count); | 1776 | rd_count_filtered, rd_count); |
1721 | 1777 | ||
1722 | /* compute / obtain signature */ | 1778 | signature = NULL; |
1723 | GNUNET_CRYPTO_short_hash (zone_key, | 1779 | if (rd_count_filtered > 0) |
1724 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | ||
1725 | &zone_hash); | ||
1726 | GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash); | ||
1727 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash))) | ||
1728 | { | ||
1729 | expire = get_block_expiration_time (rd_count_filtered, rd_filtered); | ||
1730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1731 | "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", | ||
1732 | name, GNUNET_short_h2s(&zone_hash), | ||
1733 | rd_count_filtered, | ||
1734 | (unsigned long long) expire.abs_value); | ||
1735 | new_signature = GNUNET_NAMESTORE_create_signature (cc->privkey, expire, name, | ||
1736 | rd_filtered, rd_count_filtered); | ||
1737 | GNUNET_assert (NULL != signature); | ||
1738 | signature = new_signature; | ||
1739 | } | ||
1740 | else if (rd_count_filtered == rd_count) | ||
1741 | { | 1780 | { |
1742 | if (NULL != signature) | 1781 | /* compute / obtain signature */ |
1782 | GNUNET_CRYPTO_short_hash (zone_key, | ||
1783 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | ||
1784 | &zone_hash); | ||
1785 | GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash); | ||
1786 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash))) | ||
1743 | { | 1787 | { |
1744 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1788 | expire = get_block_expiration_time (rd_count_filtered, rd_filtered); |
1745 | "Using provided signature for `%s' in zone `%s' with %u records and expiration %llu\n", | 1789 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1746 | name, GNUNET_short_h2s (&zone_hash), rd_count_filtered, | 1790 | "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", |
1791 | name, GNUNET_short_h2s(&zone_hash), | ||
1792 | rd_count_filtered, | ||
1747 | (unsigned long long) expire.abs_value); | 1793 | (unsigned long long) expire.abs_value); |
1748 | return; | 1794 | new_signature = GNUNET_NAMESTORE_create_signature (cc->privkey, expire, name, |
1749 | } | 1795 | rd_filtered, rd_count_filtered); |
1750 | } | 1796 | GNUNET_assert (NULL != new_signature); |
1751 | else | 1797 | signature = new_signature; |
1752 | { | 1798 | } |
1753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1799 | else if (rd_count_filtered == rd_count) |
1754 | "No signature provided for `%s'\n", | 1800 | { |
1755 | name); | 1801 | if (NULL != signature) |
1756 | signature = NULL; | 1802 | { |
1803 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1804 | "Using provided signature for `%s' in zone `%s' with %u records and expiration %llu\n", | ||
1805 | name, GNUNET_short_h2s (&zone_hash), rd_count_filtered, | ||
1806 | (unsigned long long) expire.abs_value); | ||
1807 | return; | ||
1808 | } | ||
1809 | } | ||
1757 | } | 1810 | } |
1758 | |||
1759 | if (GNUNET_YES == proc->zi->has_zone) | 1811 | if (GNUNET_YES == proc->zi->has_zone) |
1760 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1761 | "Sending name `%s' for iteration over zone `%s'\n", | 1813 | "Sending name `%s' for iteration over zone `%s'\n", |
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 5698236c5..8a2e15e2a 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -614,6 +614,22 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type) | |||
614 | return name_map[i].name; | 614 | return name_map[i].name; |
615 | } | 615 | } |
616 | 616 | ||
617 | /** | ||
618 | * Test if a given record is expired. | ||
619 | * | ||
620 | * @return GNUNET_YES if the record is expired, | ||
621 | * GNUNET_NO if not | ||
622 | */ | ||
623 | int | ||
624 | GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) | ||
625 | { | ||
626 | struct GNUNET_TIME_Absolute at; | ||
627 | |||
628 | if (0 != (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) | ||
629 | return GNUNET_NO; | ||
630 | at.abs_value = rd->expiration_time; | ||
631 | return (0 == GNUNET_TIME_absolute_get_remaining (at).rel_value) ? GNUNET_YES : GNUNET_NO; | ||
632 | } | ||
617 | 633 | ||
618 | 634 | ||
619 | /* end of namestore_common.c */ | 635 | /* end of namestore_common.c */ |
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c index 9c794b235..b04e236ba 100644 --- a/src/namestore/test_namestore_api_create.c +++ b/src/namestore/test_namestore_api_create.c | |||
@@ -152,13 +152,13 @@ name_lookup_second_proc (void *cls, | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(zone_key, expire, n, rd_count, rd, signature)) | 155 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (zone_key, expire, n, rd_count, rd, signature)) |
156 | { | 156 | { |
157 | GNUNET_break (0); | 157 | GNUNET_break (0); |
158 | failed = GNUNET_YES; | 158 | failed = GNUNET_YES; |
159 | } | 159 | } |
160 | 160 | ||
161 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, expire, n, rd_count, rd, signature)) | 161 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (&pubkey, expire, n, rd_count, rd, signature)) |
162 | { | 162 | { |
163 | GNUNET_break (0); | 163 | GNUNET_break (0); |
164 | failed = GNUNET_YES; | 164 | failed = GNUNET_YES; |
@@ -167,7 +167,8 @@ name_lookup_second_proc (void *cls, | |||
167 | struct GNUNET_NAMESTORE_RecordData rd_new[2]; | 167 | struct GNUNET_NAMESTORE_RecordData rd_new[2]; |
168 | rd_new[0] = *s_first_record; | 168 | rd_new[0] = *s_first_record; |
169 | rd_new[1] = *s_second_record; | 169 | rd_new[1] = *s_second_record; |
170 | s_signature_updated = GNUNET_NAMESTORE_create_signature(privkey, expire, s_name, rd_new, 2); | 170 | rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */ |
171 | s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, rd_new, 2); | ||
171 | 172 | ||
172 | if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) | 173 | if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) |
173 | { | 174 | { |
@@ -330,7 +331,7 @@ create_record (unsigned int count) | |||
330 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 331 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
331 | for (c = 0; c < count; c++) | 332 | for (c = 0; c < count; c++) |
332 | { | 333 | { |
333 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 334 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
334 | rd[c].record_type = TEST_RECORD_TYPE; | 335 | rd[c].record_type = TEST_RECORD_TYPE; |
335 | rd[c].data_size = TEST_RECORD_DATALEN; | 336 | rd[c].data_size = TEST_RECORD_DATALEN; |
336 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 337 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index 702fb2db1..9ed2c83c1 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include "namestore.h" | 28 | #include "namestore.h" |
29 | #include "gnunet_signatures.h" | 29 | #include "gnunet_signatures.h" |
30 | 30 | ||
31 | #define VERBOSE GNUNET_NO | ||
32 | |||
33 | #define RECORDS 5 | 31 | #define RECORDS 5 |
34 | 32 | ||
35 | #define TEST_RECORD_TYPE 1234 | 33 | #define TEST_RECORD_TYPE 1234 |
@@ -120,6 +118,7 @@ name_lookup_proc (void *cls, | |||
120 | { | 118 | { |
121 | GNUNET_break (0); | 119 | GNUNET_break (0); |
122 | } | 120 | } |
121 | GNUNET_assert (NULL != signature); | ||
123 | if (0 != memcmp (signature, s_signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) | 122 | if (0 != memcmp (signature, s_signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) |
124 | { | 123 | { |
125 | GNUNET_break (0); | 124 | GNUNET_break (0); |
@@ -184,7 +183,7 @@ create_record (unsigned int count) | |||
184 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 183 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
185 | for (c = 0; c < count; c++) | 184 | for (c = 0; c < count; c++) |
186 | { | 185 | { |
187 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 186 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
188 | rd[c].record_type = TEST_RECORD_TYPE; | 187 | rd[c].record_type = TEST_RECORD_TYPE; |
189 | rd[c].data_size = TEST_RECORD_DATALEN; | 188 | rd[c].data_size = TEST_RECORD_DATALEN; |
190 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 189 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c index 26f037b00..fbbf009cd 100644 --- a/src/namestore/test_namestore_api_lookup_specific_type.c +++ b/src/namestore/test_namestore_api_lookup_specific_type.c | |||
@@ -140,11 +140,6 @@ name_lookup_existing_record_type (void *cls, | |||
140 | GNUNET_break(0); | 140 | GNUNET_break(0); |
141 | failed = GNUNET_YES; | 141 | failed = GNUNET_YES; |
142 | } | 142 | } |
143 | if (NULL != signature) | ||
144 | { | ||
145 | GNUNET_break(0); | ||
146 | failed = GNUNET_YES; | ||
147 | } | ||
148 | if (failed == GNUNET_YES) | 143 | if (failed == GNUNET_YES) |
149 | { | 144 | { |
150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned invalid response\n"); | 145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned invalid response\n"); |
@@ -254,13 +249,13 @@ create_record (unsigned int count) | |||
254 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 249 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
255 | for (c = 0; c < count-1; c++) | 250 | for (c = 0; c < count-1; c++) |
256 | { | 251 | { |
257 | rd[c].expiration_time = 0; | 252 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
258 | rd[c].record_type = 1; | 253 | rd[c].record_type = 1; |
259 | rd[c].data_size = TEST_RECORD_DATALEN; | 254 | rd[c].data_size = TEST_RECORD_DATALEN; |
260 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 255 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
261 | memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); | 256 | memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); |
262 | } | 257 | } |
263 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 258 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
264 | rd[c].record_type = TEST_RECORD_LOOKUP_TYPE_EXISTING; | 259 | rd[c].record_type = TEST_RECORD_LOOKUP_TYPE_EXISTING; |
265 | rd[c].data_size = TEST_RECORD_DATALEN; | 260 | rd[c].data_size = TEST_RECORD_DATALEN; |
266 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 261 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 0ee4e44f7..639ebb3cf 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -220,14 +220,14 @@ create_record (unsigned int count) | |||
220 | struct GNUNET_NAMESTORE_RecordData * rd; | 220 | struct GNUNET_NAMESTORE_RecordData * rd; |
221 | 221 | ||
222 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 222 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
223 | rd[0].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 223 | rd[0].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
224 | rd[0].record_type = 0; | 224 | rd[0].record_type = 0; |
225 | rd[0].data_size = TEST_REMOVE_RECORD_DATALEN; | 225 | rd[0].data_size = TEST_REMOVE_RECORD_DATALEN; |
226 | rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN); | 226 | rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN); |
227 | memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); | 227 | memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); |
228 | for (c = 1; c < count; c++) | 228 | for (c = 1; c < count; c++) |
229 | { | 229 | { |
230 | rd[c].expiration_time = 0; | 230 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
231 | rd[c].record_type = TEST_RECORD_TYPE; | 231 | rd[c].record_type = TEST_RECORD_TYPE; |
232 | rd[c].data_size = TEST_RECORD_DATALEN; | 232 | rd[c].data_size = TEST_RECORD_DATALEN; |
233 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 233 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 1d5f013cb..78b390cc6 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -353,7 +353,7 @@ create_record (unsigned int count) | |||
353 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 353 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
354 | for (c = 0; c < count; c++) | 354 | for (c = 0; c < count; c++) |
355 | { | 355 | { |
356 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 356 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
357 | rd[c].record_type = 1111; | 357 | rd[c].record_type = 1111; |
358 | rd[c].data_size = 50; | 358 | rd[c].data_size = 50; |
359 | rd[c].data = GNUNET_malloc(50); | 359 | rd[c].data = GNUNET_malloc(50); |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 429636e4b..3ee452b69 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -312,7 +312,7 @@ create_record (unsigned int count) | |||
312 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 312 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
313 | for (c = 0; c < count; c++) | 313 | for (c = 0; c < count; c++) |
314 | { | 314 | { |
315 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 315 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
316 | rd[c].record_type = 1111; | 316 | rd[c].record_type = 1111; |
317 | rd[c].data_size = 50; | 317 | rd[c].data_size = 50; |
318 | rd[c].data = GNUNET_malloc(50); | 318 | rd[c].data = GNUNET_malloc(50); |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 4974875d1..3b2da0f19 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -361,7 +361,7 @@ create_record (unsigned int count) | |||
361 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 361 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
362 | for (c = 0; c < count; c++) | 362 | for (c = 0; c < count; c++) |
363 | { | 363 | { |
364 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 364 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; |
365 | rd[c].record_type = 1111; | 365 | rd[c].record_type = 1111; |
366 | rd[c].data_size = 50; | 366 | rd[c].data_size = 50; |
367 | rd[c].data = GNUNET_malloc(50); | 367 | rd[c].data = GNUNET_malloc(50); |