From bf1231d02a25930cb93706c311e777a61daf479c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Mon, 30 Jun 2014 13:59:49 +0200 Subject: [PATCH] policy: don't use default hostname as configured hostname (rh #1110436) Even if administrator-configured hostname (/etc/hostname) takes precedence over other hostname configurations, we don't take "localhost", "localhost6", "localhost.localdomain", "localhost6.localdomain6" as such. These values might be set by some tools (like installer). But that's not right and we compensate for that. It doesn't make much sense that an admimistrator would set these values manually (intentionally), because leaving /etc/hostname empty will result in "localhost" hostname anyway (set by systemd). https://bugzilla.redhat.com/show_bug.cgi?id=1110436 --- src/nm-policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index 18a018450..36cc5b7c4 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -388,11 +388,12 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6) /* Try a persistent hostname first */ g_object_get (G_OBJECT (priv->manager), NM_MANAGER_HOSTNAME, &configured_hostname, NULL); - if (configured_hostname) { + if (configured_hostname && nm_utils_is_specific_hostname (configured_hostname)) { _set_hostname (policy, configured_hostname, "from system configuration"); g_free (configured_hostname); return; } + g_free (configured_hostname); /* Try automatically determined hostname from the best device's IP config */ if (!best4)