summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-28 17:48:05 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-28 17:48:05 +0100
commit40672b99c7da7efd317fc31612504fe7d5ab0b65 (patch)
tree0e68dcd25d63441be2028877385ce880bb0c6c65 /src/shared/util.c
parent477e75ef9ea6bb2e7e8cc76278c442942110f227 (diff)
util: add comment explaining hostname_is_valid()
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 891182a35b..11cab6dcf1 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4248,6 +4248,11 @@ bool hostname_is_valid(const char *s) {
if (isempty(s))
return false;
+ /* Doesn't accept empty hostnames, hostnames with trailing or
+ * leading dots, and hostnames with multiple dots in a
+ * sequence. Also ensures that the length stays below
+ * HOST_NAME_MAX. */
+
for (p = s, dot = true; *p; p++) {
if (*p == '.') {
if (dot)