case insensitive comparison in vhost
Hi,
Since vhost are case insensitive, and in the config, vhost name ar case sensitive, comparison and rules initialisation should be lowercase.
This diff resolve this issue:
--- /usr/share/perl5/Lemonldap/NG/Handler/Vhost.pm.org 2013-04-19 10:17:04.000000000 +0200 +++ /usr/share/perl5/Lemonldap/NG/Handler/Vhost.pm 2013-08-07 18:32:30.248729609 +0200 @@ -57,30 +57,31 @@ sub locationRulesInit { my ( $class, $args ) = splice @_; foreach my $vhost ( keys %{ $args->{locationRules} } ) {
-
$locationCount->{$vhost} = 0;
-
my $lvhost=lc($vhost);
-
$locationCount->{$lvhost} = 0; foreach ( sort keys %{ $args->{locationRules}->{$vhost} } ) { if ( $_ eq 'default' ) {
-
( $defaultCondition->{$vhost}, $defaultProtection->{$vhost} ) =
-
( $defaultCondition->{$lvhost}, $defaultProtection->{$lvhost} ) = $class->conditionSub( $args->{locationRules}->{$vhost}->{$_} ); } else { (
-
$locationCondition->{$vhost}->[ $locationCount->{$vhost} ],
-
$locationProtection->{$vhost}->[ $locationCount->{$vhost} ]
-
$locationCondition->{$lvhost}->[ $locationCount->{$lvhost} ],
-
$locationProtection->{$lvhost}->[ $locationCount->{$lvhost} ] ) = $class->conditionSub( $args->{locationRules}->{$vhost}->{$_} );
-
$locationRegexp->{$vhost}->[ $locationCount->{$vhost} ] =
-
$locationRegexp->{$lvhost}->[ $locationCount->{$lvhost} ] = qr/$_/;
-
$locationCount->{$vhost}++;
-
$locationCount->{$lvhost}++; } } # Default police
-
( $defaultCondition->{$vhost}, $defaultProtection->{$vhost} ) =
-
( $defaultCondition->{$lvhost}, $defaultProtection->{$lvhost} ) = $class->conditionSub('accept')
-
unless ( $defaultCondition->{$vhost} );
-
unless ( $defaultCondition->{$lvhost} );
@return True if the user is granted to access to the current URL
sub grant { my ( $class, $uri ) = splice @_;
- my $vhost = $apacheRequest->hostname;
- my
vhost = lc(
apacheRequest->hostname); for ( my $i = 0 ; $i < $locationCount->{$vhost} ; $i++ ) { if ( $uri =~ $locationRegexp->{$vhost}->[$i] ) { return &{ $locationCondition->{$vhost}->[i] }(
datas);
Best,
-- Florian