gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (bebdf68c0 -> 70b9b7a38)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (bebdf68c0 -> 70b9b7a38)
Date: Thu, 25 Oct 2018 10:58:12 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from bebdf68c0 Remove unnecessary (and perilous) function pointer cast.
     new 8e50a17e7 allow any zone if request was for NULL
     new f7c6752d8 uk.gnunet.org was taken down, use another DNS name
     new 9b52c9179 add possibility of hijacking any (sub)domain, not just TLDs, 
via configuration file [gns] section
     new 70b9b7a38 clarify license of test scripts

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/gns/Makefile.am                                |  1 +
 src/gns/gns_tld_api.c                              | 94 ++++++++++++----------
 src/gns/test_gns_at_lookup.sh                      |  1 +
 src/gns/test_gns_cname_lookup.sh                   |  1 +
 ...ns_ipv6_lookup.sh => test_gns_config_lookup.sh} | 27 ++++---
 src/gns/test_gns_delegated_lookup.sh               |  1 +
 src/gns/test_gns_dht_lookup.sh                     |  1 +
 src/gns/test_gns_gns2dns_cname_lookup.sh           |  1 +
 src/gns/test_gns_gns2dns_lookup.sh                 |  8 +-
 src/gns/test_gns_ipv6_lookup.sh                    |  1 +
 src/gns/test_gns_lookup.sh                         |  1 +
 src/gns/test_gns_mx_lookup.sh                      |  1 +
 src/gns/test_gns_quickupdate.sh                    |  1 +
 src/gns/test_gns_rel_expiration.sh                 |  1 +
 src/gns/test_gns_revocation.sh                     |  1 +
 src/gns/test_gns_soa_lookup.sh                     |  1 +
 src/gns/test_gns_txt_lookup.sh                     |  1 +
 src/gns/test_gns_zkey_lookup.sh                    |  1 +
 src/gns/test_gnunet_gns.sh                         |  2 +-
 src/namestore/namestore_api_monitor.c              | 10 ++-
 20 files changed, 97 insertions(+), 59 deletions(-)
 copy src/gns/{test_gns_ipv6_lookup.sh => test_gns_config_lookup.sh} (51%)

diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 2659f7e6a..e0497b11e 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -235,6 +235,7 @@ libgnunet_plugin_block_gns_la_LDFLAGS = \
 
 check_SCRIPTS = \
   test_gns_lookup.sh \
+  test_gns_config_lookup.sh \
   test_gns_ipv6_lookup.sh\
   test_gns_txt_lookup.sh\
   test_gns_mx_lookup.sh \
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index 825b51d06..55ee30bd9 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -92,7 +92,7 @@ struct GNUNET_GNS_LookupWithTldRequest
  * @return the part of @a name after the last ".",
  *         or @a name if @a name does not contain a "."
  */
-static char *
+static const char *
 get_tld (const char *name)
 {
   const char *tld;
@@ -103,28 +103,31 @@ get_tld (const char *name)
     tld = name;
   else
     tld++; /* skip the '.' */
-  return GNUNET_strdup (tld);
+  return tld;
 }
 
 
 /**
- * Eat the TLD of the given @a name.
+ * Eat the "TLD" (last bit) of the given @a name.
  *
  * @param[in,out] name a name
+ * @param tld what to eat (can be more than just the tld)
  */
 static void
-eat_tld (char *name)
+eat_tld (char *name,
+        const char *tld)
 {
-  char *tld;
-
   GNUNET_assert (0 < strlen (name));
-  tld = strrchr (name,
-                 (unsigned char) '.');
   if (NULL == tld)
+  {
     strcpy (name,
             GNUNET_GNS_EMPTY_LABEL_AT);
+  }
   else
-    *tld = '\0';
+  {
+    GNUNET_assert (strlen (tld) < strlen (name));
+    name[strlen(name) - strlen(tld) - 1] = '\0';
+  }
 }
 
 
@@ -227,7 +230,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
                            void *proc_cls)
 {
   struct GNUNET_GNS_LookupWithTldRequest *ltr;
-  char *tld;
+  const char *tld;
   char *dot_tld;
   char *zonestr;
   struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
@@ -246,51 +249,59 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
                                                   strlen (tld),
                                                   &pkey))
   {
-    eat_tld (ltr->name);
+    eat_tld (ltr->name,
+            tld);
     lookup_with_public_key (ltr,
                            &pkey);
-    GNUNET_free (tld);
     return ltr;
   }
 
-  /* second case: TLD is mapped in our configuration file */
-  GNUNET_asprintf (&dot_tld,
-                   ".%s",
-                   tld);
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string (handle->cfg,
-                                             "gns",
-                                             dot_tld,
-                                             &zonestr))
+  /* second case: domain is mapped in our configuration file */
+  for (const char *domain = name;
+       NULL != domain;
+       domain = strchr (domain,
+                       (unsigned char) '.'))
   {
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr,
-                                                    strlen (zonestr),
-                                                    &pkey))
+    if ('.' == domain[0])
+      domain++;
+    GNUNET_asprintf (&dot_tld,
+                    ".%s",
+                    domain);
+    if (GNUNET_OK ==
+       GNUNET_CONFIGURATION_get_value_string (handle->cfg,
+                                              "gns",
+                                              dot_tld,
+                                              &zonestr))
     {
-      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                                 "gns",
-                                 dot_tld,
-                                 _("Expected a base32-encoded public zone 
key\n"));
+      if (GNUNET_OK !=
+         GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr,
+                                                     strlen (zonestr),
+                                                     &pkey))
+      {
+       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_free (ltr->name);
+       GNUNET_free (ltr);
+       return NULL;
+      }
+      eat_tld (ltr->name,
+              &dot_tld[1]);
       GNUNET_free (zonestr);
       GNUNET_free (dot_tld);
-      GNUNET_free (ltr->name);
-      GNUNET_free (ltr);
-      GNUNET_free (tld);
-      return NULL;
+      lookup_with_public_key (ltr,
+                             &pkey);
+      return ltr;
     }
     GNUNET_free (dot_tld);
-    GNUNET_free (zonestr);
-    eat_tld (ltr->name);
-    lookup_with_public_key (ltr,
-                           &pkey);
-    GNUNET_free (tld);
-    return ltr;
   }
-  GNUNET_free (dot_tld);
 
   /* Final case: TLD matches one of our egos */
