INN commit: branches/2.6/lib (getfqdn.c)

INN Commit rra at isc.org
Sat Feb 3 20:52:30 UTC 2018


    Date: Saturday, February 3, 2018 @ 12:52:30
  Author: eagle
Revision: 10235

Handle hostnames not in DNS in GetFQDN

If the local hostname isn't in DNS at all, GetFQDN currently returns
NULL.  If a domain was provided but the hostname isn't in DNS, append
the domain to the hostname anyway and return the results.  This is 
possibly still a local configuration error, but it seems like 
friendlier behavior, and also lets the test suite run on hosts with
an unresolvable local hostname.

Modified:
  branches/2.6/lib/getfqdn.c

-----------+
 getfqdn.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Modified: getfqdn.c
===================================================================
--- getfqdn.c	2018-02-03 20:52:20 UTC (rev 10234)
+++ getfqdn.c	2018-02-03 20:52:30 UTC (rev 10235)
@@ -35,9 +35,13 @@
     if (strchr(buff, '.') != NULL)
 	return buff;
 
-    /* See if DNS (or /etc/hosts) gives us a full domain name. */
+    /*
+    ** See if DNS (or /etc/hosts) gives us a full domain name.  If the host
+    ** doesn't exist in DNS at all but we were given a domain name, use the
+    ** fallback of appending that domain to the hostname.
+    */
     if ((hp = gethostbyname(buff)) == NULL)
-	return NULL;
+	goto fallback;
 #if	0
     /* This code is a "feature" that allows multiple domains (NIS or
      * DNS, I'm not sure) to work with a single INN server.  However,
@@ -80,6 +84,7 @@
 	    }
 
     /* Give up:  Get the domain config param and append it. */
+fallback:
     if ((p = domain) == NULL || *p == '\0')
 	return NULL;
     if (strlen(buff) + 1 + strlen(p) > sizeof buff - 1)



More information about the inn-committers mailing list