Make gnunet-namestore honour expiration dates when importing an URI
authorAlessio Vanni <vannilla@firemail.cc>
Fri, 20 Mar 2020 14:35:54 +0000 (15:35 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 21 Mar 2020 09:01:13 +0000 (10:01 +0100)
src/namestore/gnunet-namestore.c

index 4c8fd5ce835a5c100a88784ae6f89f11cb38570c..25dfda59b99a29c432fe86dfbacbd634867ac622 100644 (file)
@@ -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);