r8579: recognise the name 'localhost' as 127.0.0.1. This solves a problem
authorAndrew Tridgell <tridge@samba.org>
Tue, 19 Jul 2005 05:09:36 +0000 (05:09 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:29:40 +0000 (13:29 -0500)
with some hosts that are missing localhost from /etc/hosts
(This used to be commit f9866258e099001390aa61dcc12055fe1374db60)

source4/lib/util.c

index 308d1b6f45ba085df77ddccee1821a23a22b3a3b..03ae86422fdc7d7e810c598df562385267e16cd2 100644 (file)
@@ -339,6 +339,11 @@ uint32_t interpret_addr(const char *str)
        if (strcmp(str,"255.255.255.255") == 0) {
                return 0xFFFFFFFF;
        }
+       /* recognise 'localhost' as a special name. This fixes problems with
+          some hosts that don't have localhost in /etc/hosts */
+       if (strcmp(str,"localhost") == 0) {
+               str = "127.0.0.1";
+       }
 
        /* if it's in the form of an IP address then get the lib to interpret it */
        if (is_ipaddress(str)) {