diff options
Diffstat (limited to 'src/namestore/gnunet-namestore.c')
-rw-r--r-- | src/namestore/gnunet-namestore.c | 37 |
1 files changed, 24 insertions, 13 deletions
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, | |||
1374 | * @param option name of the option (typically 'R') | 1374 | * @param option name of the option (typically 'R') |
1375 | * @param value command line argument given; format is | 1375 | * @param value command line argument given; format is |
1376 | * "TTL TYPE FLAGS VALUE" where TTL is an expiration time (rel or abs), | 1376 | * "TTL TYPE FLAGS VALUE" where TTL is an expiration time (rel or abs), |
1377 | * always given in seconds (without the unit), | ||
1377 | * TYPE is a DNS/GNS record type, FLAGS is either "n" for no flags or | 1378 | * TYPE is a DNS/GNS record type, FLAGS is either "n" for no flags or |
1378 | * a combination of 's' (shadow) and 'p' (public) and VALUE is the | 1379 | * a combination of 's' (shadow) and 'p' (public) and VALUE is the |
1379 | * value (in human-readable format) | 1380 | * value (in human-readable format) |
@@ -1390,13 +1391,14 @@ multirecord_process (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
1390 | struct GNUNET_GNSRECORD_Data record; | 1391 | struct GNUNET_GNSRECORD_Data record; |
1391 | char *cp; | 1392 | char *cp; |
1392 | char *tok; | 1393 | char *tok; |
1394 | char *saveptr; | ||
1393 | int etime_is_rel; | 1395 | int etime_is_rel; |
1394 | void *raw_data; | 1396 | void *raw_data; |
1395 | 1397 | ||
1396 | (void) ctx; | 1398 | (void) ctx; |
1397 | (void) option; | 1399 | (void) option; |
1398 | cp = GNUNET_strdup (value); | 1400 | cp = GNUNET_strdup (value); |
1399 | tok = strtok (cp, " "); | 1401 | tok = strtok_r (cp, " ", &saveptr); |
1400 | if (NULL == tok) | 1402 | if (NULL == tok) |
1401 | { | 1403 | { |
1402 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1404 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -1404,21 +1406,30 @@ multirecord_process (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
1404 | GNUNET_free (cp); | 1406 | GNUNET_free (cp); |
1405 | return GNUNET_SYSERR; | 1407 | return GNUNET_SYSERR; |
1406 | } | 1408 | } |
1407 | if (GNUNET_OK != | ||
1408 | parse_expiration (tok, | ||
1409 | &etime_is_rel, | ||
1410 | &record.expiration_time)) | ||
1411 | { | 1409 | { |
1412 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1410 | char *etime_in_s; |
1413 | _("Invalid expiration time `%s'\n"), | 1411 | |
1414 | tok); | 1412 | GNUNET_asprintf (&etime_in_s, |
1415 | GNUNET_free (cp); | 1413 | "%s s", |
1416 | return GNUNET_SYSERR; | 1414 | tok); |
1415 | if (GNUNET_OK != | ||
1416 | parse_expiration (etime_in_s, | ||
1417 | &etime_is_rel, | ||
1418 | &record.expiration_time)) | ||
1419 | { | ||
1420 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1421 | _("Invalid expiration time `%s' (must be without unit)\n"), | ||
1422 | tok); | ||
1423 | GNUNET_free (cp); | ||
1424 | GNUNET_free (etime_in_s); | ||
1425 | return GNUNET_SYSERR; | ||
1426 | } | ||
1427 | GNUNET_free (etime_in_s); | ||
1417 | } | 1428 | } |
1418 | tok = strtok (NULL, " "); | 1429 | tok = strtok_r (NULL, " ", &saveptr); |
1419 | if (NULL == tok) | 1430 | if (NULL == tok) |
1420 | { | 1431 | { |
1421 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1432 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1422 | _("Missing entries in record line `%s'.\n"), | 1433 | _("Missing entries in record line `%s'.\n"), |
1423 | value); | 1434 | value); |
1424 | GNUNET_free (cp); | 1435 | GNUNET_free (cp); |
@@ -1433,7 +1444,7 @@ multirecord_process (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
1433 | GNUNET_free (cp); | 1444 | GNUNET_free (cp); |
1434 | return GNUNET_SYSERR; | 1445 | return GNUNET_SYSERR; |
1435 | } | 1446 | } |
1436 | tok = strtok (NULL, " "); | 1447 | tok = strtok_r (NULL, " ", &saveptr); |
1437 | if (NULL == tok) | 1448 | if (NULL == tok) |
1438 | { | 1449 | { |
1439 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |