* @author Christian Grothoff
*
* TODO:
- * - printing records
* - allow users to set record options (not just 'RF_AUTHORITY')
* - test
* - parsing SOA, PTR and MX value specifications (and define format!)
/**
* Hash of the public key of our zone.
*/
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
/**
* Private key for the our zone.
if (NULL == keyfile)
{
- fprintf (stderr,
- _("Option `%s' not given, but I need a zone key file!\n"),
- "z");
- return;
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
+ "ZONEKEY", &keyfile))
+ {
+ fprintf (stderr,
+ _("Option `%s' not given, but I need a zone key file!\n"),
+ "z");
+ return;
+ }
+ fprintf (stderr,
+ _("Using default zone file `%s'\n"),
+ keyfile);
}
zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
GNUNET_free (keyfile);
if (! (add|del|list))
{
/* nothing more to be done */
+ fprintf (stderr,
+ _("No options given\n"));
GNUNET_CRYPTO_rsa_key_free (zone_pkey);
zone_pkey = NULL;
return;
}
GNUNET_CRYPTO_rsa_key_get_public (zone_pkey,
&pub);
- GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone);
+ GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &zone);
ns = GNUNET_NAMESTORE_connect (cfg);
if (NULL == ns)
fprintf (stderr, _("Unsupported type `%s'\n"), typestring);
GNUNET_SCHEDULER_shutdown ();
return;
- } else if (add | del)
+ }
+ if ((NULL == typestring) && (add | del))
{
fprintf (stderr,
_("Missing option `%s' for operation `%s'\n"),
GNUNET_SCHEDULER_shutdown ();
return;
}
- } else if (add | del)
+ } else if (add)
{
fprintf (stderr,
_("Missing option `%s' for operation `%s'\n"),
- "-e", _("add/del"));
+ "-e", _("add"));
GNUNET_SCHEDULER_shutdown ();
return;
}
rd.data_size = data_size;
rd.record_type = type;
rd.expiration = GNUNET_TIME_relative_to_absolute (etime);
- rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY; // FIXME: not always...
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
add_qe = GNUNET_NAMESTORE_record_create (ns,
zone_pkey,
name,
rd.data = data;
rd.data_size = data_size;
rd.record_type = type;
- rd.expiration = GNUNET_TIME_relative_to_absolute (etime);
- rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY; // FIXME: not always...
+ rd.expiration.abs_value = 0;
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
del_qe = GNUNET_NAMESTORE_record_remove (ns,
zone_pkey,
name,