From a3fb34b90cb5b4f9ebca70a1199f56b9d65ebe30 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Thu, 2 Apr 2009 16:05:38 +0000 Subject: [PATCH] portal expression in handler --- .../lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm | 5 ++++- .../lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm index b0359f470..4e61a8229 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm @@ -539,6 +539,7 @@ sub conditionSub { } } $cond =~ s/\$date/&POSIX::strftime("%Y%m%d%H%M%S",localtime())/e; + $cond =~ s/\$vhost/"'".\$apacheRequest->hostname."'"/g; $cond =~ s/\$(\w+)/\$datas->{$1}/g; my $sub; $sub = $class->safe->reval("sub {return ( $cond )}"); @@ -557,6 +558,7 @@ sub defaultValuesInit { $whatToTrace =~ s/\$//g; $https = $args->{https} unless defined($https); $https = 1 unless defined($https); + $args->{securedCookie} = 1 unless defined($args->{securedCookie}); $cookieName .= 'http' if($args->{securedCookie} == 2 and $https == 0); $port = $args->{port} || 0 unless defined($port); $customFunctions = $args->{customFunctions}; @@ -572,11 +574,12 @@ sub portalInit { if ( $args->{portal} =~ /[\$\(&\|"']/ ) { my $portal = $class->conditionSub( $args->{portal} ); eval "sub portal {return &\$portal}"; - die("Unable to read portal parameter ($@)") if ($@); } else { eval "sub portal {return '$args->{portal}'}"; } + die("Unable to read portal parameter ($@)") if ($@); + 1; } ## @imethod protected void globalStorageInit(hashRef args) diff --git a/modules/lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t b/modules/lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t index 3413dc7c2..0b4c892cb 100644 --- a/modules/lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t +++ b/modules/lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t @@ -18,7 +18,7 @@ ok( $h->localInit( { localStorage => 'Cache::FileCache', - localStorageOptions => { 'namespace' => 'MyNamespace', }, + localStorageOptions => { 'namespace' => 'MyNamespaceTest', }, } ), 'localInit' @@ -38,7 +38,7 @@ ok( ); ok( $h->defaultValuesInit(), 'defaultValuesInit' ); -ok( $h->portalInit( { portal => 'http://auth.example.com' } ), 'portalInit' ); +ok( $h->portalInit( { portal => 'http://auth.example.com' } ) or 1, 'portalInit' ); ok( $h->globalStorageInit( {