Merge pull request #2959 from keszybz/stop-resolving-localdomain

*.localdomain != localhost
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-04-04 22:06:37 -04:00
commit 77384fb0ed
3 changed files with 13 additions and 11 deletions

View file

@ -70,9 +70,10 @@
is on the local loopback) and the IPv6 address ::1 (which is the
local host).</para></listitem>
<listitem><para>The hostname <literal>localhost</literal> (as well as any hostname ending in
<literal>.localhost</literal>, <literal>.localdomain</literal> or equal to <literal>localdomain</literal>) is
resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
<listitem><para>The hostnames <literal>localhost</literal> and
<literal>localhost.localdomain</literal> (as well as any hostname
ending in <literal>.localhost</literal> or <literal>.localhost.localdomain</literal>)
are resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
<listitem><para>The hostname <literal>gateway</literal> is
resolved to all current default routing gateway addresses,

View file

@ -87,9 +87,10 @@
is on the local loopback) and the IPv6 address ::1 (which is the
local host).</para></listitem>
<listitem><para>The hostname <literal>localhost</literal> (as well as any hostname ending in
<literal>.localhost</literal>, <literal>.localdomain</literal> or equal to <literal>localdomain</literal>) is
resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
<listitem><para>The hostnames <literal>localhost</literal> and
<literal>localhost.localdomain</literal> (as well as any hostname
ending in <literal>.localhost</literal> or <literal>.localhost.localdomain</literal>)
are resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
<listitem><para>The hostname <literal>gateway</literal> is
resolved to all current default routing gateway addresses,

View file

@ -178,16 +178,16 @@ bool is_localhost(const char *hostname) {
assert(hostname);
/* This tries to identify local host and domain names
* described in RFC6761 plus the redhatism of .localdomain */
* described in RFC6761 plus the redhatism of localdomain */
return strcaseeq(hostname, "localhost") ||
strcaseeq(hostname, "localhost.") ||
strcaseeq(hostname, "localdomain.") ||
strcaseeq(hostname, "localdomain") ||
strcaseeq(hostname, "localhost.localdomain") ||
strcaseeq(hostname, "localhost.localdomain.") ||
endswith_no_case(hostname, ".localhost") ||
endswith_no_case(hostname, ".localhost.") ||
endswith_no_case(hostname, ".localdomain") ||
endswith_no_case(hostname, ".localdomain.");
endswith_no_case(hostname, ".localhost.localdomain") ||
endswith_no_case(hostname, ".localhost.localdomain.");
}
bool is_gateway_hostname(const char *hostname) {