forked from extern/shorewall_code
Don't allow builtin targets as accounting or manual chain names
This commit is contained in:
parent
2a0a64710f
commit
e99d177d50
@ -1270,7 +1270,7 @@ sub ensure_accounting_chain( $$ )
|
|||||||
fatal_error "Non-accounting chain ($chain) used in an accounting rule" unless $chainref->{accounting};
|
fatal_error "Non-accounting chain ($chain) used in an accounting rule" unless $chainref->{accounting};
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Chain name ($chain) too long" if length $chain > 29;
|
fatal_error "Chain name ($chain) too long" if length $chain > 29;
|
||||||
fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/;
|
fatal_error "Invalid Chain name ($chain)" if $builtin_target{$chain} || ! $chain =~ /^[-\w]+$/;
|
||||||
$chainref = new_chain 'filter' , $chain;
|
$chainref = new_chain 'filter' , $chain;
|
||||||
$chainref->{accounting} = 1;
|
$chainref->{accounting} = 1;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
@ -1359,7 +1359,7 @@ sub new_nat_chain($) {
|
|||||||
sub new_manual_chain($) {
|
sub new_manual_chain($) {
|
||||||
my $chain = $_[0];
|
my $chain = $_[0];
|
||||||
fatal_error "Chain name ($chain) too long" if length $chain > 29;
|
fatal_error "Chain name ($chain) too long" if length $chain > 29;
|
||||||
fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/;
|
fatal_error "Invalid Chain name ($chain)" if $builtin_target{$chain} || ! $chain =~ /^[-\w]+$/;
|
||||||
fatal_error "Duplicate Chain Name ($chain)" if $targets{$chain} || $filter_table->{$chain};
|
fatal_error "Duplicate Chain Name ($chain)" if $targets{$chain} || $filter_table->{$chain};
|
||||||
$targets{$chain} = CHAIN;
|
$targets{$chain} = CHAIN;
|
||||||
( my $chainref = ensure_filter_chain( $chain, 0) )->{manual} = 1;
|
( my $chainref = ensure_filter_chain( $chain, 0) )->{manual} = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user