mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Always read hostname from config files
This commit is contained in:
@@ -48,3 +48,4 @@ When changing the hostname on Debian or Ubuntu, update /etc/mailname too.
|
||||
Fixed editing of bonding network interfaces on Debian Linux.
|
||||
---- Changes since 1.480 ----
|
||||
Fixed network interface management on SuSE 10.2.
|
||||
Updated the Hostname and DNS Client page to always show the hostname from config files, rather than the system's short hostname.
|
||||
|
||||
@@ -350,6 +350,11 @@ return &check_ipaddress_any($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/hostname");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -452,6 +452,10 @@ else {
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local %rc = &get_rc_conf();
|
||||
if ($rc{'hostname'}) {
|
||||
return $rc{'hostname'};
|
||||
}
|
||||
return &get_system_hostname();
|
||||
}
|
||||
|
||||
|
||||
@@ -261,6 +261,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local %host;
|
||||
&read_env_file("/etc/conf.d/hostname", \%host);
|
||||
if ($host{'HOSTNAME'}) {
|
||||
return $host{'HOSTNAME'};
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,6 +370,10 @@ return undef;
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hc = &read_hostconfig();
|
||||
if ($hc->{'HOSTNAME'}) {
|
||||
return $hc->{'HOSTNAME'};
|
||||
}
|
||||
return &get_system_hostname();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,11 @@ return &check_ipaddress($_[0]);
|
||||
|
||||
sub get_hostname
|
||||
{
|
||||
local %conf;
|
||||
&read_env_file($network_config, \%conf);
|
||||
if ($conf{'HOSTNAME'}) {
|
||||
return $conf{'HOSTNAME'};
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -389,9 +389,14 @@ sub parse_order
|
||||
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
return &get_system_hostname();
|
||||
}
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/myname");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname();
|
||||
}
|
||||
|
||||
# save_hostname(name)
|
||||
sub save_hostname
|
||||
|
||||
@@ -205,6 +205,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local %conf;
|
||||
&read_env_file($network_config, \%conf);
|
||||
if ($conf{'HOSTNAME'}) {
|
||||
return $conf{'HOSTNAME'};
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/HOSTNAME");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/HOSTNAME");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -296,6 +296,11 @@ else {
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/nodename");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname();
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/HOSTNAME");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -237,6 +237,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local $hn = &read_file_contents("/etc/HOSTNAME");
|
||||
$hn =~ s/\r|\n//g;
|
||||
if ($hn) {
|
||||
return $hn;
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,11 @@ return &check_ipaddress($_[0]);
|
||||
# get_hostname()
|
||||
sub get_hostname
|
||||
{
|
||||
local %conf;
|
||||
&read_env_file($network_config, \%conf);
|
||||
if ($conf{'HOSTNAME'}) {
|
||||
return $conf{'HOSTNAME'};
|
||||
}
|
||||
return &get_system_hostname(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user