gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: resolve www.gnu.org instead


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: resolve www.gnu.org instead of hostname to avoid complications of hostname as per #5578
Date: Sun, 24 Feb 2019 08:29:09 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 35df06d31 resolve www.gnu.org instead of hostname to avoid 
complications of hostname as per #5578
35df06d31 is described below

commit 35df06d312116e8695a038429a6e3c2fceb41fba
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Feb 24 08:29:02 2019 +0100

    resolve www.gnu.org instead of hostname to avoid complications of hostname 
as per #5578
---
 src/arm/test_gnunet_service_arm.c | 44 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/src/arm/test_gnunet_service_arm.c 
b/src/arm/test_gnunet_service_arm.c
index 700e7ca19..55903c499 100644
--- a/src/arm/test_gnunet_service_arm.c
+++ b/src/arm/test_gnunet_service_arm.c
@@ -47,6 +47,8 @@ static int asked_for_a_list;
 
 static struct GNUNET_ARM_Handle *arm;
 
+static const char hostname[] = "www.gnu.org"; /* any domain should do */
+
 
 static void
 trigger_disconnect (void *cls)
@@ -114,7 +116,7 @@ hostname_resolve_cb (void *cls,
   if (NULL == addr)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to resolve our own hostname!\n");
+                "Failed to resolve hostname!\n");
     GNUNET_break (0);
     ret = 3;
     GNUNET_ARM_request_service_stop (arm,
@@ -144,13 +146,14 @@ arm_start_cb (void *cls,
   GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK);
   GNUNET_break (result == GNUNET_ARM_RESULT_STARTING);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Trying to resolve our own hostname!\n");
+              "Trying to resolve a hostname via the resolver service!\n");
   /* connect to the resolver service */
   if (NULL ==
-      GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC,
-                                        TIMEOUT,
-                                        &hostname_resolve_cb,
-                                        NULL))
+      GNUNET_RESOLVER_ip_get (hostname,
+                             AF_UNSPEC,
+                             TIMEOUT,
+                             &hostname_resolve_cb,
+                             NULL))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unable initiate connection to resolver service\n");
@@ -193,30 +196,7 @@ main (int argc, char *av[])
   static struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
   };
-  char hostname[GNUNET_OS_get_hostname_max_length () + 1];
 
-  if (0 != gethostname (hostname, sizeof (hostname) - 1))
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                         "gethostname");
-    FPRINTF (stderr,
-             "%s",
-             "Failed to determine my own hostname, testcase not run.\n");
-    return 77;
-  }
-  if ( (0 == strcmp (hostname,
-                    "localhost")) ||
-       (0 == strcmp (hostname,
-                    "ipv6-localnet")) )
-  {
-    /* we cannot use 'localhost' as this would not trigger the
-       resolver service (see resolver_api.c); so in this case,
-       we fall back to (ab)using gnu.org. */
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-               "Falling back to `www.gnu.org'\n");
-    strcpy (hostname,
-           "www.gnu.org");
-  }
   /* trigger DNS lookup */
 #if HAVE_GETADDRINFO
   {
@@ -226,7 +206,7 @@ main (int argc, char *av[])
     if (0 != (ret = getaddrinfo (hostname, NULL, NULL, &ai)))
     {
       FPRINTF (stderr,
-               "Failed to resolve my hostname `%s', testcase not run.\n",
+               "Failed to resolve `%s', testcase not run.\n",
                hostname);
       return 77;
     }
@@ -242,7 +222,7 @@ main (int argc, char *av[])
     if (NULL == host)
       {
         FPRINTF (stderr,
-                 "Failed to resolve my hostname `%s', testcase not run.\n",
+                 "Failed to resolve `%s', testcase not run.\n",
                  hostname);
         return 77;
       }
@@ -255,7 +235,7 @@ main (int argc, char *av[])
     if (NULL == host)
       {
         FPRINTF (stderr,
-                 "Failed to resolve my hostname `%s', testcase not run.\n",
+                 "Failed to resolve `%s', testcase not run.\n",
                  hostname);
         return 77;
       }

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



reply via email to

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