gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (21eec1db5 -> 98288a7b2)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (21eec1db5 -> 98288a7b2)
Date: Mon, 12 Nov 2018 21:25:13 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from 21eec1db5 trying to fix #5472
     new 5db18738e fix resolver bugs and warnings
     new 98288a7b2 add logic to skip tests if DNS or /etc/hosts does not like us

The 2 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/test_gns_gns2dns_cname_lookup.sh |  9 ++++++++-
 src/gns/test_gns_gns2dns_lookup.sh       | 10 +++++++++-
 src/util/gnunet-service-resolver.c       | 18 ++++++++++++------
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh 
b/src/gns/test_gns_gns2dns_cname_lookup.sh
index 84ad8549f..17196f820 100755
--- a/src/gns/test_gns_gns2dns_cname_lookup.sh
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -43,7 +43,15 @@ MY_EGO="myego"
 # various names we will use for resolution
 TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
 
+which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
+
+
 gnunet-arm -s -c test_gns_lookup.conf
+
+echo $OUT | grep $TEST_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv4 for gnunet.org not found, skipping test"; 
exit 77; }
+echo $OUT | grep $TEST6_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv6 for gnunet.org not found, skipping test"; 
exit 77; }
+
+
 gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
 
 # set IP address for DNS resolver for resolving in gnunet.org domain
@@ -52,7 +60,6 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t 
GNS2DNS -V $TEST_RECOR
 gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf
 gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf
 
-which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
 
 echo "EGOs:"
 gnunet-identity -d
diff --git a/src/gns/test_gns_gns2dns_lookup.sh 
b/src/gns/test_gns_gns2dns_lookup.sh
index 122e45525..431f01086 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -44,8 +44,17 @@ TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
 TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO"
 TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO"
 
+which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
+
 
 gnunet-arm -s -c test_gns_lookup.conf
+
+OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org`
+echo $OUT | grep $TEST_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv4 for gnunet.org not found, skipping test"; 
exit 77; }
+echo $OUT | grep $TEST6_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv6 for gnunet.org not found, skipping test"; 
exit 77; }
+
+
+
 gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
 
 # set IP address for DNS resolver for resolving in gnunet.org domain
@@ -53,7 +62,6 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RESOLVER_LABEL -t 
A -V $TEST_IP_GNS2D
 # 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
diff --git a/src/util/gnunet-service-resolver.c 
b/src/util/gnunet-service-resolver.c
index d907bd8d9..3b871ce33 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -364,7 +364,7 @@ lookup_dns_servers (char ***server_addrs)
     GNUNET_DISK_file_close (fh);
     return -1;
   }
-  if (bytes_read > SIZE_MAX)
+  if ((size_t) bytes_read > SIZE_MAX)
   { 
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "/etc/resolv.conf file too large to mmap. "
@@ -379,7 +379,7 @@ lookup_dns_servers (char ***server_addrs)
   *server_addrs = NULL;
   read_offset = 0;
   num_dns_servers = 0;
-  while (read_offset < bytes_read)
+  while (read_offset < (size_t) bytes_read)
   {
     const char *newline;
     size_t line_len;
@@ -648,11 +648,16 @@ try_cache (const char *hostname,
   struct ResolveCache *pos;
   struct ResolveCache *next;
   int found;
+  int in_hosts;
 
+  in_hosts = GNUNET_NO;
   for (pos = hosts_head; NULL != pos; pos = pos->next)
     if (0 == strcmp (pos->hostname,
                      hostname))
+    {
+      in_hosts = GNUNET_YES;
       break;
+    }
   if (NULL == pos)
   {
     next = cache_head;
@@ -673,7 +678,8 @@ try_cache (const char *hostname,
                 hostname);
     return GNUNET_NO;
   }
-  if (cache_head != pos)
+  if ( (GNUNET_NO == in_hosts) &&
+       (cache_head != pos) )
   {
     /* move result to head to achieve LRU for cache eviction */
     GNUNET_CONTAINER_DLL_remove (cache_head,
@@ -1313,7 +1319,7 @@ extract_hosts (const char *line,
   if (NULL != c)
     line_len = c - line;
   /* ignore leading whitespace */
-  while ( (0 > line_len) &&
+  while ( (0 < line_len) &&
          isspace ((unsigned char) *line) )
   {
     line++;
@@ -1382,7 +1388,7 @@ load_etc_hosts (void)
     GNUNET_DISK_file_close (fh);
     return;
   }
-  if (bytes_read > SIZE_MAX)
+  if ((size_t) bytes_read > SIZE_MAX)
   { 
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "/etc/hosts file too large to mmap. "
@@ -1395,7 +1401,7 @@ load_etc_hosts (void)
                              GNUNET_DISK_MAP_TYPE_READ,
                              (size_t) bytes_read);
   read_offset = 0;
-  while (read_offset < bytes_read)
+  while (read_offset < (size_t) bytes_read)
   {
     const char *newline;
     size_t line_len;

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



reply via email to

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