Commit 2f2249ea authored by Xavier Guimard's avatar Xavier Guimard

Backport #LEMONLDAP-992 in 1.4 branch

git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/branches/lemonldap-ng_version_1_4-bugfixes@4989 1dbb9719-a921-0410-b57f-c3a383c2c641
parent 9915cecc
......@@ -71,7 +71,7 @@ use Digest::MD5;
#inherits Apache::Session
#link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage
our $VERSION = '1.4.7';
our $VERSION = '1.4.8';
use base qw(Lemonldap::NG::Common::CGI Exporter);
our @ISA;
......@@ -483,7 +483,7 @@ sub new {
# @param ignoreError set to 1 if error should not appear in logs
# @return boolean
sub loadModule {
my ( $self, $module, $ignoreError ) = splice @_;
my ( $self, $module, $ignoreError ) = @_;
return 1 unless $module;
......@@ -528,7 +528,7 @@ sub getConf {
# @param base64 Encode value in base64
# @return nothing
sub setHiddenFormValue {
my ( $self, $key, $val, $prefix, $base64 ) = splice @_;
my ( $self, $key, $val, $prefix, $base64 ) = @_;
# Default values
$prefix = "lmhidden_" unless defined $prefix;
......@@ -549,7 +549,7 @@ sub setHiddenFormValue {
# @param base64 Decode value from base64
# @return string The associated value
sub getHiddenFormValue {
my ( $self, $key, $prefix, $base64 ) = splice @_;
my ( $self, $key, $prefix, $base64 ) = @_;
# Default values
$prefix = "lmhidden_" unless defined $prefix;
......@@ -573,7 +573,7 @@ sub getHiddenFormValue {
# @param keys Array reference of keys
# @return nothing
sub clearHiddenFormValue {
my ( $self, $keys ) = splice @_;
my ( $self, $keys ) = @_;
unless ( defined $keys ) {
delete $self->{portalHiddenFormValues};
......@@ -637,7 +637,7 @@ sub initCaptcha {
# @param captcha code generated by Authen::Captcha
# @return a constant
sub checkCaptcha {
my ( $self, $code, $ccode ) = splice @_;
my ( $self, $code, $ccode ) = @_;
# Get captcha object
my $captcha = Lemonldap::NG::Common::Captcha->new(
......@@ -667,7 +667,7 @@ sub checkCaptcha {
# @param captcha code generated by Authen::Captcha
# @return a constant
sub removeCaptcha {
my ( $self, $ccode ) = splice @_;
my ( $self, $ccode ) = @_;
# Get captcha object
my $captcha = Lemonldap::NG::Common::Captcha->new(
......@@ -696,7 +696,7 @@ sub removeCaptcha {
# @param value Parameter value
# @return 1 if url can be trusted, 0 else
sub isTrustedUrl {
my ( $self, $url ) = splice @_;
my ( $self, $url ) = @_;
return
$url =~ m#^https?://$self->{reVHosts}(:\d+)?/#o
|| $self->{trustedDomains} eq "*"
......@@ -710,7 +710,7 @@ sub isTrustedUrl {
# @param value Parameter value
# @return 1 if attack detected, 0 else
sub checkXSSAttack {
my ( $self, $name, $value ) = splice @_;
my ( $self, $name, $value ) = @_;
# Empty values are not bad
return 0 unless $value;
......@@ -889,7 +889,7 @@ sub getApacheSession {
# @param id session reference
# return Lemonldap::NG::Common::Session object
sub getPersistentSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $persistentSession = Lemonldap::NG::Common::Session->new(
{
......@@ -915,7 +915,7 @@ sub getPersistentSession {
# @param $s String to hash
# @return hashed value
sub _md5hash {
my ( $self, $s ) = splice @_;
my ( $self, $s ) = @_;
return substr( Digest::MD5::md5_hex($s), 0, 32 );
}
......@@ -928,7 +928,7 @@ sub _md5hash {
# @param id optional SSO session ID
# @return nothing
sub updatePersistentSession {
my ( $self, $infos, $uid, $id ) = splice @_;
my ( $self, $infos, $uid, $id ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
......@@ -963,7 +963,7 @@ sub updatePersistentSession {
# @param id Session ID
# @return nothing
sub updateSession {
my ( $self, $infos, $id ) = splice @_;
my ( $self, $infos, $id ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
......@@ -1010,7 +1010,7 @@ sub updateSession {
# @param value Value to add
# @param id optional Session identifier
sub addSessionValue {
my ( $self, $key, $value, $id ) = splice @_;
my ( $self, $key, $value, $id ) = @_;
# Mandatory parameters
return () unless defined $key;
......@@ -1048,7 +1048,7 @@ sub addSessionValue {
# @param value the complete value
# @return first value
sub getFirstValue {
my ( $self, $value ) = splice @_;
my ( $self, $value ) = @_;
my @values = split /\Q$self->{multiValuesSeparator}\E/, $value;
......@@ -1125,7 +1125,7 @@ sub get_user {
# @param type auth/user/password/issuer
# @return module name
sub get_module {
my ( $self, $type ) = splice @_;
my ( $self, $type ) = @_;
if ( $type =~ /auth/i ) {
if ( defined $self->{_multi}->{stack}->[0] ) {
......@@ -1346,7 +1346,7 @@ sub stamp {
# @param $sec number of seconds
# @return a formated time
sub convertSec {
my ( $self, $sec ) = splice @_;
my ( $self, $sec ) = @_;
my ( $day, $hrs, $min ) = ( 0, 0, 0 );
# Calculate the minutes
......@@ -1375,7 +1375,7 @@ sub convertSec {
# Return skin name
# @return skin name
sub getSkin {
my ($self) = splice @_;
my ($self) = @_;
my $skin = $self->{portalSkin};
......@@ -1994,6 +1994,8 @@ sub setSessionInfo {
#@return Lemonldap::NG::Portal constant
sub setMacros {
my $self = shift;
$self->{sessionInfo}->{groups} = '';
$self->{sessionInfo}->{hGroups} = {};
foreach ( sort keys %{ $self->{macros} } ) {
$self->{sessionInfo}->{$_} =
$self->safe->reval( $self->{macros}->{$_} );
......
......@@ -13,14 +13,14 @@ package Lemonldap::NG::Portal::_Multi;
use Lemonldap::NG::Portal::Simple;
use Scalar::Util 'weaken';
our $VERSION = '1.4.6';
our $VERSION = '1.4.8';
## @cmethod Lemonldap::NG::Portal::_Multi new(Lemonldap::NG::Portal::Simple portal)
# Constructor
# @param $portal Lemonldap::NG::Portal::Simple object
# @return new Lemonldap::NG::Portal::_Multi object
sub new {
my ( $class, $portal ) = splice @_;
my ( $class, $portal ) = @_;
my $self = bless { p => $portal, res => PE_NOSCHEME }, $class;
weaken $self->{p};
......@@ -65,7 +65,7 @@ sub new {
# @param type 0 for authentication, 1 for userDB
# @return Lemonldap::NG::Portal error code returned by method $sub
sub try {
my ( $self, $sub, $type ) = splice @_;
my ( $self, $sub, $type ) = @_;
my $res;
my $s = $self->{stack}->[$type]->[0]->{m} . "::$sub";
my $old = $self->{stack}->[$type]->[0]->{n};
......@@ -110,7 +110,7 @@ sub try {
# @param type 0 for authentication, 1 for userDB
# return true if an other module is available
sub next {
my ( $self, $type ) = splice @_;
my ( $self, $type ) = @_;
if ( $self->{stack}->[$type]->[0]->{n} eq
$self->{stack}->[ 1 - $type ]->[0]->{n}
......@@ -135,13 +135,14 @@ sub next {
# @param $sub name of the method who has failed
# @return Lemonldap::NG::Portal error code
sub replay {
my ( $self, $sub ) = splice @_;
my ( $self, $sub ) = @_;
my @subs = ();
$self->{p}->lmLog( "Replay all methods until sub $sub", 'debug' );
foreach (
qw(authInit extractFormInfo userDBInit getUser setAuthSessionInfo
setSessionInfo setGroups authenticate authFinish)
setSessionInfo setMacros setGroups setPersistentSessionInfo
setLocalGroups authenticate authFinish)
)
{
push @subs, $_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment