[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28594 - gnunet/src/gns
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28594 - gnunet/src/gns |
Date: |
Wed, 14 Aug 2013 00:11:19 +0200 |
Author: grothoff
Date: 2013-08-14 00:11:19 +0200 (Wed, 14 Aug 2013)
New Revision: 28594
Modified:
gnunet/src/gns/Makefile.am
gnunet/src/gns/gnunet-dns2gns.c
gnunet/src/gns/gnunet-gns-proxy.c
Log:
-adapting gnunet-dns2gns to new API
Modified: gnunet/src/gns/Makefile.am
===================================================================
--- gnunet/src/gns/Makefile.am 2013-08-13 22:02:49 UTC (rev 28593)
+++ gnunet/src/gns/Makefile.am 2013-08-13 22:11:19 UTC (rev 28594)
@@ -49,10 +49,13 @@
if HAVE_MHD
if HAVE_GNUTLS
if HAVE_LIBCURL
+# does not compile right now...
+if HAVE_EXPERIMENTAL
DO_PROXY=gnunet-gns-proxy
endif
endif
endif
+endif
libexec_PROGRAMS = \
gnunet-service-gns \
Modified: gnunet/src/gns/gnunet-dns2gns.c
===================================================================
--- gnunet/src/gns/gnunet-dns2gns.c 2013-08-13 22:02:49 UTC (rev 28593)
+++ gnunet/src/gns/gnunet-dns2gns.c 2013-08-13 22:11:19 UTC (rev 28594)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2012 Christian Grothoff (and other contributing authors)
+ (C) 2012-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -139,8 +139,18 @@
*/
static unsigned int listen_port = 53;
+/**
+ * Which GNS zone do we translate incoming DNS requests to?
+ */
+static struct GNUNET_CRYPTO_EccPublicKey my_zone;
/**
+ * '-z' option with the main zone to use.
+ */
+static char *gns_zone_str;
+
+
+/**
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
@@ -222,7 +232,7 @@
if (NULL != request->packet)
GNUNET_DNSPARSER_free_packet (request->packet);
if (NULL != request->lookup)
- GNUNET_GNS_cancel_lookup_request (request->lookup);
+ GNUNET_GNS_lookup_cancel (request->lookup);
if (NULL != request->dns_lookup)
GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup);
GNUNET_free (request);
@@ -230,8 +240,7 @@
/**
- * Iterator called on obtained result for a DNS
- * lookup
+ * Iterator called on obtained result for a DNS lookup
*
* @param cls closure
* @param rs the request socket
@@ -240,9 +249,9 @@
*/
static void
dns_result_processor (void *cls,
- struct GNUNET_DNSSTUB_RequestSocket *rs,
- const struct GNUNET_TUN_DnsHeader *dns,
- size_t r)
+ struct GNUNET_DNSSTUB_RequestSocket *rs,
+ const struct GNUNET_TUN_DnsHeader *dns,
+ size_t r)
{
struct Request *request = cls;
@@ -453,9 +462,10 @@
type = packet->queries[0].type;
request->lookup = GNUNET_GNS_lookup (gns,
name,
+ &my_zone,
type,
GNUNET_NO,
- NULL,
+ NULL /* no shorten */,
&result_processor,
request);
}
@@ -576,9 +586,19 @@
if (NULL == dns_ip)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No DNS server specified!\n");
+ _("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;
@@ -587,11 +607,11 @@
if (NULL == (gns = GNUNET_GNS_connect (cfg)))
return;
if (NULL == (dns_stub = GNUNET_DNSSTUB_start (dns_ip)))
- {
- GNUNET_GNS_disconnect (gns);
- gns = NULL;
- return;
- }
+ {
+ GNUNET_GNS_disconnect (gns);
+ gns = NULL;
+ return;
+ }
listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
SOCK_DGRAM,
IPPROTO_UDP);
@@ -680,15 +700,18 @@
{'d', "dns", "IP",
gettext_noop ("IP of recursive DNS resolver to use (required)"), 1,
&GNUNET_GETOPT_set_string, &dns_ip},
+ {'f', "fcfs", "NAME",
+ gettext_noop ("Authoritative FCFS suffix to use (optional); default:
fcfs.zkey.eu"), 1,
+ &GNUNET_GETOPT_set_string, &fcfs_suffix},
{'s', "suffix", "SUFFIX",
gettext_noop ("Authoritative DNS suffix to use (optional); default:
zkey.eu"), 1,
&GNUNET_GETOPT_set_string, &dns_suffix},
- {'f', "fcfs", "NAME",
- gettext_noop ("Authoritative FCFS suffix to use (optional); default:
fcfs.zkey.eu"), 1,
- &GNUNET_GETOPT_set_string, &fcfs_suffix},
{'p', "port", "UDPPORT",
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,
+ &GNUNET_GETOPT_set_string, &gns_zone_str},
GNUNET_GETOPT_OPTION_END
};
int ret;
Modified: gnunet/src/gns/gnunet-gns-proxy.c
===================================================================
--- gnunet/src/gns/gnunet-gns-proxy.c 2013-08-13 22:02:49 UTC (rev 28593)
+++ gnunet/src/gns/gnunet-gns-proxy.c 2013-08-13 22:11:19 UTC (rev 28594)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2012 Christian Grothoff (and other contributing authors)
+ (C) 2012-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -20,7 +20,7 @@
/**
* @author Martin Schanzenbach
* @file src/gns/gnunet-gns-proxy.c
- * @brief HTTP(S) proxy that rewrites URIs and fakes certificats to make GADS
work
+ * @brief HTTP(S) proxy that rewrites URIs and fakes certificats to make GNS
work
* with legacy browsers
*/
#include "platform.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28594 - gnunet/src/gns,
gnunet <=