-  eat_tld (ltr->name);
+  eat_tld (ltr->name,
+          tld);
 
   /* if the name is of the form 'label' (and not 'label.SUBDOMAIN'), never go 
to the DHT */
   if (NULL == strchr (ltr->name,
@@ -302,7 +313,6 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
                                           tld,
                                           &identity_zone_cb,
                                           ltr);
-  GNUNET_free (tld);
   if (NULL == ltr->id_op)
   {
     GNUNET_free (ltr->name);
diff --git a/src/gns/test_gns_at_lookup.sh b/src/gns/test_gns_at_lookup.sh
index 8c1d2a088..d900c070b 100755
--- a/src/gns/test_gns_at_lookup.sh
+++ b/src/gns/test_gns_at_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_cname_lookup.sh b/src/gns/test_gns_cname_lookup.sh
index 00ccd265b..f6b7a842d 100755
--- a/src/gns/test_gns_cname_lookup.sh
+++ b/src/gns/test_gns_cname_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_config_lookup.sh
similarity index 51%
copy from src/gns/test_gns_ipv6_lookup.sh
copy to src/gns/test_gns_config_lookup.sh
index 301e6ae0c..35d7c32d9 100755
--- a/src/gns/test_gns_ipv6_lookup.sh
+++ b/src/gns/test_gns_config_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
@@ -15,16 +16,24 @@ 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"
+CFG=`mktemp  --tmpdir=$PWD`
+cp test_gns_lookup.conf $CFG || exit 77
+which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
 TEST_IP="dead::beef"
-gnunet-arm -s -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 `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
+gnunet-arm -s -c $CFG || exit 77
+gnunet-identity -C $MY_EGO -c $CFG 
+EPUB=`gnunet-identity -d -c $CFG | grep $MY_EGO | awk '{print $3}'`
+gnunet-arm -e -c $CFG
+gnunet-config -c $CFG -s "gns" -o ".google.com" -V $EPUB
+gnunet-arm -s -c $CFG
+sleep 1
+gnunet-namestore -p -z $MY_EGO -a -n www -t AAAA -V $TEST_IP -e never -c $CFG
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.google.com -t AAAA -c $CFG`
+gnunet-namestore -z $MY_EGO -d -n www -t AAAA -V $TEST_IP -e never -c $CFG
+gnunet-identity -D $MY_EGO -c $CFG
+gnunet-arm -e -c $CFG
+rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME`
+rm $CFG
 
 if [ "$RES_IP" == "$TEST_IP" ]
 then
diff --git a/src/gns/test_gns_delegated_lookup.sh 
b/src/gns/test_gns_delegated_lookup.sh
index 3374f1b3b..21774ad8d 100755
--- a/src/gns/test_gns_delegated_lookup.sh
+++ b/src/gns/test_gns_delegated_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
 
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh
index 64af868a5..07e559752 100755
--- a/src/gns/test_gns_dht_lookup.sh
+++ b/src/gns/test_gns_dht_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
 
diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh 
b/src/gns/test_gns_gns2dns_cname_lookup.sh
index 32e730d4c..84ad8549f 100755
--- a/src/gns/test_gns_gns2dns_cname_lookup.sh
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_gns2dns_lookup.sh 
b/src/gns/test_gns_gns2dns_lookup.sh
index ad5d762eb..122e45525 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -14,8 +14,8 @@ then
 fi
 
 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
-# IP address of 'uk.gnunet.org'
-TEST_IP_ALT2="81.187.252.184"
+# IP address of 'docs.gnunet.org'
+TEST_IP_ALT2="131.159.74.67"
 # IP address of 'www.gnunet.org'
 TEST_IP="131.159.74.67"
 # IPv6 address of 'gnunet.org'
@@ -42,7 +42,7 @@ 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"
+TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO"
 
 
 gnunet-arm -s -c test_gns_lookup.conf
@@ -64,7 +64,7 @@ RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c 
test_gns_lookup.con
 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 -u $TEST_DOMAIN_ALT -t A -c 
test_gns_lookup.conf`
-# lookup 'uk.gnunet.org', IPv4
+# lookup 'docs.gnunet.org', IPv4
 RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT2 -t A -c 
test_gns_lookup.conf`
 
 # clean up
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_ipv6_lookup.sh
index 301e6ae0c..72da5ee2c 100755
--- a/src/gns/test_gns_ipv6_lookup.sh
+++ b/src/gns/test_gns_ipv6_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_lookup.sh b/src/gns/test_gns_lookup.sh
index 79558afae..2dffa1251 100755
--- a/src/gns/test_gns_lookup.sh
+++ b/src/gns/test_gns_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_mx_lookup.sh b/src/gns/test_gns_mx_lookup.sh
index 5a7ef21c3..3a360494b 100755
--- a/src/gns/test_gns_mx_lookup.sh
+++ b/src/gns/test_gns_mx_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_quickupdate.sh b/src/gns/test_gns_quickupdate.sh
index e0eb33f2e..d9807fe22 100755
--- a/src/gns/test_gns_quickupdate.sh
+++ b/src/gns/test_gns_quickupdate.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_rel_expiration.sh 
b/src/gns/test_gns_rel_expiration.sh
index a266a7484..66adbb631 100755
--- a/src/gns/test_gns_rel_expiration.sh
+++ b/src/gns/test_gns_rel_expiration.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_revocation.sh b/src/gns/test_gns_revocation.sh
index 12f0c0881..08a0f8ac1 100755
--- a/src/gns/test_gns_revocation.sh
+++ b/src/gns/test_gns_revocation.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
 
diff --git a/src/gns/test_gns_soa_lookup.sh b/src/gns/test_gns_soa_lookup.sh
index 82a5885c3..6a09ac8c7 100755
--- a/src/gns/test_gns_soa_lookup.sh
+++ b/src/gns/test_gns_soa_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_txt_lookup.sh b/src/gns/test_gns_txt_lookup.sh
index ce9b9e806..6c6b4b3f6 100755
--- a/src/gns/test_gns_txt_lookup.sh
+++ b/src/gns/test_gns_txt_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 
 LOCATION=$(which gnunet-config)
diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh
index 5e67e0ce2..b36a16fa2 100755
--- a/src/gns/test_gns_zkey_lookup.sh
+++ b/src/gns/test_gns_zkey_lookup.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+# This file is in the public domain.
 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
 which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
 
diff --git a/src/gns/test_gnunet_gns.sh b/src/gns/test_gnunet_gns.sh
index 749d80b84..f6b4e721a 100755
--- a/src/gns/test_gnunet_gns.sh
+++ b/src/gns/test_gnunet_gns.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-
+# This file is in the public domain.
 LOCATION=$(which gnunet-config)
 if [ -z $LOCATION ]
 then
diff --git a/src/namestore/namestore_api_monitor.c 
b/src/namestore/namestore_api_monitor.c
index 2c4c4559d..457da0b90 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -129,6 +129,7 @@ static int
 check_result (void *cls,
               const struct RecordResultMessage *lrm)
 {
+  static struct GNUNET_CRYPTO_EcdsaPrivateKey zero;
   struct GNUNET_NAMESTORE_ZoneMonitor *zm = cls;
   size_t lrm_len;
   size_t exp_lrm_len;
@@ -139,9 +140,12 @@ check_result (void *cls,
   const char *rd_ser_tmp;
 
   (void) cls;
-  if (0 != memcmp (&lrm->private_key,
-                  &zm->zone,
-                  sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
+  if ( (0 != memcmp (&lrm->private_key,
+                    &zm->zone,
+                    sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) &&
+       (0 != memcmp (&zero,
+                    &zm->zone,
+                    sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) )
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]