ifcfg-rh: don't reverse lookup on 'localhost' unless NM_IGNORE_HOSTNAME_LOCALHOST=yes (rh #490184)
This commit is contained in:
@@ -479,6 +479,7 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
|
|||||||
{
|
{
|
||||||
shvarFile *network;
|
shvarFile *network;
|
||||||
char *hostname;
|
char *hostname;
|
||||||
|
gboolean ignore_localhost;
|
||||||
|
|
||||||
network = svNewFile (SC_NETWORK_FILE);
|
network = svNewFile (SC_NETWORK_FILE);
|
||||||
if (!network) {
|
if (!network) {
|
||||||
@@ -487,16 +488,18 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
||||||
svCloseFile (network);
|
ignore_localhost = svTrueValue (network, "NM_IGNORE_HOSTNAME_LOCALHOST", FALSE);
|
||||||
|
if (ignore_localhost) {
|
||||||
/* Ignore a hostname of 'localhost' or 'localhost.localdomain' to preserve
|
/* Ignore a hostname of 'localhost' or 'localhost.localdomain' to preserve
|
||||||
* 'network' service behavior.
|
* 'network' service behavior.
|
||||||
*/
|
*/
|
||||||
if (hostname && (!strcmp (hostname, "localhost") || !strcmp (hostname, "localhost.localdomain"))) {
|
if (hostname && (!strcmp (hostname, "localhost") || !strcmp (hostname, "localhost.localdomain"))) {
|
||||||
g_free (hostname);
|
g_free (hostname);
|
||||||
hostname = NULL;
|
hostname = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svCloseFile (network);
|
||||||
return hostname;
|
return hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user