[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: fix TTL parsing in gnunet-n
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: fix TTL parsing in gnunet-namestore |
Date: |
Tue, 04 Dec 2018 13:26:30 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new c9717ad64 fix TTL parsing in gnunet-namestore
c9717ad64 is described below
commit c9717ad647910df9ade1631a170a28fe6c6ba9a5
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Dec 4 13:26:29 2018 +0100
fix TTL parsing in gnunet-namestore
---
doc/man/gnunet-namestore.1 | 3 ++-
src/namestore/gnunet-namestore.c | 37 ++++++++++++++++++++++++-------------
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/doc/man/gnunet-namestore.1 b/doc/man/gnunet-namestore.1
index 9f4b4d2d6..45309fad6 100644
--- a/doc/man/gnunet-namestore.1
+++ b/doc/man/gnunet-namestore.1
@@ -65,7 +65,8 @@ PKEY) in the given zone.
Sets record set to values given in RECORDLINE. This option can be specified
multiple
times to provide multiple records for the record set. Existing records under
the
same label will be deleted. The format for the RECORDLINE is
-"TTL TYPE FLAGS VALUE" where TTL is the time to live in seconds, TYPE is the
+"TTL TYPE FLAGS VALUE" where TTL is the time to live in seconds (unit must not
+be given explicitly, seconds is always implied), TYPE is the
DNS/GNS record type, FLAGS is "(N)ORMAL", "(S)HADOW" or "(P)UBLIC". The VALUE
follows the usual human-readable value format(s) of DNS/GNS.
.B
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 90fe79779..0124db62b 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1374,6 +1374,7 @@ run (void *cls,
* @param option name of the option (typically 'R')
* @param value command line argument given; format is
* "TTL TYPE FLAGS VALUE" where TTL is an expiration time (rel or abs),
+ * always given in seconds (without the unit),
* TYPE is a DNS/GNS record type, FLAGS is either "n" for no flags or
* a combination of 's' (shadow) and 'p' (public) and VALUE is the
* value (in human-readable format)
@@ -1390,13 +1391,14 @@ multirecord_process (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
struct GNUNET_GNSRECORD_Data record;
char *cp;
char *tok;
+ char *saveptr;
int etime_is_rel;
void *raw_data;
(void) ctx;
(void) option;
cp = GNUNET_strdup (value);
- tok = strtok (cp, " ");
+ tok = strtok_r (cp, " ", &saveptr);
if (NULL == tok)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1404,21 +1406,30 @@ multirecord_process (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
GNUNET_free (cp);
return GNUNET_SYSERR;
}
- if (GNUNET_OK !=
- parse_expiration (tok,
- &etime_is_rel,
- &record.expiration_time))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Invalid expiration time `%s'\n"),
- tok);
- GNUNET_free (cp);
- return GNUNET_SYSERR;
+ char *etime_in_s;
+
+ GNUNET_asprintf (&etime_in_s,
+ "%s s",
+ tok);
+ if (GNUNET_OK !=
+ parse_expiration (etime_in_s,
+ &etime_is_rel,
+ &record.expiration_time))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Invalid expiration time `%s' (must be without unit)\n"),
+ tok);
+ GNUNET_free (cp);
+ GNUNET_free (etime_in_s);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (etime_in_s);
}
- tok = strtok (NULL, " ");
+ tok = strtok_r (NULL, " ", &saveptr);
if (NULL == tok)
{
- GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Missing entries in record line `%s'.\n"),
value);
GNUNET_free (cp);
@@ -1433,7 +1444,7 @@ multirecord_process (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
GNUNET_free (cp);
return GNUNET_SYSERR;
}
- tok = strtok (NULL, " ");
+ tok = strtok_r (NULL, " ", &saveptr);
if (NULL == tok)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: fix TTL parsing in gnunet-namestore,
gnunet <=