ovpnmain.cgi: Validate CCDNet name when renaming it.

Fixes #12282

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Stefan Schantl
2020-01-28 11:51:50 +01:00
committed by Arne Fitzenreiter
parent 5c1c9938eb
commit 7ad653cc09

View File

@@ -490,6 +490,13 @@ sub modccdnet
my $oldname=$_[1];
my %ccdconfhash=();
my %ccdhash=();
# Check if the new name is valid.
if(!&General::validhostname($newname)) {
$errormessage=$Lang::tr{'ccd err invalidname'};
return;
}
&General::readhasharray("${General::swroot}/ovpn/ccd.conf", \%ccdconfhash);
foreach my $key (keys %ccdconfhash) {
if ($ccdconfhash{$key}[0] eq $oldname) {