summaryrefslogtreecommitdiff
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)
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 @@
#include <gnunet_gns_service.h>
#include <gnunet_namestore_service.h>
+/**
+ * The upper bound for the zone iteration interval
+ * (per record).
+ */
+#define WARN_RELATIVE_EXPIRATION_LIMIT GNUNET_TIME_relative_multiply ( \
+ GNUNET_TIME_UNIT_MINUTES, 15)
/**
* Entry in record set for bulk processing.
@@ -866,6 +872,13 @@ parse_expiration (const char *expirationstring,
{
*etime_is_rel = GNUNET_YES;
*etime = etime_rel.rel_value_us;
+ if (GNUNET_TIME_relative_cmp (etime_rel, <, WARN_RELATIVE_EXPIRATION_LIMIT))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Relative expiration times of less than %s are not recommended\n",
+ GNUNET_STRINGS_relative_time_to_string (
+ WARN_RELATIVE_EXPIRATION_LIMIT, GNUNET_NO));
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Storing record with relative expiration time of %s\n",
GNUNET_STRINGS_relative_time_to_string (etime_rel, GNUNET_NO));
@@ -1149,8 +1162,8 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
char sname[64];
struct GNUNET_IDENTITY_PublicKey pkey;
- memset(sh, 0, 105);
- memset(sname, 0, 64);
+ memset (sh, 0, 105);
+ memset (sname, 0, 64);
if ((2 != (sscanf (uri, "gnunet://gns/%58s/%63s", sh, sname))) ||
(GNUNET_OK !=
@@ -1642,13 +1655,13 @@ main (int argc, char *const *argv)
NULL)))
{
GNUNET_free_nz ((void *) argv);
- //FIXME
- //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
+ // FIXME
+ // GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
return lret;
}
GNUNET_free_nz ((void *) argv);
- //FIXME
- //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
+ // FIXME
+ // GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
return ret;
}