Rewrite handling of the USER/GROUP column

- Remove code that handled '+program' as that support was removed from
  the kernel in 2.6.14.
This commit is contained in:
Tom Eastep 2012-06-19 08:14:31 -07:00
parent da3e1b720c
commit 4d336ed8d6
2 changed files with 24 additions and 45 deletions

View File

@ -4206,45 +4206,38 @@ sub do_user( $ ) {
require_capability 'OWNER_MATCH', 'A non-empty USER column', 's'; require_capability 'OWNER_MATCH', 'A non-empty USER column', 's';
if ( $user =~ /^(!)?(.*)\+(.*)$/ ) { assert ( $user =~ /^(!)?(.*?)(:(.*))?$/ );
$rule .= "! --cmd-owner $2 " if supplied $2; my $invert = $1 ? '! ' : '';
$user = "!$1"; my $group = supplied $4 ? $4 : '';
} elsif ( $user =~ /^(.*)\+(.*)$/ ) {
$rule .= "--cmd-owner $2 " if supplied $2; if ( supplied $2 ) {
$user = $1; $user = $2;
if ( $user =~ /(\d+)(-(\d+))?$/ ) {
if ( supplied $2 ) {
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
}
} else {
$user = resolve_id( $user, 'user' );
}
$rule .= "${invert}--uid-owner $user ";
} }
if ( $user =~ /^(!)?(.*):(.*)$/ ) { if ( $group ne '' ) {
my $invert = $1 ? '! ' : ''; if ( $group =~ /^(\d+)(-(\d+))?$/ ) {
my $group = defined $3 ? $3 : ''; if ( supplied $2 ) {
fatal_error "Invalid Group Range ($group)" unless $3 >= $1;
if ( supplied $2 ) { }
$user = $2; } else {
$user = resolve_id( $user, 'user' ) unless $user =~ /\d+(-\d+)?$/; $group = resolve_id( $group, 'group' );
$rule .= "${invert}--uid-owner $user ";
} }
if ( $group ne '' ) { $rule .= "${invert}--gid-owner $group ";
$group = resolve_id( $group, 'group' ) unless $group =~ /^\d+(-\d+)?$/;
$rule .= "${invert}--gid-owner $group ";
}
} elsif ( $user =~ /^(!)?(.*)$/ ) {
my $invert = $1 ? '! ' : '';
$user = $2;
fatal_error "Invalid USER/GROUP (!)" if $user eq '';
$user = resolve_id ($user, 'user' ) unless $user =~ /\d+(-\d+)?$/;
$rule .= "${invert}--uid-owner $user ";
} else {
$user = resolve_id( $user, 'user' ) unless $user =~ /\d+(-\d+)?$/;
$rule .= "--uid-owner $user ";
} }
$rule; $rule;
} }
# #
# Create a "-m tos" match for the passed TOS # Create a "-m tos" match for the passed TOS
# #

View File

@ -1084,8 +1084,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis <term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>]</term>
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
<listitem> <listitem>
<para>This optional column may only be non-empty if the SOURCE is <para>This optional column may only be non-empty if the SOURCE is
@ -1124,19 +1123,6 @@
group</para> group</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>+upnpd</term>
<listitem>
<para>program named upnpd</para>
<important>
<para>The ability to specify a program name was removed from
Netfilter in kernel version 2.6.14.</para>
</important>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</listitem> </listitem>
</varlistentry> </varlistentry>