.IP "\-t TYPE, \-\-type=TYPE"
Type of the record to add/delete/display (i.e. "A", "AAAA", "NS", "PKEY", "MX" etc.)
.B
+.IP "\-u URI, \-\-uri=URI"
+Add PKEY record from gnunet://gns/-URI to our zone; the record type is always PKEY, if no expiration is given FOREVER is used
+.B
.IP "\-v, \-\-version"
Print GNUnet version number.
.B
*/
static char *value;
+/**
+ * URI to import.
+ */
+static char *uri;
+
/**
* Type of the record to add/remove, NULL to remove all.
*/
GNUNET_CRYPTO_rsa_key_free (zone_pkey);
zone_pkey = NULL;
}
+ if (NULL != uri)
+ {
+ GNUNET_free (uri);
+ uri = NULL;
+ }
}
zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
GNUNET_free (keyfile);
keyfile = NULL;
- if (! (add|del|list))
+ if (! (add|del|list|(NULL != uri)))
{
/* nothing more to be done */
fprintf (stderr,
&display_record,
NULL);
}
+ if (NULL != uri)
+ {
+ char sh[53];
+ char name[64];
+ struct GNUNET_CRYPTO_ShortHashCode sc;
+
+ if ( (2 != (sscanf (uri,
+ "gnunet://gns/%52s/%63s",
+ sh,
+ name)) ) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_short_hash_from_string (sh, &sc)) )
+ {
+ fprintf (stderr,
+ _("Invalid URI `%s'"),
+ uri);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+
+ rd.data = ≻
+ rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode);
+ rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
+ if (GNUNET_YES == etime_is_rel)
+ {
+ rd.expiration_time = etime_rel.rel_value;
+ rd.flags |= GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION;
+ }
+ else if (GNUNET_NO == etime_is_rel)
+ rd.expiration_time = etime_abs.abs_value;
+ else
+ rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
+ if (1 != nonauthority)
+ rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY;
+
+ add_qe = GNUNET_NAMESTORE_record_create (ns,
+ zone_pkey,
+ name,
+ &rd,
+ &add_continuation,
+ NULL);
+ }
GNUNET_free_non_null (data);
}
{'t', "type", "TYPE",
gettext_noop ("type of the record to add/delete/display"), 1,
&GNUNET_GETOPT_set_string, &typestring},
+ {'u', "uri", "URI",
+ gettext_noop ("URI to import into our zone"), 1,
+ &GNUNET_GETOPT_set_string, &uri},
{'V', "value", "VALUE",
gettext_noop ("value of the record to add/delete"), 1,
&GNUNET_GETOPT_set_string, &value},