summaryrefslogtreecommitdiff
path: root/src/basic/hostname-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-27 22:37:52 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-08-05 20:49:21 -0400
commit90365b043ab6a0d8100e0c37dea4ca9d6fdb4695 (patch)
treeb96bba6c42dbd17f6062fdb1c8d9b1a3378079cc /src/basic/hostname-util.c
parentae691c1d9382995ea7e28317f5c37023229c27ee (diff)
hostname-util: ignore case when checking if hostname is localhost
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r--src/basic/hostname-util.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index 95d9c3dd83..d901a5e82b 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -141,14 +141,14 @@ bool is_localhost(const char *hostname) {
/* This tries to identify local host and domain names
* described in RFC6761 plus the redhatism of .localdomain */
- return streq(hostname, "localhost") ||
- streq(hostname, "localhost.") ||
- streq(hostname, "localdomain.") ||
- streq(hostname, "localdomain") ||
- endswith(hostname, ".localhost") ||
- endswith(hostname, ".localhost.") ||
- endswith(hostname, ".localdomain") ||
- endswith(hostname, ".localdomain.");
+ return strcaseeq(hostname, "localhost") ||
+ strcaseeq(hostname, "localhost.") ||
+ strcaseeq(hostname, "localdomain.") ||
+ strcaseeq(hostname, "localdomain") ||
+ endswith_no_case(hostname, ".localhost") ||
+ endswith_no_case(hostname, ".localhost.") ||
+ endswith_no_case(hostname, ".localdomain") ||
+ endswith_no_case(hostname, ".localdomain.");
}
int sethostname_idempotent(const char *s) {