projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
477e75e
)
util: add comment explaining hostname_is_valid()
author
Lennart Poettering
<lennart@poettering.net>
Wed, 28 Jan 2015 16:48:05 +0000
(17:48 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 28 Jan 2015 16:48:05 +0000
(17:48 +0100)
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index
891182a
..
11cab6d
100644
(file)
--- 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)