mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-25 12:13:29 +02:00
Improve USER/GROUP validation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
5c176c64b7
commit
6ddaa0190e
@ -4189,7 +4189,7 @@ sub resolve_id( $$ ) {
|
|||||||
require_capability 'OWNER_NAME_MATCH', "Specifying a $type name", 's';
|
require_capability 'OWNER_NAME_MATCH', "Specifying a $type name", 's';
|
||||||
} else {
|
} else {
|
||||||
my $num = $type eq 'user' ? getpwnam( $id ) : getgrnam( $id );
|
my $num = $type eq 'user' ? getpwnam( $id ) : getgrnam( $id );
|
||||||
fatal_error "Unknown $type ($id)" unless supplied $num;
|
fatal_error "Unknown $type ($id)" unless supplied $num && $num >= 0;
|
||||||
$id = $num;
|
$id = $num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4214,7 +4214,7 @@ sub do_user( $ ) {
|
|||||||
|
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
$user = $2;
|
$user = $2;
|
||||||
if ( $user =~ /(\d+)(-(\d+))?$/ ) {
|
if ( $user =~ /^(\d+)(-(\d+))?$/ ) {
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user