aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-03-04 14:17:37 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-03-04 14:17:37 +0100
commit0e6b1f4a2d6cdbc175c31043e99897247331f27c (patch)
tree62afc971061c6c8127954f4a455ab0a167c4f48d
parent0f0ff3785913d266d667aef851b504bb3997c87f (diff)
downloadgnunet-0e6b1f4a2d6cdbc175c31043e99897247331f27c.tar.gz
gnunet-0e6b1f4a2d6cdbc175c31043e99897247331f27c.zip
NAMESTORE: Warn use of low relative expiration times
-rw-r--r--src/namestore/gnunet-namestore.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 40872ca8e..3e19eba4b 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -33,6 +33,12 @@
33#include <gnunet_gns_service.h> 33#include <gnunet_gns_service.h>
34#include <gnunet_namestore_service.h> 34#include <gnunet_namestore_service.h>
35 35
36/**
37 * The upper bound for the zone iteration interval
38 * (per record).
39 */
40#define WARN_RELATIVE_EXPIRATION_LIMIT GNUNET_TIME_relative_multiply ( \
41 GNUNET_TIME_UNIT_MINUTES, 15)
36 42
37/** 43/**
38 * Entry in record set for bulk processing. 44 * Entry in record set for bulk processing.
@@ -866,6 +872,13 @@ parse_expiration (const char *expirationstring,
866 { 872 {
867 *etime_is_rel = GNUNET_YES; 873 *etime_is_rel = GNUNET_YES;
868 *etime = etime_rel.rel_value_us; 874 *etime = etime_rel.rel_value_us;
875 if (GNUNET_TIME_relative_cmp (etime_rel, <, WARN_RELATIVE_EXPIRATION_LIMIT))
876 {
877 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
878 "Relative expiration times of less than %s are not recommended\n",
879 GNUNET_STRINGS_relative_time_to_string (
880 WARN_RELATIVE_EXPIRATION_LIMIT, GNUNET_NO));
881 }
869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 882 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
870 "Storing record with relative expiration time of %s\n", 883 "Storing record with relative expiration time of %s\n",
871 GNUNET_STRINGS_relative_time_to_string (etime_rel, GNUNET_NO)); 884 GNUNET_STRINGS_relative_time_to_string (etime_rel, GNUNET_NO));
@@ -1149,8 +1162,8 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1149 char sname[64]; 1162 char sname[64];
1150 struct GNUNET_IDENTITY_PublicKey pkey; 1163 struct GNUNET_IDENTITY_PublicKey pkey;
1151 1164
1152 memset(sh, 0, 105); 1165 memset (sh, 0, 105);
1153 memset(sname, 0, 64); 1166 memset (sname, 0, 64);
1154 1167
1155 if ((2 != (sscanf (uri, "gnunet://gns/%58s/%63s", sh, sname))) || 1168 if ((2 != (sscanf (uri, "gnunet://gns/%58s/%63s", sh, sname))) ||
1156 (GNUNET_OK != 1169 (GNUNET_OK !=
@@ -1642,13 +1655,13 @@ main (int argc, char *const *argv)
1642 NULL))) 1655 NULL)))
1643 { 1656 {
1644 GNUNET_free_nz ((void *) argv); 1657 GNUNET_free_nz ((void *) argv);
1645 //FIXME 1658 // FIXME
1646 //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1659 // GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1647 return lret; 1660 return lret;
1648 } 1661 }
1649 GNUNET_free_nz ((void *) argv); 1662 GNUNET_free_nz ((void *) argv);
1650 //FIXME 1663 // FIXME
1651 //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1664 // GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1652 return ret; 1665 return ret;
1653} 1666}
1654 1667