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
This commit is contained in:
Jiří Klimeš
2014-06-30 13:59:49 +02:00
parent 70e930bc0e
commit bf1231d02a

View File

@@ -388,11 +388,12 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6)
/* Try a persistent hostname first */ /* Try a persistent hostname first */
g_object_get (G_OBJECT (priv->manager), NM_MANAGER_HOSTNAME, &configured_hostname, NULL); 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"); _set_hostname (policy, configured_hostname, "from system configuration");
g_free (configured_hostname); g_free (configured_hostname);
return; return;
} }
g_free (configured_hostname);
/* Try automatically determined hostname from the best device's IP config */ /* Try automatically determined hostname from the best device's IP config */
if (!best4) if (!best4)