|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
From 414c46af13efbb4b0eeb0c7d429e1941742f120e Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
From: Thomas Blume <Thomas.Blume@suse.com>
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Date: Mon, 29 Feb 2016 10:19:01 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Subject: [PATCH] shorten hostname before checking for trailing dot
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Shortening can lead to a hostname that has a trailing dot.
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Therefore it should be done before checking from trailing dots.
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
(cherry picked from commit 46e1a2278116e2f5067c35127ccbd8589335f734)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
src/basic/hostname-util.c | 4 ++--
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
index 7bb23448ed..123cee3125 100644
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
--- a/src/basic/hostname-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+++ b/src/basic/hostname-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
@@ -122,6 +122,8 @@ char* hostname_cleanup(char *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
assert(s);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+ strshorten(s, HOST_NAME_MAX);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
for (p = s, d = s, dot = true; *p; p++) {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
if (*p == '.') {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
if (dot)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
@@ -141,8 +143,6 @@ char* hostname_cleanup(char *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
else
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
*d = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
- strshorten(s, HOST_NAME_MAX);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return s;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|