Commit 2af54acd authored by Clément OUDOT's avatar Clément OUDOT

Do not call data on undefined session object (#762)

parent 17855de7
......@@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_SAML; #inherits
use Lemonldap::NG::Common::Conf::SAML::Metadata;
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
our @ISA = qw(Lemonldap::NG::Portal::_SAML);
## @apmethod int authInit()
......@@ -579,7 +579,7 @@ sub extractFormInfo {
# Get Lasso::Session dump
# This value is erased if a next session match the SLO request
if ( $ssoSession->data
if ( $ssoSession
&& $ssoSession->data->{_lassoSessionDump} )
{
$self->lmLog(
......
......@@ -10,7 +10,7 @@ use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_CAS;
use base qw(Lemonldap::NG::Portal::_CAS Lemonldap::NG::Portal::_LibAccess);
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
## @method void issuerDBInit()
# Nothing to do
......@@ -129,7 +129,7 @@ sub issuerForUnAuthUser {
my $casServiceSession = $self->getCasSession($ticket);
unless ( $casServiceSession->data ) {
unless ($casServiceSession) {
$self->lmLog( "Service ticket session $ticket not found", 'error' );
$self->returnCasValidateError();
}
......@@ -168,7 +168,7 @@ sub issuerForUnAuthUser {
my $localSession =
$self->getApacheSession( $casServiceSession->data->{_cas_id}, 1 );
unless ( $localSession->data ) {
unless ($localSession) {
$self->lmLog(
"Local session "
. $casServiceSession->data->{_cas_id}
......@@ -246,7 +246,7 @@ sub issuerForUnAuthUser {
my $casServiceSession = $self->getCasSession($ticket);
unless ( $casServiceSession->data ) {
unless ($casServiceSession) {
$self->lmLog( "$urlType ticket session $ticket not found",
'error' );
$self->returnCasServiceValidateError( 'INVALID_TICKET',
......@@ -375,7 +375,7 @@ sub issuerForUnAuthUser {
my $localSession =
$self->getApacheSession( $casServiceSession->data->{_cas_id}, 1 );
unless ( $localSession->data ) {
unless ($localSession) {
$self->lmLog(
"Local session "
. $casServiceSession->data->{_cas_id}
......@@ -432,7 +432,7 @@ sub issuerForUnAuthUser {
my $casProxyGrantingSession = $self->getCasSession($pgt);
unless ( $casProxyGrantingSession->data ) {
unless ($casProxyGrantingSession) {
$self->lmLog( "Proxy granting ticket session $pgt not found",
'error' );
$self->returnCasProxyError( 'BAD_PGT', 'Ticket not found' );
......@@ -446,7 +446,7 @@ sub issuerForUnAuthUser {
my $casProxySession = $self->getCasSession();
unless ( $casProxySession->data ) {
unless ($casProxySession) {
$self->lmLog( "Unable to create CAS proxy session", 'error' );
$self->returnCasProxyError( 'INTERNAL_ERROR',
'Error in proxy session management' );
......@@ -596,7 +596,7 @@ sub issuerForAuthUser {
my $casServiceSession = $self->getCasSession();
unless ( $casServiceSession->data ) {
unless ($casServiceSession) {
$self->lmLog( "Unable to create CAS session", 'error' );
return PE_ERROR;
}
......
......@@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_SAML;
our @ISA = qw(Lemonldap::NG::Portal::_SAML);
our $VERSION = '1.4.1';
our $VERSION = '1.4.2';
## @method void issuerDBInit()
# Load and check SAML configuration
......@@ -367,7 +367,7 @@ sub issuerForUnAuthUser {
# Open local session
my $local_session = $self->getApacheSession( $local_session_id, 1 );
unless ( $local_session->data ) {
unless ($local_session) {
$self->lmLog( "No local session found", 'error' );
return $self->sendSLOErrorResponse( $logout, $method );
}
......@@ -910,7 +910,7 @@ sub issuerForUnAuthUser {
$sessionInfo = $self->getApacheSession( $real_session, 1 );
unless ( $sessionInfo->data ) {
unless ($sessionInfo) {
$self->lmLog( "Cannot get session $real_session", 'error' );
$self->returnSOAPMessage();
}
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Portal::MailReset;
use strict;
use warnings;
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
use Lemonldap::NG::Portal::Simple qw(:all);
use base qw(Lemonldap::NG::Portal::SharedConf Exporter);
......@@ -117,7 +117,7 @@ sub extractMailInfo {
# Get the corresponding session
my $mailSession = $self->getApacheSession( $self->{mail_token} );
if ( $mailSession->data ) {
if ($mailSession) {
$self->{mail} = $mailSession->data->{user};
$self->{mailAddress} =
$mailSession->data->{ $self->{mailSessionKey} };
......@@ -385,7 +385,7 @@ sub changePassword {
# Get the corresponding session
my $mailSession = $self->getApacheSession( $self->{mail_token} );
if ( $mailSession->data ) {
if ($mailSession) {
$self->lmLog( "Delete mail session " . $self->{mail_token},
'debug' );
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Portal::Register;
use strict;
use warnings;
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
use Lemonldap::NG::Portal::Simple qw(:all);
use base qw(Lemonldap::NG::Portal::SharedConf Exporter);
......@@ -386,7 +386,7 @@ sub registerUser {
my $registerSession =
$self->getApacheSession( $self->{register_token} );
if ( $registerSession->data ) {
if ($registerSession) {
$self->lmLog( "Delete register session " . $self->{register_token},
'debug' );
......
......@@ -71,7 +71,7 @@ use Digest::MD5;
#inherits Apache::Session
#link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage
our $VERSION = '1.4.1';
our $VERSION = '1.4.2';
use base qw(Lemonldap::NG::Common::CGI Exporter);
our @ISA;
......@@ -2332,7 +2332,7 @@ sub store {
# Main session
my $session = $self->getApacheSession( $self->{id}, 0, $self->{force} );
return PE_APACHESESSIONERROR unless ( $session->data );
return PE_APACHESESSIONERROR unless ($session);
# Compute unsecure cookie value if needed
if ( $self->{securedCookie} == 3 ) {
......
......@@ -22,7 +22,7 @@ use URI; # Get metadata URL path
#inherits Lemonldap::NG::Common::Conf::SAML::Metadata protected service_metadata
our @ISA = (qw(Lemonldap::NG::Portal::_Browser));
our $VERSION = '1.4.1';
our $VERSION = '1.4.2';
our $samlCache;
our $initGlibDone;
......@@ -1837,7 +1837,7 @@ sub createArtifactResponse {
'debug' );
my $session = $self->getApacheSession( $session_id, 1 );
unless ( $session->data ) {
unless ($session) {
$self->lmLog( "Unable to open session $session_id", 'error' );
return;
}
......
......@@ -11,7 +11,7 @@ use MIME::Lite;
use MIME::Base64;
use Encode;
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
## @method string gen_password(string regexp)
# Generate a complex password based on a regular expression
......@@ -144,7 +144,7 @@ sub getMailSession {
# Browse found sessions to check if it's a mail session
foreach my $id ( keys %$sessions ) {
my $mailSession = $self->getApacheSession( $id, 1 );
next unless ( $mailSession->data );
next unless ($mailSession);
return $id if ( $mailSession->data->{_type} =~ /^mail$/ );
}
......@@ -169,7 +169,7 @@ sub getRegisterSession {
# Browse found sessions to check if it's a register session
foreach my $id ( keys %$sessions ) {
my $registerSession = $self->getApacheSession( $id, 1 );
next unless ( $registerSession->data );
next unless ($registerSession);
return $id if ( $registerSession->data->{_type} =~ /^register$/ );
}
......
......@@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::_LibAccess;
require SOAP::Lite;
use base qw(Lemonldap::NG::Portal::_LibAccess);
our $VERSION = '1.4.0';
our $VERSION = '1.4.2';
## @method void startSoapServices()
# Check the URI requested (PATH_INFO environment variable) and launch the
......@@ -143,7 +143,7 @@ sub getAttributes {
my $session = $self->getApacheSession( $id, 1 );
my @tmp = ();
unless ( $session->data ) {
unless ($session) {
$self->_sub( 'userNotice',
"SOAP attributes request: session $id not found" );
push @tmp, SOAP::Data->name( error => 1 )->type('int');
......@@ -173,7 +173,7 @@ sub setAttributes {
my $session = $self->getApacheSession($id);
unless ( $session->data ) {
unless ($session) {
$self->lmLog( "Session $id does not exists ($@)", 'warn' );
return 0;
}
......@@ -217,7 +217,7 @@ sub newSession {
my $session = $self->getApacheSession();
unless ( $session->data ) {
unless ($session) {
$self->lmLog( "Unable to create session", 'error' );
return 0;
}
......@@ -246,7 +246,7 @@ sub deleteSession {
my $session = $self->getApacheSession($id);
return 0 unless ( $session->data );
return 0 unless ($session);
$self->lmLog( "SOAP request to delete session $id", 'debug' );
......@@ -293,7 +293,7 @@ sub isAuthorizedURI {
# Get user session.
my $session = $self->getApacheSession( $id, 1 );
unless ( $session->data ) {
unless ($session) {
$self->lmLog( "Session $id does not exists", 'warn' );
return 0;
}
......@@ -325,7 +325,7 @@ sub getMenuApplications {
# Get user session.
my $session = $self->getApacheSession( $id, 1 );
unless ( $session->data ) {
unless ($session) {
$self->lmLog( "Session $id does not exists", 'warn' );
return 0;
}
......
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