* Mon Nov 03 2025 Brian Read <brianr@koozali.org> 11.0.0-125.sme
- Arrange that Macaddress, InternalIP and comment cleared out when host entry switched to self [SME: 13207]
This commit is contained in:
@@ -116,15 +116,38 @@ sub do_update {
|
|||||||
$ndb = esmith::NetworksDB::UTF8->open || die "Couldn't open networks db";
|
$ndb = esmith::NetworksDB::UTF8->open || die "Couldn't open networks db";
|
||||||
my $notif = '';
|
my $notif = '';
|
||||||
my $result = '';
|
my $result = '';
|
||||||
$hos_datas{'name'} = lc $c->param('Name');
|
# Fetch parameters with forced scalar context and default empty string if undefined
|
||||||
$hos_datas{'domain'} = lc $c->param('Domain');
|
$hos_datas{'name'} = lc(scalar $c->param('Name') // '');
|
||||||
$hos_datas{'hostname'} = $c->param('Hostname');
|
$hos_datas{'domain'} = lc(scalar $c->param('Domain') // '');
|
||||||
$hos_datas{'comment'} = $c->param('Comment');
|
$hos_datas{'hostname'} = scalar $c->param('Hostname') // '';
|
||||||
$hos_datas{'hosttype'} = $c->param('Hosttype');
|
$hos_datas{'comment'} = scalar $c->param('Comment') // '';
|
||||||
$hos_datas{'internalip'} = $c->param('Internalip');
|
$hos_datas{'hosttype'} = scalar $c->param('Hosttype') // '';
|
||||||
$hos_datas{'macaddress'} = $c->param('Macaddress');
|
$hos_datas{'internalip'} = scalar $c->param('Internalip') // '';
|
||||||
$hos_datas{'externalip'} = $c->param('Externalip');
|
$hos_datas{'externalip'} = scalar $c->param('Externalip') // '';
|
||||||
my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}";
|
|
||||||
|
my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}";
|
||||||
|
|
||||||
|
|
||||||
|
if (my $hostrec = $hdb->get($hostname)) {
|
||||||
|
my $hosttype = $hostrec->prop('HostType') // '';
|
||||||
|
#$c->app->log->info("$hosttype $hos_datas{'hosttype'} $hos_datas{'comment'} $hostrec->prop('Comment')");
|
||||||
|
# Clear comment if hosttype changes to 'self' and comment was not intentionally changed
|
||||||
|
if ($hosttype ne 'Self'
|
||||||
|
&& $hos_datas{'hosttype'} eq 'Self'
|
||||||
|
&& $hos_datas{'comment'} eq $hostrec->prop('Comment')) {
|
||||||
|
$hos_datas{'comment'} = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clear MAC address if hosttype is 'self', otherwise get from param
|
||||||
|
if ($hos_datas{'hosttype'} eq 'Self') {
|
||||||
|
$hos_datas{'macaddress'} = '';
|
||||||
|
$hos_datas{'internalip'} = '';
|
||||||
|
#$c->app->log->info("yes $hos_datas{'hosttype'} $hos_datas{'macaddress'}");
|
||||||
|
} else {
|
||||||
|
$hos_datas{'macaddress'} = scalar $c->param('Macaddress') // '';
|
||||||
|
#$c->app->log->info("no $hos_datas{'hosttype'} $hos_datas{'macaddress'}");
|
||||||
|
}
|
||||||
|
|
||||||
if ($trt eq 'ADD') {
|
if ($trt eq 'ADD') {
|
||||||
$hos_datas{'hostname'} = $hostname;
|
$hos_datas{'hostname'} = $hostname;
|
||||||
@@ -521,4 +544,4 @@ sub must_be_local {
|
|||||||
# Not OK. The IP is not on any of our local networks.
|
# Not OK. The IP is not on any of our local networks.
|
||||||
return $c->l('hos_ERR_IP_NOT_LOCAL');
|
return $c->l('hos_ERR_IP_NOT_LOCAL');
|
||||||
} ## end sub must_be_local
|
} ## end sub must_be_local
|
||||||
1;
|
1;
|
||||||
@@ -2,7 +2,7 @@ Summary: Sme Server Configuration : Manager 2
|
|||||||
%define name smeserver-manager
|
%define name smeserver-manager
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
%define version 11.0.0
|
%define version 11.0.0
|
||||||
%define release 124
|
%define release 125
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
Release: %{release}%{?dist}
|
Release: %{release}%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
@@ -147,6 +147,9 @@ true
|
|||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 03 2025 Brian Read <brianr@koozali.org> 11.0.0-125.sme
|
||||||
|
- Arrange that Macaddress, InternalIP and comment cleared out when host entry switched to self [SME: 13207]
|
||||||
|
|
||||||
* Fri Oct 24 2025 Brian Read <brianr@koozali.org> 11.0.0-124.sme
|
* Fri Oct 24 2025 Brian Read <brianr@koozali.org> 11.0.0-124.sme
|
||||||
- Adjust CSS for logout button to remove overlap of border and rounding [SME: 13247]
|
- Adjust CSS for logout button to remove overlap of border and rounding [SME: 13247]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user