[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29015 - in gnunet: doc/man src/gns
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29015 - in gnunet: doc/man src/gns |
Date: |
Thu, 5 Sep 2013 13:09:18 +0200 |
Author: grothoff
Date: 2013-09-05 13:09:18 +0200 (Thu, 05 Sep 2013)
New Revision: 29015
Modified:
gnunet/doc/man/gnunet-dns2gns.1
gnunet/src/gns/Makefile.am
gnunet/src/gns/gnunet-dns2gns.c
Log:
-integrate identity service with dns2gns (#3010)
Modified: gnunet/doc/man/gnunet-dns2gns.1
===================================================================
--- gnunet/doc/man/gnunet-dns2gns.1 2013-09-05 10:53:05 UTC (rev 29014)
+++ gnunet/doc/man/gnunet-dns2gns.1 2013-09-05 11:09:18 UTC (rev 29015)
@@ -15,6 +15,8 @@
A DNS\-to\-GNS proxy using gnunet\-dns2gns is available at ".zkey.eu"
+If you do not want to specify a public key and are the owner of the zone that
gnunet\-dns2gns will use for GNS lookups, you need to first create a pseudonym
(using "gnunet\-identity \-C NAME"), and then assign it to be used for the
"dns2gns" service using "gnunet\-identity \-e NAME \-s dns2gns". After that,
you can start the dns2gns service (possibly using gnunet\-arm) without
specifying a public key using "\-z".
+
.SH OPTIONS
.B
.IP "\-c FILENAME, \-\-config=FILENAME"
@@ -37,10 +39,13 @@
.B
.IP "\-v, \-\-version"
Print GNUnet version number.
+.B
+.IP "\-z PUBLICKEY, \-\-zone=PUBLICKEY"
+Use PUBLICKEY for the zone to resolve GNS names in. The PUBLICKEY must be
encoded in the text format which can be obtained using gnunet\-ecc, seen in
PKEY records and output by gnunet\-identity. If this option is not specified,
the default ego associated by gnunet\-identity for the "dns2gns" subsystem will
be used.
.SH BUGS
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending
electronic mail to <address@hidden>
.SH SEE ALSO
-gnunet\-gns\-fcfs(1), gnunet\-gns(1)
+gnunet\-gns\-fcfs(1), gnunet\-gns(1), gnunet\-identity(1)
Modified: gnunet/src/gns/Makefile.am
===================================================================
--- gnunet/src/gns/Makefile.am 2013-09-05 10:53:05 UTC (rev 29014)
+++ gnunet/src/gns/Makefile.am 2013-09-05 11:09:18 UTC (rev 29015)
@@ -86,12 +86,15 @@
gnunet_dns2gns_LDADD = \
$(top_builddir)/src/gns/libgnunetgns.la \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la \
$(top_builddir)/src/dns/libgnunetdnsparser.la \
$(top_builddir)/src/dns/libgnunetdnsstub.la \
$(GN_LIBINTL)
gnunet_dns2gns_DEPENDENCIES = \
+ $(top_builddir)/src/gns/libgnunetgns.la \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la \
$(top_builddir)/src/dns/libgnunetdnsparser.la \
$(top_builddir)/src/dns/libgnunetdnsstub.la \
Modified: gnunet/src/gns/gnunet-dns2gns.c
===================================================================
--- gnunet/src/gns/gnunet-dns2gns.c 2013-09-05 10:53:05 UTC (rev 29014)
+++ gnunet/src/gns/gnunet-dns2gns.c 2013-09-05 11:09:18 UTC (rev 29015)
@@ -26,6 +26,7 @@
#include <gnunet_util_lib.h>
#include <gnunet_dnsparser_lib.h>
#include <gnunet_gns_service.h>
+#include <gnunet_identity_service.h>
#include <gnunet_dnsstub_lib.h>
#include "gns.h"
@@ -149,8 +150,24 @@
*/
static char *gns_zone_str;
+/**
+ * Configuration to use.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
+ * Connection to identity service.
+ */
+static struct GNUNET_IDENTITY_Handle *identity;
+
+/**
+ * Request for our ego.
+ */
+static struct GNUNET_IDENTITY_Operation *id_op;
+
+
+
+/**
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
@@ -557,34 +574,11 @@
/**
- * Main function that will be run.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be
NULL!)
- * @param cfg configuration
+ * Start DNS daemon.
*/
static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+run_dnsd ()
{
- if (NULL == dns_ip)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("No DNS server specified!\n"));
- return;
- }
- if ( (NULL == gns_zone_str) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (gns_zone_str,
- strlen (gns_zone_str),
- &my_zone)) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("No valid GNS zone specified!\n"));
- return;
- }
-
if (NULL == dns_suffix)
dns_suffix = DNS_SUFFIX;
if (NULL == fcfs_suffix)
@@ -665,13 +659,96 @@
&read_dns6,
listen_socket6);
+}
+
+
+/**
+ * Method called to inform about the egos of this peer.
+ *
+ * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
+ * this function is only called ONCE, and 'NULL' being passed in
+ * @a ego does indicate an error (i.e. name is taken or no default
+ * value is known). If @a ego is non-NULL and if '*ctx'
+ * is set in those callbacks, the value WILL be passed to a subsequent
+ * call to the identity callback of #GNUNET_IDENTITY_connect (if
+ * that one was not NULL).
+ *
+ * @param cls closure, NULL
+ * @param ego ego handle
+ * @param ctx context for application to store data for this ego
+ * (during the lifetime of this process, initially NULL)
+ * @param name name assigned by the user for this ego,
+ * NULL if the user just deleted the ego and it
+ * must thus no longer be used
+ */
+static void
+identity_cb (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
+ const char *name)
+{
+ id_op = NULL;
+ if (NULL == ego)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("No ego configured for `dns2gns` subsystem\n"));
+ return;
+ }
+ GNUNET_IDENTITY_ego_get_public_key (ego,
+ &my_zone);
+ run_dnsd ();
+}
+
+
+/**
+ * Main function that will be run.
+ *
+ * @param cls closure
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be
NULL!)
+ * @param c configuration
+ */
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *c)
+{
+ cfg = c;
+
+ if (NULL == dns_ip)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("No DNS server specified!\n"));
+ return;
+ }
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_shutdown, NULL);
+ if (NULL == gns_zone_str)
+ {
+ identity = GNUNET_IDENTITY_connect (cfg,
+ NULL, NULL);
+ id_op = GNUNET_IDENTITY_get (identity,
+ "dns2gns",
+ &identity_cb,
+ NULL);
+ return;
+ }
+ if ( (NULL == gns_zone_str) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_ecc_public_key_from_string (gns_zone_str,
+ strlen (gns_zone_str),
+ &my_zone)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("No valid GNS zone specified!\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ run_dnsd ();
}
/**
- * The main function for the fcfs daemon.
+ * The main function for the dns2gns daemon.
*
* @param argc number of arguments from the command line
* @param argv command line arguments
@@ -695,7 +772,7 @@
gettext_noop ("UDP port to listen on for inbound DNS requests; default:
53"), 1,
&GNUNET_GETOPT_set_uint, &listen_port},
{'z', "zone", "PUBLICKEY",
- gettext_noop ("Public key of the GNS zone to use (required)"), 1,
+ gettext_noop ("Public key of the GNS zone to use (overrides default)"),
1,
&GNUNET_GETOPT_set_string, &gns_zone_str},
GNUNET_GETOPT_OPTION_END
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29015 - in gnunet: doc/man src/gns,
gnunet <=