summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-03 22:05:37 +0100
committerChristian Grothoff <christian@grothoff.org>2018-03-03 22:05:37 +0100
commit65377c3d9087635696f66b2444ef1d7eb39d4cd0 (patch)
tree14ff5999de78cf717e6e7b4541f469d1b24b243d
parentcd2b8b467b218dfdd2d5124ad2d835161f3a2b1a (diff)
eliminate .gnu from GNS
-rw-r--r--doc/man/gnunet-gns.119
-rw-r--r--doc/man/gnunet-namestore.13
-rw-r--r--src/gns/gns.conf.in6
-rw-r--r--src/gns/gnunet-gns.c253
-rw-r--r--src/gns/gnunet-service-gns.c161
-rw-r--r--src/gns/gnunet-service-gns.h16
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c22
-rw-r--r--src/gns/gnunet-service-gns_interceptor.h6
-rw-r--r--src/gns/gnunet-service-gns_resolver.c337
-rw-r--r--src/gns/gnunet-service-gns_resolver.h21
-rwxr-xr-xsrc/gns/test_gns_cname_lookup.sh39
-rwxr-xr-xsrc/gns/test_gns_delegated_lookup.sh22
-rwxr-xr-xsrc/gns/test_gns_dht_lookup.sh22
-rwxr-xr-xsrc/gns/test_gns_gns2dns_lookup.sh36
-rwxr-xr-xsrc/gns/test_gns_ipv6_lookup.sh11
-rwxr-xr-xsrc/gns/test_gns_lookup.sh12
-rwxr-xr-xsrc/gns/test_gns_mx_lookup.sh19
-rwxr-xr-xsrc/gns/test_gns_plus_lookup.sh9
-rwxr-xr-xsrc/gns/test_gns_quickupdate.sh34
-rwxr-xr-xsrc/gns/test_gns_rel_expiration.sh25
-rwxr-xr-xsrc/gns/test_gns_revocation.sh24
-rwxr-xr-xsrc/gns/test_gns_soa_lookup.sh13
-rwxr-xr-xsrc/gns/test_gns_txt_lookup.sh12
-rwxr-xr-xsrc/gns/test_gns_zkey_lookup.sh2
-rw-r--r--src/gnsrecord/gnsrecord_misc.c31
-rw-r--r--src/include/gnunet_gns_service.h3
-rw-r--r--src/namecache/gnunet-service-namecache.c10
-rw-r--r--src/namecache/plugin_namecache_flat.c6
-rw-r--r--src/namestore/gnunet-namestore.c8
-rw-r--r--src/namestore/gnunet-service-namestore.c17
-rw-r--r--src/namestore/plugin_rest_namestore.c3
31 files changed, 640 insertions, 562 deletions
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1
index 5fabc14f3..a6f27479a 100644
--- a/doc/man/gnunet-gns.1
+++ b/doc/man/gnunet-gns.1
@@ -1,7 +1,7 @@
-.TH GNUNET\-GNS 1 "Aug 23, 2013" "GNUnet"
+.TH GNUNET\-GNS 1 "Mar 23, 2018" "GNUnet"
.SH NAME
-gnunet\-gns \- Access to GNUnet Name Service
+gnunet\-gns \- Access to GNU Name System
.SH SYNOPSIS
.B gnunet\-gns
@@ -9,7 +9,7 @@ gnunet\-gns \- Access to GNUnet Name Service
.br
.SH DESCRIPTION
-\fBgnunet\-gns\fP can be used to lookup and process GNUnet Name Service names.
+\fBgnunet\-gns\fP can be used to lookup and process GNU Name Service names.
.SH OPTIONS
.B
@@ -30,10 +30,7 @@ Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR.
.B
.IP "\-u NAME, \-\-lookup=NAME"
Name to lookup.
-Resolve the specified name using the GNUnet Name System.
-.B
-.IP "\-p PKEY, \-\-public-key=PKEY"
-Public key of the zone to perform the lookup in. This option should be used if the lookup is to be performed against a zone not controlled by this peer (alternatively, you could pass a ".zkey" for the name).
+Resolve the specified name using the GNU Name System.
.B
.IP "\-T DELAY, \-\-timeout=DELAY"
Set the timeout to DELAY. By default, gnunet\-gns will continue to try to resolve the name until there is a definitive answer or until the user aborts with CTRL\-C.
@@ -44,13 +41,15 @@ Supported TYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO,
Defaults to "A".
.B
-.IP "\-z NAME, \-\-zone=NAME"
-Name of the ego of the zone to lookup the record in. The public key associated with the ego will be used for the zone.
-.B
.IP "\-v, \-\-version"
Print GNUnet version number.
.B
+.SH RETURN VALUE
+
+gnunet\-gns will return 0 on success, 1 on internal failures, 2 on launch failures,
+3 if the given name is not configured to use GNS, and 4 on timeout.
+
.SH BUGS
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
diff --git a/doc/man/gnunet-namestore.1 b/doc/man/gnunet-namestore.1
index daed19116..1811031ad 100644
--- a/doc/man/gnunet-namestore.1
+++ b/doc/man/gnunet-namestore.1
@@ -1,7 +1,7 @@
.TH GNUNET\-NAMESTORE 1 "Apr 15, 2014" "GNUnet"
.SH NAME
-gnunet\-namestore \- manipulate GNUnet zones
+gnunet\-namestore \- manipulate GNU Name System (GNS) zone data
.SH SYNOPSIS
.B gnunet\-namestore
@@ -74,4 +74,3 @@ Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic
.SH "SEE ALSO"
\fBgnunet\-gns\fP(1), \fBgnunet\-namestore\-gtk\fP(1)
-
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index b85b1e04c..6b764904f 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -16,6 +16,12 @@ UNIX_MATCH_GID = YES
# How many queries is GNS allowed to perform in the background at the same time?
MAX_PARALLEL_BACKGROUND_QUERIES = 1000
+# Should we use the DNS interception mechanism? If set to YES
+# we will ask gnunet-service-dns to pass DNS queries to us. Otherwise,
+# we only answer GNS queries via the API (which itself may be
+# called via NSS or other mechanisms).
+INTERCEPT_DNS = YES
+
# Using caching or always ask DHT
# USE_CACHE = YES
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index c0de0f30c..202e02a50 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2012-2013, 2017 GNUnet e.V.
+ Copyright (C) 2012-2013, 2017-2018 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
@@ -56,16 +56,6 @@ static char *lookup_name;
static char *lookup_type;
/**
- * Identity of the zone to use for the lookup (-z option)
- */
-static char *zone_ego_name;
-
-/**
- * Public key of the zone to use for the lookup (-p option)
- */
-static char *public_key;
-
-/**
* Set to GNUNET_GNS_LO_LOCAL_MASTER if we are looking up in the master zone.
*/
static enum GNUNET_GNS_LocalOptions local_options;
@@ -105,6 +95,15 @@ static struct GNUNET_IDENTITY_Operation *id_op;
*/
static struct GNUNET_SCHEDULER_Task *tt;
+/**
+ * Global return value.
+ * 0 on success (default),
+ * 1 on internal failures, 2 on launch failure,
+ * 3 if the name is not a GNS-supported TLD,
+ * 4 on timeout
+ */
+static int global_ret;
+
/**
* Task run on shutdown. Cleans up everything.
@@ -157,6 +156,7 @@ do_timeout (void *cls)
{
tt = NULL;
GNUNET_SCHEDULER_shutdown ();
+ global_ret = 4;
}
@@ -173,7 +173,6 @@ process_lookup_result (void *cls,
const struct GNUNET_GNSRECORD_Data *rd)
{
const char *name = cls;
- uint32_t i;
const char *typename;
char* string_val;
@@ -186,7 +185,7 @@ process_lookup_result (void *cls,
printf ("%s:\n",
name);
}
- for (i=0; i<rd_count; i++)
+ for (uint32_t i=0; i<rd_count; i++)
{
if ( (rd[i].record_type != rtype) &&
(GNUNET_GNSRECORD_TYPE_ANY != rtype) )
@@ -272,62 +271,58 @@ identity_zone_cb (void *cls,
el = NULL;
if (NULL == ego)
{
- fprintf (stderr,
- _("Ego for `%s' not found, cannot perform lookup.\n"),
- zone_ego_name);
+ global_ret = 3; /* Not a GNS TLD */
GNUNET_SCHEDULER_shutdown ();
}
else
{
- GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
+ GNUNET_IDENTITY_ego_get_public_key (ego,
+ &pkey);
lookup_with_public_key (&pkey);
}
- GNUNET_free_non_null (zone_ego_name);
- zone_ego_name = NULL;
}
/**
- * Method called to with the ego we are to use for the lookup,
- * when the ego is the one for the default master zone.
+ * Obtain the TLD of the given @a name.
*
- * @param cls closure (NULL, unused)
- * @param ego ego handle, NULL if not found
- * @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
+ * @param name a name
+ * @return the part of @a name after the last ".",
+ * or @a name if @a name does not contain a "."
*/
-static void
-identity_master_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
+static const char *
+get_tld (const char *name)
{
- struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
- const char *dot;
+ const char *tld;
- id_op = NULL;
- if (NULL == ego)
- {
- fprintf (stderr,
- _("Ego for `gns-master' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
- /* main name is our own master zone, do no look for that in the DHT */
- local_options = GNUNET_GNS_LO_LOCAL_MASTER;
+ tld = strrchr (name,
+ (unsigned char) '.');
+ if (NULL == tld)
+ tld = name;
+ else
+ tld++; /* skip the '.' */
+ return tld;
+}
- /* if the name is of the form 'label.gnu', never go to the DHT */
- dot = NULL;
- if (NULL != lookup_name)
- dot = strchr (lookup_name, '.');
- if ( (NULL != dot) &&
- (0 == strcasecmp (dot, ".gnu")) )
- local_options = GNUNET_GNS_LO_NO_DHT;
- lookup_with_public_key (&pkey);
+
+/**
+ * Eat the TLD of the given @a name.
+ *
+ * @param name a name
+ */
+static void
+eat_tld (char *name)
+{
+ char *tld;
+
+ GNUNET_assert (0 < strlen (name));
+ tld = strrchr (name,
+ (unsigned char) '.');
+ if (NULL == tld)
+ strcpy (name,
+ GNUNET_GNS_MASTERZONE_STR);
+ else
+ *tld = '\0';
}
@@ -346,6 +341,9 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
+ const char *tld;
+ char *dot_tld;
+ char *zonestr;
cfg = c;
gns = GNUNET_GNS_connect (cfg);
@@ -360,52 +358,64 @@ run (void *cls,
NULL);
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
- identity = GNUNET_IDENTITY_connect (cfg,
- NULL,
- NULL);
- if (NULL != public_key)
+ /* start with trivial case: TLD is zkey */
+ tld = get_tld (lookup_name);
+ if (GNUNET_OK ==
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (tld,
+ strlen (tld),
+ &pkey))
+ {
+ eat_tld (lookup_name);
+ lookup_with_public_key (&pkey);
+ return;
+ }
+
+ /* second case: TLD is mapped in our configuration file */
+ GNUNET_asprintf (&dot_tld,
+ ".%s",
+ tld);
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "gns",
+ dot_tld,
+ &zonestr))
{
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (public_key,
- strlen (public_key),
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr,
+ strlen (zonestr),
&pkey))
{
- fprintf (stderr,
- _("Public key `%s' is not well-formed\n"),
- public_key);
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ "gns",
+ dot_tld,
+ _("Expected a base32-encoded public zone key\n"));
+ GNUNET_free (zonestr);
+ GNUNET_free (dot_tld);
GNUNET_SCHEDULER_shutdown ();
return;
}
+ GNUNET_free (dot_tld);
+ GNUNET_free (zonestr);
+ eat_tld (lookup_name);
lookup_with_public_key (&pkey);
return;
}
- if (NULL != zone_ego_name)
- {
- el = GNUNET_IDENTITY_ego_lookup (cfg,
- zone_ego_name,
- &identity_zone_cb,
- NULL);
- return;
- }
- if ( (NULL != lookup_name) &&
- (strlen (lookup_name) > 4) &&
- (0 == strcmp (".zkey",
- &lookup_name[strlen (lookup_name) - 4])) )
- {
- /* no zone required, use 'anonymous' zone */
- GNUNET_CRYPTO_ecdsa_key_get_public (GNUNET_CRYPTO_ecdsa_key_get_anonymous (),
- &pkey);
- lookup_with_public_key (&pkey);
- }
- else
- {
- GNUNET_break (NULL == id_op);
- id_op = GNUNET_IDENTITY_get (identity,
- "gns-master",
- &identity_master_cb,
- NULL);
- GNUNET_assert (NULL != id_op);
- }
+ GNUNET_free (dot_tld);
+
+ /* Final case: TLD matches one of our egos */
+ eat_tld (lookup_name);
+
+ /* if the name is of the form 'label.gnu', never go to the DHT */
+ if (NULL == strchr (lookup_name,
+ (unsigned char) '.'))
+ local_options = GNUNET_GNS_LO_NO_DHT;
+ identity = GNUNET_IDENTITY_connect (cfg,
+ NULL,
+ NULL);
+ el = GNUNET_IDENTITY_ego_lookup (cfg,
+ tld,
+ &identity_zone_cb,
+ NULL);
}
@@ -421,63 +431,48 @@ main (int argc,
char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
-
- GNUNET_GETOPT_option_string ('u',
- "lookup",
- "NAME",
- gettext_noop ("Lookup a record for the given name"),
- &lookup_name),
-
+ GNUNET_GETOPT_option_mandatory
+ (GNUNET_GETOPT_option_string ('u',
+ "lookup",
+ "NAME",
+ gettext_noop ("Lookup a record for the given name"),
+ &lookup_name)),
GNUNET_GETOPT_option_string ('t',
"type",
"TYPE",
gettext_noop ("Specify the type of the record to lookup"),
&lookup_type),
-
GNUNET_GETOPT_option_relative_time ('T',
- "timeout",
- "DELAY",
- gettext_noop ("Specify timeout for the lookup"),
- &timeout),
-
+ "timeout",
+ "DELAY",
+ gettext_noop ("Specify timeout for the lookup"),
+ &timeout),
GNUNET_GETOPT_option_flag ('r',
- "raw",
- gettext_noop ("No unneeded output"),
- &raw),
-
- GNUNET_GETOPT_option_string ('p',
- "public-key",
- "PKEY",
- gettext_noop ("Specify the public key of the zone to lookup the record in"),
- &public_key),
-
- GNUNET_GETOPT_option_string ('z',
- "zone",
- "NAME",
- gettext_noop ("Specify the name of the ego of the zone to lookup the record in"),
- &zone_ego_name),
-
+ "raw",
+ gettext_noop ("No unneeded output"),
+ &raw),
GNUNET_GETOPT_OPTION_END
};
int ret;
timeout = GNUNET_TIME_UNIT_FOREVER_REL;
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv,
- &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
GNUNET_log_setup ("gnunet-gns",
"WARNING",
NULL);
- ret =
- (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
- "gnunet-gns",
- _("GNUnet GNS resolver tool"),
- options,
- &run, NULL)) ? 0 : 1;
+ ret = GNUNET_PROGRAM_run (argc, argv,
+ "gnunet-gns",
+ _("GNUnet GNS resolver tool"),
+ options,
+ &run, NULL);
GNUNET_free ((void*) argv);
- return ret;
+ if (GNUNET_OK != ret)
+ return 1;
+ return global_ret;
}
/* end of gnunet-gns.c */
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 69f1ca640..90cd47e1d 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2011-2013 GNUnet e.V.
+ Copyright (C) 2011-2018 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
@@ -29,7 +29,7 @@
#include "gnunet_dnsparser_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_namecache_service.h"
-#include "gnunet_identity_service.h"
+#include "gnunet_gnsrecord_lib.h"
#include "gnunet_gns_service.h"
#include "gnunet_statistics_service.h"
#include "gns.h"
@@ -44,7 +44,7 @@
struct GnsClient;
/**
- * Handle to a lookup operation from api
+ * Handle to a lookup operation from client via API.
*/
struct ClientLookupHandle
{
@@ -76,6 +76,10 @@ struct ClientLookupHandle
};
+
+/**
+ * Information we track per connected client.
+ */
struct GnsClient
{
/**
@@ -122,7 +126,7 @@ struct GNS_TopLevelDomain
/**
* Public key associated with the @a tld.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey pkey;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
/**
* Top-level domain as a string, including leading ".".
@@ -143,17 +147,6 @@ static struct GNUNET_DHT_Handle *dht_handle;
static struct GNUNET_NAMECACHE_Handle *namecache_handle;
/**
- * Our handle to the identity service
- */
-static struct GNUNET_IDENTITY_Handle *identity_handle;
-
-/**
- * Our handle to the identity operation to find the master zone
- * for intercepted queries.
- */
-static struct GNUNET_IDENTITY_Operation *identity_op;
-
-/**
* #GNUNET_YES if ipv6 is supported
*/
static int v6_enabled;
@@ -188,7 +181,7 @@ static struct GNS_TopLevelDomain *tld_tail;
*/
int
GNS_find_tld (const char *tld_str,
- struct GNUNET_CRYPTO_EddsaPublicKey *pkey)
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
{
if ('\0' == *tld_str)
return GNUNET_NO;
@@ -204,16 +197,36 @@ GNS_find_tld (const char *tld_str,
}
}
if (GNUNET_OK ==
- GNUNET_STRINGS_string_to_data (tld_str + 1,
- strlen (tld_str + 1),
- pkey,
- sizeof (*pkey)))
+ GNUNET_GNSRECORD_zkey_to_pkey (tld_str + 1,
+ pkey))
return GNUNET_YES; /* TLD string *was* the public key */
return GNUNET_NO;
}
/**
+ * Obtain the TLD of the given @a name.
+ *
+ * @param name a name
+ * @return the part of @a name after the last ".",
+ * or @a name if @a name does not contain a "."
+ */
+const char *
+GNS_get_tld (const char *name)
+{
+ const char *tld;
+
+ tld = strrchr (name,
+ (unsigned char) '.');
+ if (NULL == tld)
+ tld = name;
+ else
+ tld++; /* skip the '.' */
+ return tld;
+}
+
+
+/**
* Task run during shutdown.
*
* @param cls unused
@@ -227,16 +240,6 @@ shutdown_task (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down!\n");
GNS_interceptor_done ();
- if (NULL != identity_op)
- {
- GNUNET_IDENTITY_cancel (identity_op);
- identity_op = NULL;
- }
- if (NULL != identity_handle)
- {
- GNUNET_IDENTITY_disconnect (identity_handle);
- identity_handle = NULL;
- }
GNS_resolver_done ();
if (NULL != statistics)
{
@@ -416,7 +419,8 @@ handle_lookup (void *cls,
GNUNET_SERVICE_client_continue (gc->client);
utf_in = (const char *) &sh_msg[1];
- GNUNET_STRINGS_utf8_tolower (utf_in, nameptr);
+ GNUNET_STRINGS_utf8_tolower (utf_in,
+ nameptr);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received LOOKUP `%s' message\n",
name);
@@ -432,7 +436,9 @@ handle_lookup (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"LOOKUP: Query for A record but AF_INET not supported!");
- send_lookup_response (clh, 0, NULL);
+ send_lookup_response (clh,
+ 0,
+ NULL);
return;
}
if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) &&
@@ -440,7 +446,9 @@ handle_lookup (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"LOOKUP: Query for AAAA record but AF_INET6 not supported!");
- send_lookup_response (clh, 0, NULL);
+ send_lookup_response (clh,
+ 0,
+ NULL);
return;
}
clh->lookup = GNS_resolver_lookup (&sh_msg->zone,
@@ -455,57 +463,6 @@ handle_lookup (void *cls,
/**
- * Method called to inform about the ego to be used for the master zone
- * for DNS interceptions.
- *
- * This function is only called ONCE, and 'NULL' being passed in
- * @a ego does indicate that interception is not configured.
- * If @a ego is non-NULL, we should start to intercept DNS queries
- * and resolve ".gnu" queries using the given ego as the master zone.
- *
- * @param cls closure, our `const struct GNUNET_CONFIGURATION_Handle *c`
- * @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_intercept_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- struct GNUNET_CRYPTO_EcdsaPublicKey dns_root;
-
- identity_op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Looking for gns-intercept ego\n");
- if (NULL == ego)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("No ego configured for `%s`\n"),
- "gns-intercept");
-
- return;
- }
- GNUNET_IDENTITY_ego_get_public_key (ego,
- &dns_root);
- if (GNUNET_SYSERR ==
- GNS_interceptor_init (&dns_root,
- cfg))
- {
- GNUNET_break (0);
- GNUNET_SCHEDULER_add_now (&shutdown_task,
- NULL);
- return;
- }
-}
-
-
-/**
* Reads the configuration and populates TLDs
*
* @param cls unused
@@ -519,7 +476,7 @@ read_service_conf (void *cls,
const char *option,
const char *value)
{
- struct GNUNET_CRYPTO_EddsaPublicKey pk;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pk;
struct GNS_TopLevelDomain *tld;
if (option[0] != '.')
@@ -545,7 +502,6 @@ read_service_conf (void *cls,
}
-
/**
* Process GNS requests.
*
@@ -594,29 +550,24 @@ run (void *cls,
NULL);
return;
}
-
- identity_handle = GNUNET_IDENTITY_connect (c,
- NULL,
- NULL);
- if (NULL == identity_handle)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Could not connect to identity service!\n");
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Looking for gns-intercept ego\n");
- identity_op = GNUNET_IDENTITY_get (identity_handle,
- "gns-intercept",
- &identity_intercept_cb,
- (void *) c);
- }
GNS_resolver_init (namecache_handle,
dht_handle,
c,
max_parallel_bg_queries);
- statistics = GNUNET_STATISTICS_create ("gns", c);
+ if ( (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (c,
+ "gns",
+ "INTERCEPT_DNS")) &&
+ (GNUNET_SYSERR ==
+ GNS_interceptor_init (c)) )
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_add_now (&shutdown_task,
+ NULL);
+ return;
+ }
+ statistics = GNUNET_STATISTICS_create ("gns",
+ c);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h
index 3662c945d..439bad881 100644
--- a/src/gns/gnunet-service-gns.h
+++ b/src/gns/gnunet-service-gns.h
@@ -23,10 +23,10 @@
* @author Martin Schanzenbach
* @author Christian Grothoff
*/
-
#ifndef GNUNET_SERVICE_GNS_H
#define GNUNET_SERVICE_GNS_H
+
/**
* Find GNS zone belonging to TLD @a tld.
*
@@ -36,6 +36,18 @@
*/
int
GNS_find_tld (const char *tld_str,
- struct GNUNET_CRYPTO_EddsaPublicKey *pkey);
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
+
+
+/**
+ * Obtain the TLD of the given @a name.
+ *
+ * @param name a name
+ * @return the part of @a name after the last ".",
+ * or @a name if @a name does not contain a "."
+ */
+const char *
+GNS_get_tld (const char *name);
+
#endif
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 71aa08dc5..0425e9500 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -27,6 +27,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
+#include "gnunet-service-gns.h"
#include "gnunet-service-gns_resolver.h"
#include "gnunet-service-gns_interceptor.h"
#include "gns.h"
@@ -73,11 +74,6 @@ struct InterceptLookupHandle
static struct GNUNET_DNS_Handle *dns_handle;
/**
- * Key of the zone we start lookups in.
- */
-static struct GNUNET_CRYPTO_EcdsaPublicKey zone;
-
-/**
* Head of the DLL.
*/
static struct InterceptLookupHandle *ilh_head;
@@ -298,6 +294,7 @@ handle_dns_request (void *cls,
{
struct GNUNET_DNSPARSER_Packet *p;
struct InterceptLookupHandle *ilh;
+ struct GNUNET_CRYPTO_EcdsaPublicKey zone;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Hijacked a DNS request. Processing.\n");
@@ -321,9 +318,9 @@ handle_dns_request (void *cls,
}
/* Check for GNS TLDs. */
- if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) ||
- (GNUNET_YES == is_zkey_tld (p->queries[0].name)) ||
- (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) )
+ if (GNUNET_YES ==
+ GNS_find_tld (GNS_get_tld (p->queries[0].name),
+ &zone))
{
/* Start resolution in GNS */
ilh = GNUNET_new (struct InterceptLookupHandle);
@@ -351,17 +348,14 @@ handle_dns_request (void *cls,
/**
* Initialized the interceptor
*
- * @param gnu_zone the zone to work in
* @param c the configuration
* @return #GNUNET_OK on success
*/
int
-GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone,
- const struct GNUNET_CONFIGURATION_Handle *c)
+GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"DNS hijacking enabled. Connecting to DNS service.\n");
- zone = *gnu_zone;
dns_handle = GNUNET_DNS_connect (c,
GNUNET_DNS_FLAG_PRE_RESOLUTION,
&handle_dns_request,
@@ -386,7 +380,9 @@ GNS_interceptor_done ()
while (NULL != (ilh = ilh_head))
{
- GNUNET_CONTAINER_DLL_remove (ilh_head, ilh_tail, ilh);
+ GNUNET_CONTAINER_DLL_remove (ilh_head,
+ ilh_tail,
+ ilh);
GNS_resolver_lookup_cancel (ilh->lookup);
GNUNET_DNS_request_drop (ilh->request_handle);
GNUNET_DNSPARSER_free_packet (ilh->packet);
diff --git a/src/gns/gnunet-service-gns_interceptor.h b/src/gns/gnunet-service-gns_interceptor.h
index 73d349854..ff54b7b6e 100644
--- a/src/gns/gnunet-service-gns_interceptor.h
+++ b/src/gns/gnunet-service-gns_interceptor.h
@@ -31,13 +31,11 @@
/**
* Initialize DNS interceptor
*
- * @param gnu_zone the zone we start lookups in
* @param c the configuration
- * @return GNUNET_YES on success GNUNET_SYSERR on error
+ * @return #GNUNET_YES on success #GNUNET_SYSERR on error
*/
int
-GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone,
- const struct GNUNET_CONFIGURATION_Handle *c);
+GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c);
/**
* Stops the interceptor
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 533c0cada..ef191bbb3 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -37,6 +37,7 @@
#include "gnunet_tun_lib.h"
#include "gnunet_gns_service.h"
#include "gns.h"
+#include "gnunet-service-gns.h"
#include "gnunet-service-gns_resolver.h"
#include "gnunet_vpn_service.h"
@@ -237,6 +238,10 @@ struct Gns2DnsContext
*/
struct GNS_ResolverHandle *rh;
+ /**
+ * Handle for DNS resolution of the DNS nameserver.
+ */
+ struct GNUNET_RESOLVER_RequestHandle *dns_rh;
};
@@ -473,7 +478,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
* even though they consist of multiple labels.
*
* Examples:
- * a.b.gnu = not canonical
+ * a.b.gnu = not canonical
* a = canonical
* _foo._srv = canonical
* _f.bar = not canonical
@@ -481,18 +486,20 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
* @param name the name to test
* @return #GNUNET_YES if canonical
*/
-static int
+/* dead, but keep for now */ int
is_canonical (const char *name)
{
const char *pos;
const char *dot;
- if (NULL == strchr (name, '.'))
+ if (NULL == strchr (name,
+ (unsigned char) '.'))
return GNUNET_YES;
if ('_' != name[0])
return GNUNET_NO;
pos = &name[1];
- while (NULL != (dot = strchr (pos, '.')))
+ while (NULL != (dot = strchr (pos,
+ (unsigned char) '.')))
if ('_' != dot[1])
return GNUNET_NO;
else
@@ -857,11 +864,31 @@ dns_result_parser (void *cls,
(GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) &&
(GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) )
{
+ int af;
+
GNUNET_free (rh->name);
rh->name = GNUNET_strdup (p->answers[0].data.hostname);
rh->name_resolution_pos = strlen (rh->name);
- rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
- rh);
+ switch (rh->record_type)
+ {
+ case GNUNET_DNSPARSER_TYPE_A:
+ af = AF_INET;
+ break;
+ case GNUNET_DNSPARSER_TYPE_AAAA:
+ af = AF_INET6;
+ break;
+ default:
+ af = AF_UNSPEC;
+ break;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Doing standard DNS lookup for `%s'\n",
+ rh->name);
+ rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
+ af,
+ DNS_LOOKUP_TIMEOUT,
+ &handle_dns_result,
+ rh);
GNUNET_DNSPARSER_free_packet (p);
return;
}
@@ -944,9 +971,9 @@ dns_result_parser (void *cls,
buf_start = buf_off;
if (GNUNET_OK !=
GNUNET_DNSPARSER_builder_add_soa (buf,
- sizeof (buf),
- &buf_off,
- rec->data.soa))
+ sizeof (buf),
+ &buf_off,
+ rec->data.soa))
{
GNUNET_break (0);
skip++;
@@ -997,7 +1024,9 @@ dns_result_parser (void *cls,
"Returning DNS response for `%s' with %u answers\n",
rh->ac_tail->label,
(unsigned int) p->num_answers);
- rh->proc (rh->proc_cls, rd_count - skip, rd);
+ rh->proc (rh->proc_cls,
+ rd_count - skip,
+ rd);
GNS_resolver_lookup_cancel (rh);
}
GNUNET_DNSPARSER_free_packet (p);
@@ -1100,6 +1129,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
size_t nlen;
char *res;
struct AuthorityChain *ac;
+ int af;
nlen = strlen (cname);
if ( (nlen > 2) &&
@@ -1139,12 +1169,30 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
rh);
return;
}
- /* name is absolute, start from the beginning */
+ /* name is absolute, go to DNS */
GNUNET_free (rh->name);
rh->name = GNUNET_strdup (cname);
rh->name_resolution_pos = strlen (rh->name);
- rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
- rh);
+ switch (rh->record_type)
+ {
+ case GNUNET_DNSPARSER_TYPE_A:
+ af = AF_INET;
+ break;
+ case GNUNET_DNSPARSER_TYPE_AAAA:
+ af = AF_INET6;
+ break;
+ default:
+ af = AF_UNSPEC;
+ break;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Doing standard DNS lookup for `%s'\n",
+ rh->name);
+ rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
+ af,
+ DNS_LOOKUP_TIMEOUT,
+ &handle_dns_result,
+ rh);
}
@@ -1247,7 +1295,6 @@ handle_gns2dns_result (void *cls,
{
struct GNS_ResolverHandle *rh = cls;
struct AuthorityChain *ac;
- unsigned int j;
struct sockaddr *sa;
struct sockaddr_in v4;
struct sockaddr_in6 v6;
@@ -1258,13 +1305,16 @@ handle_gns2dns_result (void *cls,
"Received %u results for IP address of DNS server for GNS2DNS transition\n",
rd_count);
/* enable cleanup of 'rh' handle that comes next... */
- GNUNET_CONTAINER_DLL_insert (rlh_head,
- rlh_tail,
- rh->g2dc->rh);
- rh->g2dc->rh = NULL;
+ if (NULL != rh->g2dc->rh)
+ {
+ GNUNET_CONTAINER_DLL_insert (rlh_head,
+ rlh_tail,
+ rh->g2dc->rh);
+ rh->g2dc->rh = NULL;
+ }
sa = NULL;
sa_len = 0;
- for (j=0;j<rd_count;j++)
+ for (unsigned int j=0;j<rd_count;j++)
{
switch (rd[j].record_type)
{
@@ -1348,7 +1398,8 @@ handle_gns2dns_result (void *cls,
rh->g2dc = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Will continue resolution using DNS server `%s' to resolve `%s'\n",
- GNUNET_a2s (sa, sa_len),
+ GNUNET_a2s (sa,
+ sa_len),
ac->label);
GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
rh->ac_tail,
@@ -1369,6 +1420,69 @@ handle_gns2dns_result (void *cls,
/**
+ * Function called by the resolver for each address obtained from DNS.
+ *
+ * @param cls closure, a `struct Gns2DnsContext *`
+ * @param addr one of the addresses of the host, NULL for the last address
+ * @param addrlen length of @a addr
+ */
+static void
+handle_gns2dns_ip (void *cls,
+ const struct sockaddr *addr,
+ socklen_t addrlen)
+{
+ struct Gns2DnsContext *g2dc = cls;
+ struct GNUNET_GNSRECORD_Data rd;
+
+ if (NULL == addr)
+ {
+ /* DNS resolution failed */
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Failed to use DNS to resolve name of DNS resolver\n");
+ g2dc->rh->g2dc = NULL;
+ fail_resolution (g2dc->rh);
+ GNUNET_free (g2dc);
+ }
+ switch (addr->sa_family)
+ {
+ case AF_INET:
+ {
+ const struct sockaddr_in *v4 = (const struct sockaddr_in *) addr;
+
+ GNUNET_assert (sizeof (*v4) == addrlen);
+ rd.data = v4;
+ rd.data_size = sizeof (*v4);
+ rd.expiration_time = UINT64_MAX;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_A;
+ rd.flags = 0;
+ break;
+ }
+ case AF_INET6:
+ {
+ const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *) addr;
+
+ GNUNET_assert (sizeof (*v6) == addrlen);
+ rd.data = v6;
+ rd.data_size = sizeof (v6);
+ rd.expiration_time = UINT64_MAX;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_AAAA;
+ rd.flags = 0;
+ break;
+ }
+ default:
+ return;
+ }
+ GNUNET_RESOLVER_request_cancel (g2dc->dns_rh);
+ g2dc->dns_rh = NULL;
+ handle_gns2dns_result (g2dc->rh,
+ 1,
+ &rd);
+
+}
+
+
+
+/**
* Process a records that were decrypted from a block.
*
* @param cls closure with the `struct GNS_ResolverHandle`
@@ -1513,7 +1627,7 @@ handle_gns_resolution_result (void *cls,
rd_new[rd_off] = rd[i];
/* Check if the embedded name(s) end in "+", and if so,
replace the "+" with the zone at "ac_tail", changing the name
- to a ".zkey". The name is allocated on the 'scratch' array,
+ to a ".ZONEKEY". The name is allocated on the 'scratch' array,
so we can free it afterwards. */
switch (rd[i].record_type)
{
@@ -1760,7 +1874,9 @@ handle_gns_resolution_result (void *cls,
"Returning GNS response for `%s' with %u answers\n",
rh->ac_tail->label,
rd_off);
- rh->proc (rh->proc_cls, rd_off, rd_new);
+ rh->proc (rh->proc_cls,
+ rd_off,
+ rd_new);
GNS_resolver_lookup_cancel (rh);
return;
}
@@ -1804,6 +1920,10 @@ handle_gns_resolution_result (void *cls,
struct Gns2DnsContext *g2dc;
char *ip;
char *ns;
+ const char *tld;
+ struct GNUNET_CRYPTO_EcdsaPublicKey zone;
+ struct in_addr v4;
+ struct in6_addr v6;
off = 0;
ns = GNUNET_DNSPARSER_parse_name (rd[i].data,
@@ -1819,29 +1939,96 @@ handle_gns_resolution_result (void *cls,
GNUNET_break_op (0);
GNUNET_free_non_null (ns);
GNUNET_free_non_null (ip);
- rh->proc (rh->proc_cls, 0, NULL);
- GNS_resolver_lookup_cancel (rh);
+ fail_resolution (rh);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Resolving `%s' to determine IP address of DNS server for GNS2DNS transition\n",
- ip);
/* resolve 'ip' to determine the IP(s) of the DNS
- resolver to use */
+ resolver to use for lookup of 'ns' */
g2dc = GNUNET_new (struct Gns2DnsContext);
g2dc->ns = ns;
+ rh->g2dc = g2dc;
+
+ /* check if 'ip' is already an IPv4/IPv6 address */
+ if (1 == inet_pton (AF_INET,
+ ip,
+ &v4))
+ {
+ /* name is IPv4 address, pretend it's an A record */
+ struct GNUNET_GNSRECORD_Data rd;
+
+ GNUNET_free (ip);
+ rd.data = &v4;
+ rd.data_size = sizeof (v4);
+ rd.expiration_time = UINT64_MAX;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_A;
+ rd.flags = 0;
+ handle_gns2dns_result (rh,
+ 1,
+ &rd);
+ return;
+ }
+ if (1 == inet_pton (AF_INET6,
+ ip,
+ &v6))
+ {
+ /* name is IPv6 address, pretend it's an AAAA record */
+ struct GNUNET_GNSRECORD_Data rd;
+
+ GNUNET_free (ip);
+ rd.data = &v6;
+ rd.data_size = sizeof (v6);
+ rd.expiration_time = UINT64_MAX;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_AAAA;
+ rd.flags = 0;
+ handle_gns2dns_result (rh,
+ 1,
+ &rd);
+ return;
+ }
+ tld = GNS_get_tld (ip);
+ if (0 != strcmp (tld,
+ "+"))
+ {
+ /* 'ip' is a DNS name */
+ g2dc->dns_rh = GNUNET_RESOLVER_ip_get (ip,
+ AF_UNSPEC,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &handle_gns2dns_ip,
+ g2dc);
+ GNUNET_free (ip);
+ return;
+ }
+
+ /* 'ip' should be a GNS name */
g2dc->rh = GNUNET_new (struct GNS_ResolverHandle);
- g2dc->rh->authority_zone = rh->ac_tail->authority_info.gns_authority;
- ip = translate_dot_plus (rh, ip);
+
+ ip = translate_dot_plus (rh,
+ ip);
+ tld = GNS_get_tld (ip);
+ if (GNUNET_OK !=
+ GNUNET_GNSRECORD_zkey_to_pkey (tld,
+ &zone))
+ {
+ GNUNET_break_op (0);
+ GNUNET_free_non_null (ns);
+ GNUNET_free_non_null (ip);
+ GNUNET_free (g2dc);
+ fail_resolution (rh);
+ return;
+ }
+ g2dc->rh->authority_zone = zone;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Resolving `%s' to determine IP address of DNS server for GNS2DNS transition for `%s'\n",
+ ip,
+ ns);
g2dc->rh->name = ip;
- g2dc->rh->name_resolution_pos = strlen (ip);
+ g2dc->rh->name_resolution_pos = strlen (ip) - strlen (tld) - 1;
g2dc->rh->proc = &handle_gns2dns_result;
g2dc->rh->proc_cls = rh;
g2dc->rh->record_type = GNUNET_GNSRECORD_TYPE_ANY;
g2dc->rh->options = GNUNET_GNS_LO_DEFAULT;
g2dc->rh->loop_limiter = rh->loop_limiter + 1;
- rh->g2dc = g2dc;
g2dc->rh->task_id
= GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
g2dc->rh);
@@ -2259,7 +2446,6 @@ start_resolver_lookup (void *cls)
{
struct GNS_ResolverHandle *rh = cls;
struct AuthorityChain *ac;
- char *y;
struct in_addr v4;
struct in6_addr v6;
@@ -2296,66 +2482,14 @@ start_resolver_lookup (void *cls)
GNS_resolver_lookup_cancel (rh);
return;
}
- if ( ( (GNUNET_YES == is_canonical (rh->name)) &&
- (0 != strcmp (GNUNET_GNS_TLD, rh->name)) ) ||
- ( (GNUNET_YES != is_gnu_tld (rh->name)) &&
- (GNUNET_YES != is_zkey_tld (rh->name)) ) )
- {
- /* use standard DNS lookup */
- int af;
- switch (rh->record_type)
- {
- case GNUNET_DNSPARSER_TYPE_A:
- af = AF_INET;
- break;
- case GNUNET_DNSPARSER_TYPE_AAAA:
- af = AF_INET6;
- break;
- default:
- af = AF_UNSPEC;
- break;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Doing standard DNS lookup for `%s'\n",
- rh->name);
- rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
- af,
- DNS_LOOKUP_TIMEOUT,
- &handle_dns_result,
- rh);
- return;
- }
- if (is_zkey_tld (rh->name))
- {
- /* Name ends with ".zkey", try to replace authority zone with zkey
- authority */
- GNUNET_free (resolver_lookup_get_next_label (rh)); /* will return "zkey" */
- y = resolver_lookup_get_next_label (rh); /* will return 'y' coordinate */
- if ( (NULL == y) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (y,
- strlen (y),
- &rh->authority_zone)) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Hostname `%s' is not well-formed, resolution fails\n"),
- rh->name);
- rh->task_id = GNUNET_SCHEDULER_add_now (&fail_resolution, rh);
- }
- GNUNET_free_non_null (y);
- }
- else
- {
- /* Name ends with ".gnu", eat ".gnu" and continue with resolution */
- GNUNET_free (resolver_lookup_get_next_label (rh));
- }
ac = GNUNET_new (struct AuthorityChain);
ac->rh = rh;
ac->label = resolver_lookup_get_next_label (rh);
ac->suggested_shortening_label = NULL;
if (NULL == ac->label)
- /* name was just "gnu", so we default to label '+' */
+ /* name was just the "TLD", so we default to label
+ #GNUNET_GNS_MASTERZONE_STR */
ac->label = GNUNET_strdup (GNUNET_GNS_MASTERZONE_STR);
ac->gns_authority = GNUNET_YES;
ac->authority_info.gns_authority = rh->authority_zone;
@@ -2446,6 +2580,11 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh)
GNS_resolver_lookup_cancel (rh->g2dc->rh);
rh->g2dc->rh = NULL;
}
+ if (NULL != rh->g2dc->dns_rh)
+ {
+ GNUNET_RESOLVER_request_cancel (rh->g2dc->dns_rh);
+ rh->g2dc->rh = NULL;
+ }
GNUNET_free (rh->g2dc->ns);
GNUNET_free (rh->g2dc);
rh->g2dc = NULL;
@@ -2588,28 +2727,4 @@ GNS_resolver_done ()
}
-/* *************** common helper functions (do not really belong here) *********** */
-
-/**
- * Checks if @a name ends in ".TLD"
- *
- * @param name the name to check
- * @param tld the TLD to check for
- * @return #GNUNET_YES or #GNUNET_NO
- */
-int
-is_tld (const char* name,
- const char* tld)
-{
- size_t offset = 0;
-
- if (strlen (name) <= strlen (tld))
- return GNUNET_NO;
- offset = strlen (name) - strlen (tld);
- if (0 != strcmp (name + offset, tld))
- return GNUNET_NO;
- return GNUNET_YES;
-}
-
-
/* end of gnunet-service-gns_resolver.c */
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h
index c71d3983d..06ecc51ce 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -100,25 +100,4 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
void
GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
-
-/**
- * Generic function to check for TLDs. Checks if "name" ends in ".tld"
- *
- * @param name the name to check
- * @param tld the tld to check
- * @return #GNUNET_YES or #GNUNET_NO
- */
-int
-is_tld (const char *name,
- const char *tld);
-
-
-
-/**
- * Checks for gnu/zkey
- */
-#define is_gnu_tld(name) is_tld(name, GNUNET_GNS_TLD)
-#define is_zkey_tld(name) is_tld(name, GNUNET_GNS_TLD_ZKEY)
-
-
#endif
diff --git a/src/gns/test_gns_cname_lookup.sh b/src/gns/test_gns_cname_lookup.sh
index 789c7f30b..d9627850f 100755
--- a/src/gns/test_gns_cname_lookup.sh
+++ b/src/gns/test_gns_cname_lookup.sh
@@ -24,8 +24,6 @@ fi
rm -rf /tmp/test-gnunet-gns-peer-1/
-TEST_DOMAIN_PLUS="www.gnu"
-TEST_DOMAIN_DNS="www3.gnu"
TEST_IP_PLUS="127.0.0.1"
TEST_IP_DNS="131.159.74.67"
TEST_RECORD_CNAME_SERVER="server"
@@ -34,35 +32,38 @@ TEST_RECORD_CNAME_DNS="gnunet.org"
TEST_RECORD_NAME_SERVER="server"
TEST_RECORD_NAME_PLUS="www"
TEST_RECORD_NAME_DNS="www3"
+MY_EGO="myego"
+TEST_DOMAIN_PLUS="www.$MY_EGO"
+TEST_DOMAIN_DNS="www3.$MY_EGO"
which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
-RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf`
-RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_PLUS -t CNAME -c test_gns_lookup.conf`
-RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf`
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
+RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf`
+RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t CNAME -c test_gns_lookup.conf`
+RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf`
TESTEGOZONE=`gnunet-identity -c test_gns_lookup.conf -d | awk '{print $3}'`
-gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
-if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE.zkey" ]
+if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE" ]
then
- echo "PASS: CNAME resulution from GNS"
+ echo "PASS: CNAME resolution from GNS"
else
- echo "FAIL: CNAME resolution from GNS, got $RES_CNAME_RAW, expected server.$TESTEGOZONE.zkey."
+ echo "FAIL: CNAME resolution from GNS, got $RES_CNAME_RAW, expected server.$TESTEGOZONE."
exit 1
fi
if [ "$RES_CNAME" == "$TEST_IP_PLUS" ]
then
- echo "PASS: IP resulution from GNS"
+ echo "PASS: IP resolution from GNS"
else
echo "FAIL: IP resolution from GNS, got $RES_CNAME, expected $TEST_IP_PLUS."
exit 1
@@ -70,9 +71,9 @@ fi
if [ "$RES_CNAME_DNS" == "$TEST_IP_DNS" ]
then
- echo "PASS: IP resulution from DNS"
+ echo "PASS: IP resolution from DNS"
exit 0
else
- echo "FAIL: IP resulution from DNS, got $RES_IP, expected $TEST_IP_DNS."
+ echo "FAIL: IP resolution from DNS, got $RES_IP, expected $TEST_IP_DNS."
exit 1
fi
diff --git a/src/gns/test_gns_delegated_lookup.sh b/src/gns/test_gns_delegated_lookup.sh
index 3826d3e32..edda688ff 100755
--- a/src/gns/test_gns_delegated_lookup.sh
+++ b/src/gns/test_gns_delegated_lookup.sh
@@ -10,22 +10,26 @@ fi
$LOCATION --version 1> /dev/null
if test $? != 0
then
- echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
+ echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
exit 77
fi
rm -rf /tmp/test-gnunet-gns-peer-1/
+MY_EGO="myego"
+OTHER_EGO="delegatedego"
+FINAL_LABEL="www"
+DELEGATION_LABEL="b"
TEST_IP="127.0.0.1"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C delegatedego -c test_gns_lookup.conf
-DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
+DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $DELEGATION_LABEL -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $OTHER_EGO -a -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $FINAL_LABEL.$DELEGATION_LABEL.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -z $OTHER_EGO -d -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh
index a6e4acc77..365c77339 100755
--- a/src/gns/test_gns_dht_lookup.sh
+++ b/src/gns/test_gns_dht_lookup.sh
@@ -10,22 +10,26 @@ fi
$LOCATION --version 1> /dev/null
if test $? != 0
then
- echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
+ echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
exit 77
fi
TEST_IP="127.0.0.1"
+MY_EGO="myego"
+OTHER_EGO="delegatedego"
+
+
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C delegatedego -c test_gns_lookup.conf
-DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
+DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-arm -i gns -c test_gns_lookup.conf
sleep 0.5
-gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_gns2dns_lookup.sh b/src/gns/test_gns_gns2dns_lookup.sh
index f7299a57d..921d9594d 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -25,10 +25,6 @@ TEST_IP_GNS2DNS="8.8.8.8"
# main label used during resolution
TEST_RECORD_NAME="homepage"
-# various names we will use for resolution
-TEST_DOMAIN="www.${TEST_RECORD_NAME}.gnu"
-TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.gnu"
-TEST_DOMAIN_ALT2="uk.${TEST_RECORD_NAME}.gnu"
if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null
then
@@ -42,29 +38,39 @@ TEST_RESOLVER_LABEL="resolver"
# using the TEST_RESOLVER_LABEL DNS server for resolution
TEST_RECORD_GNS2DNS="gnunet.org@${TEST_RESOLVER_LABEL}.+"
+MY_EGO="myego"
+# various names we will use for resolution
+TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
+TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO"
+TEST_DOMAIN_ALT2="uk.${TEST_RECORD_NAME}.$MY_EGO"
+
+
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
# set IP address for DNS resolver for resolving in gnunet.org domain
-gnunet-namestore -p -z testego -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
-# map 'homepage.gnu' to 'gnunet.org' in DNS
-gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
+# map '$TEST_RECORD_NAME.$MY_EGO' to 'gnunet.org' in DNS
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
+echo "EGOs:"
+gnunet-identity -d
+
# lookup 'www.gnunet.org', IPv4
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
# lookup 'www.gnunet.org', IPv6
-RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf`
+RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf`
# lookup 'gnunet.org', IPv4
-RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf`
+RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf`
# lookup 'uk.gnunet.org', IPv4
-RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf`
+RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf`
# clean up
-gnunet-namestore -z testego -d -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
-gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-namestore -z $MY_EGO -d -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
+gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_ipv6_lookup.sh
index f34a76727..118c23060 100755
--- a/src/gns/test_gns_ipv6_lookup.sh
+++ b/src/gns/test_gns_ipv6_lookup.sh
@@ -12,16 +12,17 @@ then
echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
exit 77
fi
+MY_EGO="myego"
rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_IP="dead::beef"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t AAAA -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t AAAA -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_lookup.sh b/src/gns/test_gns_lookup.sh
index ddee5b78d..79558afae 100755
--- a/src/gns/test_gns_lookup.sh
+++ b/src/gns/test_gns_lookup.sh
@@ -16,12 +16,14 @@ fi
rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_IP="127.0.0.1"
+MY_EGO="myego"
+LABEL="www"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
if [ "$RES_IP" == "$TEST_IP" ]
diff --git a/src/gns/test_gns_mx_lookup.sh b/src/gns/test_gns_mx_lookup.sh
index f8cea2d0f..8abc9f509 100755
--- a/src/gns/test_gns_mx_lookup.sh
+++ b/src/gns/test_gns_mx_lookup.sh
@@ -16,21 +16,24 @@ fi
rm -rf /tmp/test-gnunet-gns-peer-1/
which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
-TEST_MX="5,mail.gnu"
+MY_EGO="myego"
+TEST_MX="5,mail.+"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+PKEY=`gnunet-identity -d | grep "$MY_EGO - " | awk '{print $3'}`
+WANT_MX="5,mail.$PKEY"
+gnunet-namestore -p -z $MY_EGO -a -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
-RES_MX=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t MX -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+RES_MX=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t MX -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
-if [ "$RES_MX" == "$TEST_MX" ]
+if [ "$RES_MX" == "$WANT_MX" ]
then
exit 0
else
- echo "FAIL: did not get proper IP, got $RES_MX."
+ echo "FAIL: did not get proper IP, got $RES_MX, expected $WANT_MX."
exit 1
fi
diff --git a/src/gns/test_gns_plus_lookup.sh b/src/gns/test_gns_plus_lookup.sh
index a6a9e8da4..4cf7a8855 100755
--- a/src/gns/test_gns_plus_lookup.sh
+++ b/src/gns/test_gns_plus_lookup.sh
@@ -17,14 +17,15 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
rm -rf /tmp/test-gnunet-gns-peer-1/
TEST_IP="127.0.0.1"
+MY_EGO="myego"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C delegatedego -c test_gns_lookup.conf
DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z delegatedego -a -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -z delegatedego -d -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_quickupdate.sh b/src/gns/test_gns_quickupdate.sh
index d58a2712c..5606491e4 100755
--- a/src/gns/test_gns_quickupdate.sh
+++ b/src/gns/test_gns_quickupdate.sh
@@ -9,41 +9,49 @@ fi
$LOCATION --version 1> /dev/null
if test $? != 0
then
- echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
+ echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
exit 77
fi
+MY_EGO="myego"
+OTHER_EGO="delegatedego"
+
+
rm -rf /tmp/test-gnunet-gns-peer-1/
which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
TEST_IP="127.0.0.1"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-identity -C delegatedego -c test_gns_lookup.conf
-DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
+DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
gnunet-arm -i gns -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
# Give GNS/namestore time to fully start and finish initial iteration
sleep 2
# Performing namestore update
-gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
# Give GNS chance to observe store event via monitor
sleep 1
-gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
# give GNS chance to process monitor event
sleep 1
# stop everything and restart to check that DHT PUT did happen
gnunet-arm -k gns -c test_gns_lookup.conf
gnunet-arm -k namestore -c test_gns_lookup.conf
gnunet-arm -k namecache -c test_gns_lookup.conf
+gnunet-arm -k zonemaster -c test_gns_lookup.conf
# Purge nameacache, as we might otherwise fetch from there
-rm -r `gnunet-config -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME`
+# FIXME: testcase started failing after the line below was fixed by adding '-f',
+# might have never worked (!)
+rm -r `gnunet-config -f -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME`
gnunet-arm -i namestore -c test_gns_lookup.conf
gnunet-arm -i namecache -c test_gns_lookup.conf
+gnunet-arm -i zonemaster -c test_gns_lookup.conf
gnunet-arm -i gns -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
-gnunet-identity -D delegatedego -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
+gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
@@ -51,6 +59,6 @@ if [ "$RES_IP" == "$TEST_IP" ]
then
exit 0
else
- echo "Failed to properly resolve IP, got $RES_IP."
+ echo "Failed to properly resolve IP, expected $TEST_IP, got $RES_IP."
exit 1
fi
diff --git a/src/gns/test_gns_rel_expiration.sh b/src/gns/test_gns_rel_expiration.sh
index 9890641e2..992098db3 100755
--- a/src/gns/test_gns_rel_expiration.sh
+++ b/src/gns/test_gns_rel_expiration.sh
@@ -13,27 +13,30 @@ then
exit 77
fi
+MY_EGO="myego"
+OTHER_EGO="delegatedego"
+
rm -rf /tmp/test-gnunet-gns-peer-1/
which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
TEST_IP="127.0.0.1"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-identity -C delegatedego -c test_gns_lookup.conf
-DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
+DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
+gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf
gnunet-arm -i gns -c test_gns_lookup.conf
# confirm that lookup currently works
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
# remove entry
-gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf
+gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf
# wait for old entry with 5s 'expiration' to definitively expire
sleep 6
# try again, should no longer work
-RES_IP_EXP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
-gnunet-identity -D delegatedego -c test_gns_lookup.conf
+RES_IP_EXP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
+gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_revocation.sh b/src/gns/test_gns_revocation.sh
index fdd3c76de..269b940d9 100755
--- a/src/gns/test_gns_revocation.sh
+++ b/src/gns/test_gns_revocation.sh
@@ -15,19 +15,21 @@ then
fi
rm -rf /tmp/test-gnunet-gns-peer-1/
-
+MY_EGO="myego"
+OTHER_EGO="delegatedego"
TEST_IP="127.0.0.1"
+
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C delegatedego -c test_gns_lookup.conf
-DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-revocation -R delegatedego -p -c test_gns_lookup.conf
-RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
+DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-revocation -R $OTHER_EGO -p -c test_gns_lookup.conf
+RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
+gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_soa_lookup.sh b/src/gns/test_gns_soa_lookup.sh
index bd8adcb63..2f9cc58de 100755
--- a/src/gns/test_gns_soa_lookup.sh
+++ b/src/gns/test_gns_soa_lookup.sh
@@ -16,7 +16,8 @@ fi
which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
rm -rf /tmp/test-gnunet-gns-peer-1/
-TEST_DOMAIN="homepage.gnu"
+MY_EGO="myego"
+TEST_DOMAIN="homepage.$MY_EGO"
# some public DNS resolver we can use
TEST_IP_GNS2DNS="184.172.157.218"
TEST_RECORD_NAME="homepage"
@@ -29,11 +30,11 @@ then
fi
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf
-RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf &> /dev/null
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf
+RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf &> /dev/null
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_txt_lookup.sh b/src/gns/test_gns_txt_lookup.sh
index dcf51112f..68a60c8b6 100755
--- a/src/gns/test_gns_txt_lookup.sh
+++ b/src/gns/test_gns_txt_lookup.sh
@@ -16,12 +16,14 @@ fi
rm -rf /tmp/test-gnunet-gns-peer-1/
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_TXT="GNS powered txt record data"
+MY_EGO="myego"
+LABEL="testtxt"
gnunet-arm -s -c test_gns_lookup.conf
-gnunet-identity -C testego -c test_gns_lookup.conf
-gnunet-namestore -p -z testego -a -n testtxt -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
-RES_TXT=`$DO_TIMEOUT gnunet-gns --raw -z testego -u testtxt.gnu -t TXT -c test_gns_lookup.conf`
-gnunet-namestore -z testego -d -n testtxt -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
-gnunet-identity -D testego -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
+RES_TXT=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t TXT -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf /tmp/test-gnunet-gns-peer-1/
diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh
index 6262c1eb2..312198780 100755
--- a/src/gns/test_gns_zkey_lookup.sh
+++ b/src/gns/test_gns_zkey_lookup.sh
@@ -23,7 +23,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego
gnunet-identity -C testego -c test_gns_lookup.conf
gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
-RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.${DELEGATED_PKEY}.zkey -t A -c test_gns_lookup.conf`
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.${DELEGATED_PKEY} -t A -c test_gns_lookup.conf`
gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 4c3bf6fa8..3c1ead437 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -241,7 +241,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey);
GNUNET_snprintf (ret,
sizeof (ret),
- "%s.zkey",
+ "%s",
pkeys);
GNUNET_free (pkeys);
return ret;
@@ -249,10 +249,10 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
/**
- * Convert an absolute domain name in the ".zkey" pTLD to the
+ * Convert an absolute domain name to the
* respective public key.
*
- * @param zkey string "X.zkey" where X is the coordinates of the public
+ * @param zkey string encoding the coordinates of the public
* key in an encoding suitable for DNS labels.
* @param pkey set to a public key on the eliptic curve
* @return #GNUNET_SYSERR if @a zkey has the wrong syntax
@@ -261,29 +261,12 @@ int
GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
{
- char *cpy;
- char *dot;
- const char *x;
-
- cpy = GNUNET_strdup (zkey);
- x = cpy;
- if (NULL == (dot = strchr (x, (int) '.')))
- goto error;
- *dot = '\0';
- if (0 != strcasecmp (dot + 1,
- "zkey"))
- goto error;
-
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (x,
- strlen (x),
- pkey))
- goto error;
- GNUNET_free (cpy);
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey,
+ strlen (zkey),
+ pkey))
+ return GNUNET_SYSERR;
return GNUNET_OK;
- error:
- GNUNET_free (cpy);
- return GNUNET_SYSERR;
}
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index ccc868c05..2ef946a82 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -50,6 +50,9 @@ extern "C"
/**
* String we use to indicate the local master zone or a
* root entry in the current zone.
+ *
+ * FIXME: probably should be changed to "@" and renamed
+ * (this name is confusing!)
*/
#define GNUNET_GNS_MASTERZONE_STR "+"
diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c
index f20d664a2..c08f2aef7 100644
--- a/src/namecache/gnunet-service-namecache.c
+++ b/src/namecache/gnunet-service-namecache.c
@@ -50,7 +50,7 @@ struct NamecacheClient
* The message queue to talk to @e client.
*/
struct GNUNET_MQ_Handle *mq;
-
+
};
@@ -208,7 +208,7 @@ handle_lookup_block (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received NAMECACHE_LOOKUP_BLOCK message\n");
-
+
lnc.request_id = ntohl (ln_msg->gns_header.r_id);
lnc.nc = nc;
if (GNUNET_SYSERR ==
@@ -306,7 +306,7 @@ handle_block_cache (void *cls,
* @param service the initialized service
*/
static void
-run (void *cls,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SERVICE_Handle *service)
{
@@ -319,8 +319,8 @@ run (void *cls,
/* Loading database plugin */
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
- "namecache",
- "database",
+ "namecache",
+ "database",
&database))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No database backend configured\n");
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c
index 66ab776e3..220c60305 100644
--- a/src/namecache/plugin_namecache_flat.c
+++ b/src/namecache/plugin_namecache_flat.c
@@ -86,8 +86,10 @@ database_setup (struct Plugin *plugin)
struct GNUNET_DISK_FileHandle *fh;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "namecache-flat",
- "FILENAME", &afsdir))
+ GNUNET_CONFIGURATION_get_value_filename (plugin->cfg,
+ "namecache-flat",
+ "FILENAME",
+ &afsdir))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"namecache-flat", "FILENAME");
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index dcb9dd678..4f512713b 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -403,7 +403,7 @@ display_record (void *cls,
{
if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
(0 != strcmp (rname,
- "+")) )
+ GNUNET_GNS_MASTERZONE_STR)) )
continue;
typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
@@ -1145,7 +1145,7 @@ main (int argc,
GNUNET_GETOPT_option_flag ('D',
"display",
gettext_noop ("display records"),
- &list),
+ &list),
GNUNET_GETOPT_option_string ('e',
"expiration",
@@ -1157,7 +1157,7 @@ main (int argc,
"nick",
"NICKNAME",
gettext_noop ("set the desired nick name for the zone"),
- &nickstring),
+ &nickstring),
GNUNET_GETOPT_option_flag ('m',
"monitor",
@@ -1210,7 +1210,7 @@ main (int argc,
"zone",
"EGO",
gettext_noop ("name of the ego controlling the zone"),
- &ego_name),
+ &ego_name),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index b27cfb732..dea13b982 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -105,7 +105,7 @@ struct NamestoreClient
* Message queue for transmission to @e client
*/
struct GNUNET_MQ_Handle *mq;
-
+
/**
* Head of the DLL of
* Zone iteration operations in progress initiated by this client
@@ -268,7 +268,7 @@ cleanup_task (void *cls)
}
GNUNET_NAMECACHE_disconnect (namecache);
namecache = NULL;
- GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name,
+ GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name,
GSN_database));
GNUNET_free (db_lib_name);
db_lib_name = NULL;
@@ -1011,7 +1011,8 @@ handle_record_store (void *cls,
struct GNUNET_GNSRECORD_Data rd_clean[rd_count];
unsigned int rd_clean_off;
- /* remove "NICK" records, unless this is for the "+" label */
+ /* remove "NICK" records, unless this is for the
+ #GNUNET_GNS_MASTERZONE_STR label */
rd_clean_off = 0;
for (unsigned int i=0;i<rd_count;i++)
{
@@ -1669,23 +1670,23 @@ GNUNET_SERVICE_MAIN
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME,
struct ZoneToNameMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (iteration_start,
+ GNUNET_MQ_hd_fixed_size (iteration_start,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START,
struct ZoneIterationStartMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (iteration_next,
+ GNUNET_MQ_hd_fixed_size (iteration_next,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT,
struct ZoneIterationNextMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (iteration_stop,
+ GNUNET_MQ_hd_fixed_size (iteration_stop,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP,
struct ZoneIterationStopMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (monitor_start,
+ GNUNET_MQ_hd_fixed_size (monitor_start,
GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START,
struct ZoneMonitorStartMessage,
NULL),
GNUNET_MQ_handler_end ());
-
+
/* end of gnunet-service-namestore.c */
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 05776801b..954af98d2 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_rest_plugin.h"
+#include "gnunet_gns_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_identity_service.h"
#include "gnunet_rest_lib.h"
@@ -458,7 +459,7 @@ namestore_list_response (void *cls,
for (i=0; i<rd_len; i++)
{
if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
- (0 != strcmp (rname, "+")) )
+ (0 != strcmp (rname, GNUNET_GNS_MASTERZONE_STR)) )
continue;
if ( (rd[i].record_type != handle->type) &&