Disallow '.' in accounting and manual chain names

This commit is contained in:
Tom Eastep 2011-02-01 12:58:05 -08:00
parent 3dd674a738
commit 207db033b8
3 changed files with 6 additions and 4 deletions

View File

@ -1262,7 +1262,7 @@ sub ensure_accounting_chain( $$ )
fatal_error "Non-accounting chain ($chain) used in an accounting rule" unless $chainref->{accounting};
} else {
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)" unless $chain =~ /^[-\w]+$/;
$chainref = new_chain 'filter' , $chain;
$chainref->{accounting} = 1;
$chainref->{referenced} = 1;
@ -1351,7 +1351,7 @@ sub new_nat_chain($) {
sub new_manual_chain($) {
my $chain = $_[0];
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)" unless $chain =~ /^[-\w]+$/;
fatal_error "Duplicate Chain Name ($chain)" if $targets{$chain} || $filter_table->{$chain};
$targets{$chain} = CHAIN;
( my $chainref = ensure_filter_chain( $chain, 0) )->{manual} = 1;

View File

@ -74,7 +74,8 @@
role="bold">:COUNT</emphasis> is included, a counting rule
matching this entry will be added to
<emphasis>chain</emphasis>. The <emphasis>chain</emphasis> may
not exceed 29 characters in length.</para>
not exceed 29 characters in length and may be composed of
letters, digits, dash ('-') and underscore ('_').</para>
</listitem>
</varlistentry>

View File

@ -74,7 +74,8 @@
role="bold">:COUNT</emphasis> is included, a counting rule
matching this entry will be added to
<emphasis>chain</emphasis>. The <emphasis>chain</emphasis> may
not exceed 29 characters in length.</para>
not exceed 29 characters in length and may be composed of
letters, digits, dash ('-') and underscore ('_').</para>
</listitem>
</varlistentry>