| 1 | package Lemonldap::NG::Manager::Sessions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 28 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 28 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 28 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 28 | ▶ | use Lemonldap::NG::Common::Session; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 28 | ▶ | use Lemonldap::NG::Common::PSGI::Constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 28 | ▶ | use Lemonldap::NG::Common::Conf::Constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 28 | ▶ | use Lemonldap::NG::Common::Conf::ReConstants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 28 | ▶ | use Lemonldap::NG::Common::FormEncode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 28 | ▶ | use Lemonldap::NG::Common::IPv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 28 | extends qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | Lemonldap::NG::Manager::Plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | Lemonldap::NG::Common::Session::REST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | Lemonldap::NG::Common::Conf::AccessLib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 28 | our $VERSION = '2.23.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ############################# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # I. INITIALIZATION METHODS # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ############################# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 28 | ▶ | use constant defaultRoute => 'sessions.html'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 28 | ▶ | use constant icon => 'duplicate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 45 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=8 SCAR=22.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 45 | my ( $self, $conf ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 45 | $self->ua( Lemonldap::NG::Common::UserAgent->new($conf) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # HTML template | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 45 | $self->addRoute( 'sessions.html', undef, ['GET'] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # READ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ->addRoute( sessions => { ':sessionType' => 'sessions' }, ['GET'] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # DELETE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ->addRoute( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | sessions => { ':sessionType' => { ':sessionId' => 'delSession' } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ['DELETE'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # DELETE ALL SESSIONS FOR A USER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ->addRoute( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | sessions => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | { glogout => { ':sessionType' => { ':sessionId' => 'userLogout' } } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ['POST'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # DELETE OIDC CONSENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ->addRoute( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | sessions => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | OIDCConsent => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | { ':sessionType' => { ':sessionId' => 'delOIDCConsent' } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ['DELETE'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 45 | $self->setTypes($conf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 45 | ▶ | $self->{ipField} ||= 'ipAddr'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"ipField"} ||= "ipAddr"
MC/DC0%0/1
$self->{"ipField"} ||= "ipAddr"
$self->{"ipField"}
Truth table50%1/2
A
A= $self->{"ipField"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 45 | ▶ | $self->{portal} ||= $conf->{portal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"portal"} ||= $conf->{"portal"}
MC/DC0%0/2
$self->{"portal"} ||= $conf->{"portal"}
$self->{"portal"}
$conf->{"portal"}
Truth table33%1/3
A ||= B
A= $self->{"portal"}B= $conf->{"portal"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 45 | ▶ | $self->{cookieName} ||= $conf->{cookieName}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"cookieName"} ||= $conf->{"cookieName"}
MC/DC0%0/2
$self->{"cookieName"} ||= $conf->{"cookieName"}
$self->{"cookieName"}
$conf->{"cookieName"}
Truth table33%1/3
A ||= B
A= $self->{"cookieName"}B= $conf->{"cookieName"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 45 | ▶ | $self->{multiValuesSeparator} ||= '; '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"multiValuesSeparator"} ||= "; "
MC/DC0%0/1
$self->{"multiValuesSeparator"} ||= "; "
$self->{"multiValuesSeparator"}
Truth table50%1/2
A
A= $self->{"multiValuesSeparator"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 45 | ▶ | $self->{impersonationPrefix} = $conf->{impersonationPrefix} || 'real_'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$conf->{'impersonationPrefix'} || 'real_'
MC/DC0%0/1
$conf->{'impersonationPrefix'} || 'real_'
$conf->{'impersonationPrefix'}
Truth table50%1/2
A
A= $conf->{'impersonationPrefix'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 45 | ▶ | $self->{hiddenAttributes} //= '_password'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"hiddenAttributes"} //= "_password"
MC/DC0%0/1
$self->{"hiddenAttributes"} //= "_password"
$self->{"hiddenAttributes"}
Truth table50%1/2
A
A= $self->{"hiddenAttributes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | $self->{hiddenAttributes} .= ' _session_id' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 45 | ▶ | unless $conf->{displaySessionId}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 45 | $self->{tokenRevokeSecret} = $conf->{adminLogoutServerSecret}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 45 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # User logout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | ▶ | sub userLogout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
userLogout: called CC=19 SCAR=39.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | ▶ | my $mod = $self->getMod($req) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | or return $self->sendError( $req, undef, 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | my $id = $req->params('sessionId') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | or return $self->sendError( $req, 'sessionId is missing', 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | my $session = $self->getApacheSession( $mod, $id ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | or return $self->sendError( $req, "session $id not found" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | my $uidKey = Lemonldap::NG::Handler::Main->tsv->{whatToTrace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | ▶ | my $uid = $session->data->{$uidKey} || $session->data->{_session_uid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$session->data->{$uidKey} || $session->data->{'_session_uid'}
MC/DC0%0/2
$session->data->{$uidKey} || $session->data->{'_session_uid'}
$session->data->{$uidKey}
$session->data->{'_session_uid'}
Truth table33%1/3
A || B
A= $session->data->{$uidKey}B= $session->data->{'_session_uid'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | foreach my $storage (qw(oidcStorage sessionStorage)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | my $storageModule = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 4 | Lemonldap::NG::Handler::Main->tsv->{"${storage}Module"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 4 | ▶ | if ( defined $storageModule ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | ▶ | next if ( $storageModule eq "Apache::Session::Memcached" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | my $opts = Lemonldap::NG::Handler::Main->tsv->{"${storage}Options"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | $opts->{backend} = $storageModule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 4 | my $sessions = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Lemonldap::NG::Common::Apache::Session->searchOn( $opts, $uidKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | $uid ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 4 | my @keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 4 | ▶ | if ( $sessions and %$sessions ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sessions and %$sessions
MC/DC50%1/2
$sessions and %$sessions
$sessions
%$sessions
Truth table66%2/3
A and B
A= $sessionsB= %$sessions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | @keys = keys %$sessions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | foreach my $sid (@keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 4 | my $kind = $sessions->{$sid}->{_session_kind}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 4 | my $deletedByPortal = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 4 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition11%1/9
$self->{"tokenRevokeSecret"} and $kind eq "SSO" || $kind eq "OIDCI" && $sessions->{$sid}{"_type"} eq "refresh_token"
$kind eq "SSO" or $kind eq "OIDCI" and $sessions->{$sid}{"_type"} eq "refresh_token"
$kind eq "OIDCI" and $sessions->{$sid}{"_type"} eq "refresh_token"
MC/DC0%0/4
$self->{"tokenRevokeSecret"} and $kind eq "SSO" || $kind eq "OIDCI" && $sessions->{$sid}{"_type"} eq "refresh_token"
$self->{"tokenRevokeSecret"}
$kind eq "SSO"
$kind eq "OIDCI"
$sessions->{$sid}{"_type"} eq "refresh_token"
Truth table20%1/5
A and B or C and D
A= $self->{"tokenRevokeSecret"}B= $kind eq "SSO"C= $kind eq "OIDCI"D= $sessions->{$sid}{"_type"} eq "refresh_token"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | $self->{tokenRevokeSecret} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | and ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | $kind eq 'SSO' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | or ( $kind eq 'OIDCI' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | and $sessions->{$sid}->{_type} eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 'refresh_token' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | my $type = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $kind eq 'SSO' ? 'SSO' : $sessions->{$sid}->{_type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $s = build_urlencoded( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | token_hint => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | token => $sid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | raw => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $portal = $self->{portal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $portal =~ s#/+$##; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $lreq = HTTP::Request->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | POST => "$portal/admintokenrevoke", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | Authorization => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | "Bearer $self->{tokenRevokeSecret}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 'Content-Length' => length($s), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 'Content-Type' => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 'application/x-www-form-urlencoded', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | Accept => 'application/json', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | $s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $resp = $self->ua->request($lreq); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ( $resp->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->logger->info( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | "Session $type/$sid deleted by portal"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $deletedByPortal = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $self->logger->error( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | "Error when calling portal to logout: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | . $resp->status_line ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Skip manual removal if already deleted by portal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | ▶ | next if $deletedByPortal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | my $session = Lemonldap::NG::Common::Session->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | storageModule => $storageModule, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | storageModuleOptions => $opts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | cacheModule => Lemonldap::NG::Handler::Main->tsv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ->{sessionCacheModule}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | cacheModuleOptions => Lemonldap::NG::Handler::Main->tsv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | ->{sessionCacheOptions}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | id => $sid, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | ▶ | if ( $session->data ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 4 | $session->remove; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | Lemonldap::NG::Handler::PSGI::Main->localUnlog( $req, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | return $self->sendJSONresponse( $req, { result => 1, count => $count } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # II. CONSENT METHODS # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub delOIDCConsent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delOIDCConsent: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | my $mod = $self->getMod($req) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | or return $self->sendError( $req, undef, 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $params = $req->parameters(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $epoch = $params->{epoch}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $rp = $params->{rp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | my $id = $req->params('sessionId') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | or return $self->sendError( $req, 'sessionId is missing', 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $req->parameters->set( 'sessionId', $self->_maybeDecryptSessionId($id) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if ( $rp =~ /\b[\w-]+\b/ and defined $epoch ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rp =~ /\b[\w-]+\b/ and defined $epoch
MC/DC0%0/2
$rp =~ /\b[\w-]+\b/ and defined $epoch
$rp =~ /\b[\w-]+\b/
defined $epoch
Truth table0%0/3
A and B
A= $rp =~ /\b[\w-]+\b/B= defined $epoch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $self->logger->debug( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | "Call procedure deleteOIDCConsent with RP=$rp and epoch=$epoch"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return $self->deleteOIDCConsent($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $self->sendError( $req, undef, 400 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ######################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # III. DISPLAY METHODS # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ######################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 18 | ▶ | sub sessions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sessions: called CC=72 SCAR=51.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 18 | my ( $self, $req, $session, $skey ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # Case 1: only one session is required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 18 | ▶ | if ($session) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 7 | return $self->session( $req, $session, $skey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 11 | ▶ | my $mod = $self->getMod($req) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | or return $self->sendError( $req, undef, 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 11 | my $params = $req->parameters(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 11 | my $type = delete $params->{sessionType}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 11 | ▶ | $type = $type eq 'global' ? 'SSO' : ucfirst($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 11 | ▶ | $type = $type eq 'Offline' ? 'OIDCI' : ucfirst($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 11 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # Case 2: list of sessions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 11 | my $whatToTrace = Lemonldap::NG::Handler::Main->tsv->{whatToTrace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # 2.1 Get fields to require | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 11 | my @fields = ( '_httpSessionType', $self->{ipField}, $whatToTrace ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 11 | ▶ | if ( my $groupBy = $params->{groupBy} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 5 | ▶ | $groupBy =~ s/^substr\((\w+)(?:,\d+(?:,\d+)?)?\)$/$1/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | or $groupBy =~ s/^net(?:4|6|)\(([\w:]+),\d+(?:,\d+)?\)$/$1/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 5 | ▶ | $groupBy =~ s/^_whatToTrace$/$whatToTrace/o | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | or push @fields, $groupBy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | elsif ( my $order = $params->{orderBy} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 2 | $order =~ s/^net(?:4|6|)\(([\w:]+)\)$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | $order =~ s/^_whatToTrace$/$whatToTrace/o | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | or push @fields, split( /, /, $order ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 4 | push @fields, '_utime'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # 2.2 Restrict query if possible: search for filters (any query arg that is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # not a keyword) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 11 | my $moduleOptions = $mod->{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 11 | $moduleOptions->{backend} = $mod->{module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | my %filters = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 11 | my $s = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 10 | $s =~ s/\b_whatToTrace\b/$whatToTrace/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | /^(?:(?:group|order)By|doubleIp)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ? () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 10 | ▶ | : ( $s => $params->{$_} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } keys %$params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 11 | $filters{_session_kind} = $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 11 | push @fields, keys(%filters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 11 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 11 | @fields = grep { !$seen{$_}++ } @fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # For now, only one argument can be passed to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # Lemonldap::NG::Common::Apache::Session so just the first filter is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | my ($firstFilter) = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 11 | $filters{$a} =~ m#^[\w:]+/\d+\*?$# ? 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | ▶ | : $filters{$b} =~ m#^[\w:]+/\d+\*?$# ? -1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | : $a eq '_session_kind' ? 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | : $b eq '_session_kind' ? -1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | : $a cmp $b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } keys %filters; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # Check if a '*' is required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 11 | my $function = 'searchOn'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | $function = 'searchOnExpr' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 11 | ▶ | if ( grep { /\*/ and not m#^[\w:]+/\d+\*?$# } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
/\*/ && !m[^[\w:]+/\d+\*?$]
MC/DC50%1/2
/\*/ && !m[^[\w:]+/\d+\*?$]
/\*/
!m[^[\w:]+/\d+\*?$]
Truth table66%2/3
A && not(B)
A= /\*/B= !m[^[\w:]+/\d+\*?$]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 11 | ▶ | ( $filters{$firstFilter} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 11 | $self->logger->debug( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | "First filter: $firstFilter = $filters{$firstFilter} ($function)"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $res = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Lemonldap::NG::Common::Apache::Session->$function( $moduleOptions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 11 | $firstFilter, $filters{$firstFilter}, @fields ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 11 | ▶ | return $self->sendJSONresponse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res and %$res
MC/DC0%0/2
$res and %$res
$res
%$res
Truth table33%1/3
A and B
A= $resB= %$res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | $req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | result => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | count => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | total => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | values => [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | ) unless ( $res and %$res ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | delete $filters{$firstFilter} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 11 | ▶ | unless ( grep { /\*/ and not m#^[\w:]+/\d+\*?$# } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
/\*/ && !m[^[\w:]+/\d+\*?$]
MC/DC50%1/2
/\*/ && !m[^[\w:]+/\d+\*?$]
/\*/
!m[^[\w:]+/\d+\*?$]
Truth table66%2/3
A && not(B)
A= /\*/B= !m[^[\w:]+/\d+\*?$]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 11 | ▶ | ( $filters{$firstFilter} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 11 | foreach my $k ( keys %filters ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 4 | $self->logger->debug("Removing unless $k =~ /^$filters{$k}\$/"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | ▶ | if ( $filters{$k} =~ m#^([\w:]+)/(\d+)\*?$# ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my ( $net, $bits ) = ( $1, $2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | foreach my $session ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | delete $res->{$session} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | unless ( net6( $res->{$session}->{$k}, $bits ) eq $net ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 4 | $filters{$k} =~ s/\./\\./g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 4 | $filters{$k} =~ s/\*/\.\*/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 4 | foreach my $session ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 6 | ▶ | if ( $res->{$session}->{$k} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | delete $res->{$session} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 6 | ▶ | unless ( $res->{$session}->{$k} =~ /^$filters{$k}$/ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 11 | my $total = ( keys %$res ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # 2.4 Special case doubleIp (users connected from more than 1 IP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 11 | ▶ | if ( defined $params->{doubleIp} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | my %r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # 2.4.1 Store user IP addresses in %r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | foreach my $id ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 4 | my $entry = $res->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 4 | ▶ | next if ( $entry->{_httpSessionType} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 4 | $r{ $entry->{$whatToTrace} }->{ $entry->{ $self->{ipField} } }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # 2.4.2 Store sessions owned by users that has more than one IP address in $r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | my $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | $total = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 4 | my @tmp = keys %{ $r{ $res->{$k}->{$whatToTrace} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 4 | ▶ | if ( @tmp > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $total += 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | $res->{$k}->{_sessionId} = $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | push @{ $r->{ $res->{$k}->{$whatToTrace} } }, $res->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # 2.4.3 Store these session in an array. Array elements are : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # uid => whatToTraceFieldValue, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # sessions => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # { session => <session-id-1>, date => <_utime> }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # { session => <session-id-2>, date => <_utime> }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | $res = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | foreach my $uid ( sort keys %$r ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | push @$res, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | value => $uid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | count => scalar( @{ $r->{$uid} } ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | sessions => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | session => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | $self->_maybeEncryptSessionId( $_->{_sessionId} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | date => $_->{_utime} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | } @{ $r->{$uid} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # 2.4 Order and group by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # $res will become an array ref here (except for doubleIp, already done below). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # If "groupBy" is asked, elements will be like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # { uid => 'foo.bar', count => 3 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | elsif ( my $group = $req->params('groupBy') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 5 | my $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 5 | $group =~ s/\b_whatToTrace\b/$whatToTrace/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # Substrings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 5 | ▶ | if ( $group =~ /^substr\((\w+)(?:,(\d+)(?:,(\d+))?)?\)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | my ( $field, $length, $start ) = ( $1, $2, $3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # "next" is a try with $length+1, if only one account, $length++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # This permits UI to jump directly to the uid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # -d (300) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # -> dwho (300) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # ... sessions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | ▶ | $start ||= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$start ||= 0
MC/DC0%0/1
$start ||= 0
$start
Truth table50%1/2
A
A= $start
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 2 | ▶ | $length = 1 if ( $length < 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 5 | my $next = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 5 | my $stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 5 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 11 | my $subk = substr $res->{$k}->{$field}, $start, $length + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | $next->{$subk}++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 11 | ▶ | if ( $res->{$k}->{$field} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # End of the loop if we reached the length of uid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | $stop++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 11 | ▶ | if $start + $length >= length( $res->{$k}->{$field} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # Loop if only one result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 5 | my @k = keys %$next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 5 | ▶ | if ( @k == 1 and !$stop ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@k == 1 and not $stop
MC/DC50%1/2
@k == 1 and not $stop
@k == 1
not $stop
Truth table66%2/3
A and not(B)
A= @k == 1B= not $stop
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 3 | $length++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # Result calculation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | $r->{ substr $res->{$k}->{$field}, $start, $length }++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 5 | ▶ | if ( $res->{$k}->{$field} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | $group = $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # Subnets IPv4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | elsif ( $group =~ /^net4\((\w+),(\d)\)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 2 | my $field = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 2 | my $nb = $2 - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 8 | ▶ | if ( $res->{$k}->{$field} =~ /^((((\d+)\.\d+)\.\d+)\.\d+)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 8 | my @d = ( $4, $3, $2, $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 8 | $r->{ $d[$nb] }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 2 | $group = $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # Subnets IPv6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | elsif ( $group =~ /^net6\(([\w:]+),(\d)\)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $field = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $bits = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | $r->{ net6( $res->{$k}->{$field}, $bits ) . "/$bits" }++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if ( isIPv6( $res->{$k}->{$field} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # Both IPv4 and IPv6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | elsif ( $group =~ /^net\(([\w:]+),(\d+),(\d+)\)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | my $field = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $bits = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my $nb = $3 - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if ( isIPv6( $res->{$k}->{$field} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | $r->{ net6( $res->{$k}->{$field}, $bits ) . "/$bits" }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | elsif ( $res->{$k}->{$field} =~ /^((((\d+)\.\d+)\.\d+)\.\d+)$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my @d = ( $4, $3, $2, $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $r->{ $d[$nb] }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # Simple field groupBy query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | elsif ( $group =~ /^\w+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 1 | foreach my $k ( keys %$res ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 4 | $r->{ $res->{$k}->{$group} }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 1 | ▶ | return $self->sendError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | $req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | qq{Use of an uninitialized attribute "$group" to group sessions}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 400 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | ) if ($@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | return $self->sendError( $req, 'Syntax error in groupBy', 400 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # Build result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 5 | $total = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | $res = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 7 | my @a = ( $a->{value} =~ /^(\d+)(?:\.(\d+))*$/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 7 | my @b = ( $b->{value} =~ /^(\d+)(?:\.(\d+))*$/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | ( @a and @b ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | ? ( $a[0] <=> $b[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | or $a[1] <=> $b[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | or $a[2] <=> $b[2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | or $a[3] <=> $b[3] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | : $a->{value} cmp $b->{value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 7 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition41%5/12
@a and @b
$a[0] <=> $b[0] or $a[1] <=> $b[1] or $a[2] <=> $b[2] or $a[3] <=> $b[3]
$a[0] <=> $b[0] or $a[1] <=> $b[1] or $a[2] <=> $b[2]
$a[0] <=> $b[0] or $a[1] <=> $b[1]
MC/DC50%1/2
@a and @b
@a
@b
MC/DC0%0/4
$a[0] <=> $b[0] or $a[1] <=> $b[1] or $a[2] <=> $b[2] or $a[3] <=> $b[3]
$a[0] <=> $b[0]
$a[1] <=> $b[1]
$a[2] <=> $b[2]
$a[3] <=> $b[3]
Truth table66%2/3
A and B
A= @aB= @b
Truth table20%1/5
A or B or C or D
A= $a[0] <=> $b[0]B= $a[1] <=> $b[1]C= $a[2] <=> $b[2]D= $a[3] <=> $b[3]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 5 | map { $total += $r->{$_}; { value => $_, count => $r->{$_} } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | keys %$r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # Else if "orderBy" is asked, $res elements will be like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # { uid => 'foo.bar', session => <sessionId> } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | elsif ( my $f = $req->params('orderBy') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | my @fields = split /,/, $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | my @r = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | my $tmp = { session => $self->_maybeEncryptSessionId($_) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 8 | foreach my $f (@fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 8 | my $s = $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 8 | $s =~ s/^net(?:4|6|)\(([\w:]+)\)$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 8 | $tmp->{$s} = $res->{$_}->{$s}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | $tmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 8 | } keys %$res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | ▶ | while ( my $f = pop @fields ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | ▶ | if ( $f =~ s/^net4\((\w+)\)$/$1/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | @r = sort { cmpIPv4( $a->{$f}, $b->{$f} ); } @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | elsif ( $f =~ s/^net6\(([:\w]+)\)$/$1/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | @r = sort { expand6( $a->{$f} ) cmp expand6( $b->{$f} ); } @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | elsif ( $f =~ s/^net\(([:\w]+)\)$/$1/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | @r = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my $ip1 = $a->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $ip2 = $b->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | isIPv6($ip1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | isIPv6($ip2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | ? expand6($ip1) cmp expand6($ip2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | : -1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | : isIPv6($ip2) ? 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | : cmpIPv4( $ip1, $ip2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } @r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | @r = sort { $a->{$f} cmp $b->{$f} } @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 2 | $res = [@r]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # Else, $res elements will be like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # { session => <sessionId>, date => <timestamp> } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | $res = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 2 | sort { $a->{date} <=> $b->{date} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 3 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | session => $self->_maybeEncryptSessionId($_), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | date => $res->{$_}->{_utime} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 5 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | keys %$res | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 11 | return $self->sendJSONresponse( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | $req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | result => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | count => scalar(@$res), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | total => $total, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | values => $res | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 7 | ▶ | sub session { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 7 | my ( $self, $req, $session, $skey ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 7 | $session = $self->_maybeDecryptSessionId($session); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 7 | return $self->SUPER::session( $req, $session, $skey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 11 | ▶ | sub _maybeDecryptSessionId { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybeDecryptSessionId: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 11 | my ( $self, $session ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 11 | ▶ | if ( $self->{hiddenAttributes} =~ /\b_session_id\b/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | $session = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | Lemonldap::NG::Handler::Main->tsv->{cipher}->decryptHex($session); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 11 | return $session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 15 | ▶ | sub _maybeEncryptSessionId { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybeEncryptSessionId: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 15 | my ( $self, $session ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 15 | ▶ | if ( $self->{hiddenAttributes} =~ /\b_session_id\b/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | $session = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | Lemonldap::NG::Handler::Main->tsv->{cipher}->encryptHex($session); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 15 | return $session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 4 | ▶ | sub delSession { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delSession: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 4 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 4 | ▶ | my $id = $req->params('sessionId') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | or return $self->sendError( $req, 'sessionId is missing', 400 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 4 | $req->parameters->set( 'sessionId', $self->_maybeDecryptSessionId($id) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 4 | return $self->SUPER::delSession($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 5 | ▶ | sub cmpIPv4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmpIPv4: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 5 | my @a = split /\./, $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 5 | my @b = split /\./, $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 5 | my $cmp = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 5 | ▶ | F: for ( my $i = 0 ; $i < 4 ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 12 | ▶ | if ( $a[$i] != $b[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 5 | $cmp = $a[$i] <=> $b[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 5 | last F; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 5 | $cmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 28 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||