summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-15 16:04:46 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-15 16:04:46 +0200
commita0627f82e23491a08106b7329dbbe006c9b579aa (patch)
tree8b366f695e962c8655b6e3406f82db8e3cd00a2a /src/shared
parent486d1a81489da2341454ede4624342aad8334443 (diff)
util: make is_localhost() check for 'localdomain' too, so that we can use it for both validating domains and host names
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 0db4bd90e8..d6cea4d208 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -6868,11 +6868,13 @@ char *tempfn_random(const char *p) {
bool is_localhost(const char *hostname) {
assert(hostname);
- /* This tries to identify local hostnames described in RFC6761
- * plus the redhatism of .localdomain */
+ /* 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") ||
@@ -6929,4 +6931,4 @@ int is_symlink(const char *path) {
return 1;
return 0;
-} \ No newline at end of file
+}