Fix IPv6 format for regex

This commit is contained in:
Ilia Rostovtsev
2021-11-28 18:53:19 +03:00
parent 11ec33ae5e
commit a76d529a5c
2 changed files with 3 additions and 3 deletions

View File

@ -24,9 +24,9 @@ if ($in{'delete'}) {
&error($text{'save_eservice'}) if ($in{'service_except_custom'} && $in{'service_except_custom'} !~ /^[\w\d\s\-\/\.,]+$/);
&error($text{'save_ehost'})
if ($in{'host_text_def'} == 0 && $in{'host_text'} !~ /^[\w\d\s\-\/\@\.,]+$/ && $in{'host_text'} !~ /^\[[:\d]+\]/);
if ($in{'host_text_def'} == 0 && $in{'host_text'} !~ /^[\w\d\s\-\/\@\.,]+$/ && $in{'host_text'} !~ /^\[[:\da-f]+\]/);
&error($text{'save_ehost'})
if ($in{'host_except'} && $in{'host_except'} !~ /^[\w\d\s\-\/\@\.,]+$/ && $in{'host_except'} !~ /^\[[:\d]+\]/);
if ($in{'host_except'} && $in{'host_except'} !~ /^[\w\d\s\-\/\@\.,]+$/ && $in{'host_except'} !~ /^\[[:\da-f]+\]/);
for (my $i = 0; $i <= $in{'cmd_count'}; $i++) {
&error($text{'save_ecmd'}) if ($in{'cmd_'.$i} && $in{'cmd_'.$i} !~ /^[\w\d\s\-\/\@\%\|\(\)\'\"\&\.,]+$/);

View File

@ -44,7 +44,7 @@ sub list_rules {
my $ipv6_enc;
# Match ipv6 with or without range
if ($line =~ /(?|(\[[:\d]+\]\/\d+)|(\[[:\d]+\]))/) {
if ($line =~ /(?|(\[[:\da-f]+\]\/\d+)|(\[[:\da-f]+\]))/) {
$ipv6 = $1;
$ipv6_enc = &encode_base64($ipv6);
$line =~ s/\Q$ipv6\E/$ipv6_enc/;