Hello,

as this mail's subject says, running

gnunet-namestore -e $expiry -u $uri

ignores the value passed to the '-e' argument, defaulting to the UNIX
time 0 since the relevant variable is global and thus initialized to
that value at startup.  I've attached a patch that fixes the
problem.

Thank you,
A.V.

>From 6f9ff18588ac64bad4963e0036a987fe1d041f1e Mon Sep 17 00:00:00 2001
From: Alessio Vanni <[email protected]>
Date: Fri, 20 Mar 2020 15:35:54 +0100
Subject: [PATCH] Make gnunet-namestore honour expiration dates when importing
 an URI

---
 src/namestore/gnunet-namestore.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 4c8fd5ce8..25dfda59b 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1193,6 +1193,23 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
       ret = 1;
       return;
     }
+    if (NULL == expirationstring)
+    {
+      fprintf (stderr,
+               _ ("Missing option `%s' for operation `%s'\n"),
+               "-e",
+               _ ("add"));
+      GNUNET_SCHEDULER_shutdown ();
+      ret = 1;
+      return;
+    }
+    if (GNUNET_OK != parse_expiration (expirationstring, &etime_is_rel, &etime))
+    {
+      fprintf (stderr, _ ("Invalid time format `%s'\n"), expirationstring);
+      GNUNET_SCHEDULER_shutdown ();
+      ret = 1;
+      return;
+    }
     memset (&rd, 0, sizeof(rd));
     rd.data = &pkey;
     rd.data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
-- 
2.24.1

Reply via email to