/*
This file is part of GNUnet.
- (C) 2012, 2013, 2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2012, 2013, 2014 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file gnunet-namestore.c
*/
static int is_shadow;
-/**
- * Is record pending approval (#GNUNET_GNSRECORD_RF_PENDING)
- */
-static int is_pending;
-
/**
* Queue entry for the 'del' operation.
*/
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != get_default)
{
ets = GNUNET_STRINGS_absolute_time_to_string (at);
}
FPRINTF (stdout,
- "\t%s: %s (%s)\t%s\t%s\t%s\n",
+ "\t%s: %s (%s)\t%s\t%s\n",
typestring,
s,
ets,
(0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) ? "PRIVATE" : "PUBLIC",
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ? "SHADOW" : "",
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PENDING)) ? "PENDING" : "");
+ (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ? "SHADOW" : "");
GNUNET_free (s);
}
FPRINTF (stdout, "%s", "\n");
rec_name);
ret = 1;
test_finished ();
+ return;
case GNUNET_GNSRECORD_TYPE_GNS2DNS:
fprintf (stderr,
_("A %s record exists already under `%s', no other records can be added.\n"),
ret = 1;
test_finished ();
return;
- case GNUNET_DNSPARSER_TYPE_NS:
- if ( (GNUNET_DNSPARSER_TYPE_A == type) ||
- (GNUNET_DNSPARSER_TYPE_AAAA == type) )
- break;
+ }
+ }
+ switch (type)
+ {
+ case GNUNET_DNSPARSER_TYPE_CNAME:
+ if (0 != rd_count)
+ {
fprintf (stderr,
- _("A %s record exists already under `%s', only A/AAAA records can be added.\n"),
- "NS",
- rec_name);
+ _("Records already exist under `%s', cannot add `%s' record.\n"),
+ rec_name,
+ "CNAME");
+ ret = 1;
+ test_finished ();
+ return;
+ }
+ break;
+ case GNUNET_GNSRECORD_TYPE_PKEY:
+ if (0 != rd_count)
+ {
+ fprintf (stderr,
+ _("Records already exist under `%s', cannot add `%s' record.\n"),
+ rec_name,
+ "PKEY");
+ ret = 1;
+ test_finished ();
+ return;
+ }
+ break;
+ case GNUNET_GNSRECORD_TYPE_GNS2DNS:
+ if (0 != rd_count)
+ {
+ fprintf (stderr,
+ _("Records already exist under `%s', cannot add `%s' record.\n"),
+ rec_name,
+ "GNS2DNS");
ret = 1;
test_finished ();
return;
}
+ break;
}
memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
if (1 != is_public)
rde->flags |= GNUNET_GNSRECORD_RF_PRIVATE;
- if (1 == is_pending)
- rde->flags |= GNUNET_GNSRECORD_RF_PENDING;
if (GNUNET_YES == etime_is_rel)
{
rde->expiration_time = etime_rel.rel_value_us;
char sname[64];
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
- if ( (2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname)) ) ||
+ GNUNET_STRINGS_utf8_tolower (uri, uri);
+ if ( (2 != (sscanf (uri,
+ "gnunet://gns/%52s/%63s",
+ sh,
+ sname)) ) ||
(GNUNET_OK != GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey)) )
{
fprintf (stderr,
ret = -1;
return;
}
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &do_shutdown, (void *) cfg);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown, (void *) cfg);
if (NULL == ego_name)
{
main (int argc, char *const *argv)
{
is_public = -1;
- is_pending = -1;
is_shadow = -1;
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
{'p', "public", NULL,
gettext_noop ("create or list public record"), 0,
&GNUNET_GETOPT_set_one, &is_public},
- {'P', "pending", NULL,
- gettext_noop ("create record that is pending approval (and thus for now inactive)"), 0,
- &GNUNET_GETOPT_set_one, &is_pending},
{'s', "shadow", NULL,
gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), 0,
&GNUNET_GETOPT_set_one, &is_shadow},