tidying
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 21 Apr 2020 22:21:24 +0000 (23:21 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 21 Apr 2020 23:32:39 +0000 (00:32 +0100)
src/src/host.c
test/stderr/0388
test/stderr/0398
test/stderr/0432
test/stderr/2202

index 1426bff9752de73b51c92a63dbcece9a1b054396..456365c8f3c13e15a3a34e31c449564b76395155 100644 (file)
@@ -182,19 +182,18 @@ dns_scan dnss;
 
 DEBUG(D_host_lookup)
   debug_printf("using host_fake_gethostbyname for %s (%s)\n", name,
-    (af == AF_INET)? "IPv4" : "IPv6");
+    af == AF_INET ? "IPv4" : "IPv6");
 
 /* Handle unqualified "localhost" */
 
 if (Ustrcmp(name, "localhost") == 0)
-  lname = (af == AF_INET)? US"127.0.0.1" : US"::1";
+  lname = af == AF_INET ? US"127.0.0.1" : US"::1";
 
 /* Handle a literal IP address */
 
 if ((ipa = string_is_ip_address(lname, NULL)) != 0)
-  {
-  if ((ipa == 4 && af == AF_INET) ||
-      (ipa == 6 && af == AF_INET6))
+  if (   ipa == 4 && af == AF_INET
+     ||  ipa == 6 && af == AF_INET6)
     {
     int x[4];
     yield = store_get(sizeof(struct hostent), FALSE);
@@ -224,13 +223,12 @@ if ((ipa = string_is_ip_address(lname, NULL)) != 0)
     *error_num = HOST_NOT_FOUND;
     return NULL;
     }
-  }
 
 /* Handle a host name */
 
 else
   {
-  int type = (af == AF_INET)? T_A:T_AAAA;
+  int type = af == AF_INET ? T_A:T_AAAA;
   int rc = dns_lookup_timerwrap(dnsa, lname, type, NULL);
   int count = 0;
 
@@ -2035,7 +2033,7 @@ for (int i = 1; i <= times;
       && (time_msec = get_time_in_ms() - time_msec) > slow_lookup_log)
     log_long_lookup(US"gethostbyname", host->name, time_msec);
 
-  if (hostdata == NULL)
+  if (!hostdata)
     {
     uschar *error;
     switch (error_num)
@@ -2044,18 +2042,19 @@ for (int i = 1; i <= times;
       case TRY_AGAIN:      error = US"TRY_AGAIN"; break;
       case NO_RECOVERY:    error = US"NO_RECOVERY"; break;
       case NO_DATA:        error = US"NO_DATA"; break;
-      #if NO_DATA != NO_ADDRESS
+    #if NO_DATA != NO_ADDRESS
       case NO_ADDRESS:     error = US"NO_ADDRESS"; break;
-      #endif
+    #endif
       default: error = US"?"; break;
       }
 
     DEBUG(D_host_lookup) debug_printf("%s returned %d (%s)\n",
+      f.running_in_test_harness ? "host_fake_gethostbyname" :
       #if HAVE_IPV6
         #if HAVE_GETIPNODEBYNAME
-        (af == AF_INET6)? "getipnodebyname(af=inet6)" : "getipnodebyname(af=inet)",
+        af == AF_INET6 ? "getipnodebyname(af=inet6)" : "getipnodebyname(af=inet)",
         #else
-        (af == AF_INET6)? "gethostbyname2(af=inet6)" : "gethostbyname2(af=inet)",
+        af == AF_INET6 ? "gethostbyname2(af=inet6)" : "gethostbyname2(af=inet)",
         #endif
       #else
       "gethostbyname",
index aba5a1158f357929f5bf6c893229c1b41d902f00..4c833bea6f5adaa786552ce3cc7c3d253230f5d7 100644 (file)
@@ -38,6 +38,7 @@ expanded list of hosts = '127.0.0.1 : V4NET.0.0.0' options = ''
 set transport smtp
 finding IP address for 127.0.0.1
 calling host_find_byname
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 fully qualified name = 127.0.0.1
@@ -47,6 +48,7 @@ get[host|ipnode]byname[2] looked up these IP addresses:
 remote host address is the local host: y: configured to try delivery anyway
 finding IP address for V4NET.0.0.0
 calling host_find_byname
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for V4NET.0.0.0 (IPv4)
 fully qualified name = V4NET.0.0.0
 MUNGED: ::1 will be omitted in what follows
index 4756ab0539c6fecc4f74c1eb43d3374f6fc61955..24b04f402316fcd120718686a70028f5edefea23 100644 (file)
@@ -52,6 +52,7 @@ expanded list of hosts = '127.0.0.1' options = ''
 set transport t2
 finding IP address for 127.0.0.1
 calling host_find_byname
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 fully qualified name = 127.0.0.1
@@ -100,6 +101,7 @@ original list of hosts = '127.0.0.1' options = ''
 expanded list of hosts = '127.0.0.1' options = ''
 finding IP address for 127.0.0.1
 calling host_find_byname
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 fully qualified name = 127.0.0.1
@@ -214,6 +216,7 @@ original list of hosts = '127.0.0.1' options = ''
 expanded list of hosts = '127.0.0.1' options = ''
 finding IP address for 127.0.0.1
 calling host_find_byname
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 fully qualified name = 127.0.0.1
index 0e6a1d952b5844038bb4c17530fe2faebbbb6f69..b01205611244b822ab2afe4e9a7e80820ec37a0f 100644 (file)
@@ -72,6 +72,7 @@ domain = y
 routed by r1 router
   envelope to: x@y
   transport: t1
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 MUNGED: ::1 will be omitted in what follows
@@ -182,6 +183,7 @@ domain = y
 routed by r1 router
   envelope to: x@y
   transport: t1
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 using host_fake_gethostbyname for 127.0.0.1 (IPv4)
 local host found for non-MX address
 MUNGED: ::1 will be omitted in what follows
index a20ef0331056b547e0c356903056307d34f9961d..3752ec538179c9417ca2a23240a3e0dbe75261c3 100644 (file)
@@ -66,7 +66,7 @@ cioce.test.again.dns in dns_again_means_nonexist? yes (matched "*")
 cioce.test.again.dns is in dns_again_means_nonexist: returning DNS_NOMATCH
 DNS: no SOA record found for neg-TTL
  writing neg-cache entry for cioce.test.again.dns-A-xxxx, ttl -1
-get[host|ipnode]byname[2] returned 1 (HOST_NOT_FOUND)
+host_fake_gethostbyname returned 1 (HOST_NOT_FOUND)
 no IP address found for host cioce.test.again.dns (during SMTP connection from the.local.host.name [ip4.ip4.ip4.ip4])
 LOG: host_lookup_failed MAIN
   no IP address found for host cioce.test.again.dns (during SMTP connection from the.local.host.name [ip4.ip4.ip4.ip4])