Parse conf (#1988)

This commit is contained in:
Christophe Maudoux 2019-10-27 17:17:58 +01:00
parent 85b9095f7e
commit 836add81c0
2 changed files with 6 additions and 3 deletions

View File

@ -195,12 +195,14 @@ sub virtualHosts {
type => 'keyText', type => 'keyText',
}; };
# If rule contains a comment, split it # If rule contains a comment or an AuthLevel, split them
if ( $query eq 'locationRules' ) { if ( $query eq 'locationRules' ) {
$res->{comment} = ''; $res->{comment} = '';
$res->{level} = '';
if ( $r =~ s/\(\?#(.*?)\)// ) { if ( $r =~ s/\(\?#(.*?)\)// ) {
$res->{title} = $res->{comment} = $1; $res->{title} = $res->{comment} = $1;
} }
$res->{level} = $1 if ( $r =~ s/\(\?#AuthnLevel=(-?\d+)\)// );
$res->{re} = $r; $res->{re} = $r;
$res->{type} = 'rule'; $res->{type} = 'rule';
} }

View File

@ -264,8 +264,9 @@ sub _scanNodes {
hdebug(' locationRules'); hdebug(' locationRules');
my $k = my $k =
$leaf->{comment} $leaf->{comment}
? "(?#$leaf->{comment}&AuthnLevel=$leaf->{level})$leaf->{re}" ? "(?#$leaf->{comment})$leaf->{re}"
: "(?#&AuthnLevel=$leaf->{level})$leaf->{re}"; : $leaf->{re};
$k .= "(?#AuthnLevel=$leaf->{level})" if $leaf->{level};
$self->set( $target, $key, $k, $leaf->{data} ); $self->set( $target, $key, $k, $leaf->{data} );
} }
else { else {