Lemonldap/NG/Handler/Main/Reload.pm

filter: Statementstmt 77.9% 254 / 326 Branchbran 62.3% 81 / 130 Conditioncond 55.7% 39 / 70 MC/DCmcdc 31.7% 13 / 41 Subroutinesub 81.0% 30 / 37 Podpod 0.0% 0 / 19 totaltotal 66.9% 417 / 623 CC 108 SCAR 29.7
CC
108
Cov
71%
postUrlInit
45.5
checkConf
40.1
sessionStorageInit
35.1
CRAP 19.5
« Lemonldap/NG/Handler/ApacheMP2.pm ↑ Summary Lemonldap/NG/Handler/Main/Run.pm »
1 package Lemonldap::NG::Handler::Main::Reload;
2  
3 27 our $VERSION = '2.23.0';
4  
5 package Lemonldap::NG::Handler::Main;
6  
7 52 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 29 ▶use Digest::SHA qw(sha256_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 27 ▶use Lemonldap::NG::Common::Conf::Constants; #inherits
Subroutine BEGIN: called CC=1 SCAR=0.0
10 27 ▶use Lemonldap::NG::Common::Crypto;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 27 ▶use Lemonldap::NG::Common::Safelib; #link protected safe Safe object
Subroutine BEGIN: called CC=1 SCAR=0.0
12 27 ▶use Lemonldap::NG::Handler::Main::Jail;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 27 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 27 ▶use constant UNPROTECT => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 27 ▶use constant SKIP => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 27 ▶use constant MAYSKIP => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 27 our @_onReload;
20  
21 sub onReload {
22 1 ▶ my ( $class, $obj, $sub ) = @_;
Subroutine onReload: called CC=3 SCAR=13.0
Pod undocumented
23 1 ▶ unless ( ref($obj) and $sub ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $obj and $sub) 0 1 1
Condition33%1/3
ref $obj and $sub
!ll&&!rl&&r
001
MC/DC0%0/2
ref $obj and $sub
ref $obj $sub
Truth table33%1/3
A and B
A= ref $objB= $sub
ABresult
0X0
100
111
24 0 $class->logger->error(
25 'onReload called with invalid arguments, skipping');
26 0 return;
27 }
28 1 my $entry = [ $obj, $sub ];
29 1 weaken( $entry->[0] );
30 1 push @_onReload, $entry;
31 }
32  
33 # CONFIGURATION UPDATE
34  
35 ## @rmethod protected int checkConf(boolean force)
36 # Check if configuration is up to date, and reload it if needed.
37 # If the optional boolean $force is set to true,
38 # * cached configuration is ignored
39 # * and checkConf returns false if it fails to load remote config
40 # @param $force boolean
41 # @return true if config is up to date or if reload config succeeded
42 sub checkConf {
43 62 ▶ my ( $class, $force ) = @_;
Subroutine checkConf: called CC=24 SCAR=36.9
Pod undocumented
44 62 $class->logger->debug("Check configuration for $class");
45 62 my $prm = { local => !$force, localPrm => $class->localConfig };
46 62 my $cfgNum = $class->confAcc->lastCfg();
47 62 ▶ $prm->{local} = 0 if $class->cfgNum and $cfgNum != $class->cfgNum;
Branch: 1 branch
BranchTrueFalseTotal
if $class->cfgNum and $cfgNum != $class->cfgNum 4 58 62
Condition100%3/3
$class->cfgNum and $cfgNum != $class->cfgNum
!ll&&!rl&&r
27314
MC/DC100%2/2
$class->cfgNum and $cfgNum != $class->cfgNum
$class->cfgNum $cfgNum != $class->cfgNum
Truth table100%3/3
A and B
A= $class->cfgNumB= $cfgNum != $class->cfgNum
ABresult
0X0
100
111
48 62 my $conf = $class->confAcc->getConf($prm);
49 62 chomp $Lemonldap::NG::Common::Conf::msg;
50  
51 62 ▶ unless ( ref($conf) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $conf) 5 57 62
52 5 $class->logger->error(
53 "$class: Unable to load configuration: $Lemonldap::NG::Common::Conf::msg"
54 );
55 5 ▶ return $force ? 0 : $class->cfgNum ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
$force ? : 3 2 5
$class->cfgNum ? : 0 2 2
56 }
57  
58 57 ▶ if ($Lemonldap::NG::Common::Conf::msg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Lemonldap::NG::Common::Conf::msg) 57 0 57
59 57 ▶ if ( $Lemonldap::NG::Common::Conf::msg =~ /Error:/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($Lemonldap::NG::Common::Conf::msg =~ /Error:/) { } 1 56 57
elsif ($Lemonldap::NG::Common::Conf::msg =~ /Warn:/) { } 0 56 56
60 1 $class->logger->error($Lemonldap::NG::Common::Conf::msg);
61 }
62 elsif ( $Lemonldap::NG::Common::Conf::msg =~ /Warn:/ ) {
63 0 $class->logger->warn($Lemonldap::NG::Common::Conf::msg);
64 }
65 else {
66 56 $class->logger->debug($Lemonldap::NG::Common::Conf::msg);
67 }
68 }
69 57 $Lemonldap::NG::Common::Conf::msg = '';
70  
71 57 ▶ if ( $force
Branch: 1 branch
BranchTrueFalseTotal
if ($force or not $class->cfgNum or not $class->cfgDate or $class->cfgNum != $conf->{"cfgNum"} or $class->cfgDate != $conf->{"cfgDate"}) 4 10 14
Condition75%9/12
$force or not $class->cfgNum or not $class->cfgDate or $class->cfgNum != $conf->{"cfgNum"} or $class->cfgDate != $conf->{"cfgDate"}
l!l&&r!l&&!r
47010
$force or not $class->cfgNum or not $class->cfgDate or $class->cfgNum != $conf->{"cfgNum"}
l!l&&r!l&&!r
43410
$force or not $class->cfgNum or not $class->cfgDate
l!l&&r!l&&!r
43014
$force or not $class->cfgNum
l!l&&r!l&&!r
43014
MC/DC40%2/5
$force or not $class->cfgNum or not $class->cfgDate or $class->cfgNum != $conf->{"cfgNum"} or $class->cfgDate != $conf->{"cfgDate"}
$force not $class->cfgNum not $class->cfgDate $class->cfgNum != $conf->{"cfgNum"} $class->cfgDate != $conf->{"cfgDate"}
Truth table50%3/6
A or not(B) or not(C) or D or E
A= $forceB= not $class->cfgNumC= not $class->cfgDateD= $class->cfgNum != $conf->{"cfgNum"}E= $class->cfgDate != $conf->{"cfgDate"}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
72 or !$class->cfgNum
73 or !$class->cfgDate
74 or $class->cfgNum != $conf->{cfgNum}
75 or $class->cfgDate != $conf->{cfgDate} )
76 {
77 47 $class->logger->debug(
78 "Get configuration $conf->{cfgNum} aged $conf->{cfgDate}");
79 47 ▶ unless ( $class->cfgNum( $conf->{cfgNum} )
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->cfgNum($conf->{"cfgNum"}) and $class->cfgDate($conf->{"cfgDate"})) 0 47 47
Condition33%1/3
$class->cfgNum($conf->{"cfgNum"}) and $class->cfgDate($conf->{"cfgDate"})
!ll&&!rl&&r
0047
MC/DC0%0/2
$class->cfgNum($conf->{"cfgNum"}) and $class->cfgDate($conf->{"cfgDate"})
$class->cfgNum($conf->{"cfgNum"}) $class->cfgDate($conf->{"cfgDate"})
Truth table33%1/3
A and B
A= $class->cfgNum($conf->{"cfgNum"})B= $class->cfgDate($conf->{"cfgDate"})
ABresult
0X0
100
111
80 && $class->cfgDate( $conf->{cfgDate} ) )
81 {
82 0 $class->logger->error('No configuration available');
83 0 return 0;
84 }
85 47 $class->configReload($conf);
86 47 foreach (@_onReload) {
87 1 ▶ unless ( ref($_) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $_ eq "ARRAY") 0 1 1
88 0 ▶ $class->logger->error(
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
89 "Corrupted entry in _onReload: expected ARRAY ref, got "
90 . ( defined $_ ? "'$_'" : 'undef' ) );
91 0 next;
92 }
93 1 my ( $obj, $sub ) = @$_;
94 1 ▶ if ($obj) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj) 1 0 1
95 1 $class->logger->debug(
96 'Launching ' . ref($obj) . "->$sub(conf)" );
97 1 ▶ unless ( $obj->$sub($conf) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->$sub($conf)) 0 1 1
98 0 $class->logger->error( "Underlying object can't load conf ("
99 . ref($obj)
100 . "->$sub)" );
101 0 ▶ if ( $obj->can('error') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("error")) 0 0 0
102 0 $Lemonldap::NG::Common::Conf::msg = $obj->error;
103 }
104 0 return 0;
105 }
106 }
107 }
108 }
109 57 ▶ $class->checkTime( $conf->{checkTime} ) if $conf->{checkTime};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"checkTime"} 57 0 57
110 57 ▶ $class->checkMsg( $conf->{checkMsg} ) if $conf->{checkMsg};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"checkMsg"} 57 0 57
111 57 $class->lastCheck( time() );
112 57 $class->logger->debug("$class: configuration is up to date");
113 57 return 1;
114 }
115  
116 # RELOAD SYSTEM
117  
118 ## @rmethod int reload
119 # Launch checkConf() with $local=0, so remote configuration is tested.
120 # Then build a simple HTTP response that just returns "200 OK" or
121 # "500 Server Error".
122 # @return Apache constant ($class->OK or $class->SERVER_ERROR)
123 sub reload {
124 1 ▶ my $class = shift;
Subroutine reload: called CC=2 SCAR=7.1
Pod undocumented
125 1 $class->logger->notice("Request for configuration reload");
126 1 ▶ return $class->checkConf(1) ? $class->DONE : $class->SERVER_ERROR;
Branch: 1 branch
BranchTrueFalseTotal
$class->checkConf(1) ? : 1 0 1
127 }
128  
129 27 *refresh = *reload;
130  
131 # INTERNAL METHODS
132  
133 ## @imethod void configReload(hashRef conf, hashRef tsv)
134 # Given a Lemonldap::NG configuration $conf, computes values used to
135 # handle requests and store them in a thread shared object called $tsv
136 #
137 # methods called by configReload, and thread shared values computed, are:
138 # - jailInit():
139 # - jail
140 # - defaultValuesInit():
141 # (scalars for global options)
142 # - cookieExpiration # warning: absent from default Conf
143 # - cookieName
144 # - securedCookie,
145 # - httpOnly
146 # - whatToTrace
147 # - customFunctions
148 # - timeoutActivity
149 # - timeoutActivityInterval
150 # - useRedirectOnError
151 # - useRedirectOnForbidden
152 # - useRedirectAjaxOnUnauthorized
153 # - useSafeJail
154 # (objects)
155 # - cipher # Lemonldap::NG::Common::Crypto object
156 # (hashrefs for vhost options)
157 # - https
158 # - port
159 # - maintenance
160 # - portalInit():
161 # - portal (functions that returns portal URL)
162 # - locationRulesInit():
163 # - locationCount
164 # - defaultCondition
165 # - defaultProtection
166 # - locationCondition
167 # - locationProtection
168 # - locationRegexp
169 # - locationConditionText
170 # - sessionStorageInit():
171 # - sessionStorageModule
172 # - sessionStorageOptions
173 # - sessionCacheModule
174 # - sessionCacheOptions
175 # - headersInit():
176 # - headerList
177 # - forgeHeaders
178 # - postUrlInit():
179 # - inputPostData
180 # - outputPostData
181 # - aliasInit():
182 # - vhostAlias
183 # - oauth2Init():
184 # - oauth2Options
185 # - msgBrokerInit():
186 # - msgBrokerWriter
187 # - msgBrokerReader
188 #
189 # The *Init() methods can be run in any order,
190 # but jailInit must be run first because $tsv->{jail}
191 # is used by locationRulesInit, headersInit and postUrlInit.
192  
193 # @param $conf reference to the configuration hash
194 # @param $tsv reference to the thread-shared parameters conf
195 sub configReload {
196 51 ▶ my ( $class, $conf ) = @_;
Subroutine configReload: called CC=2 SCAR=6.9
Pod undocumented
197 51 $class->logger->info(
198 "Loading configuration $conf->{cfgNum} for process $$");
199  
200 51 foreach my $sub (
201 qw( defaultValuesInit jailInit portalInit locationRulesInit
202 sessionStorageInit headersInit postUrlInit aliasInit
203 oauth2Init msgBrokerInit )
204 )
205 {
206 510 $class->logger->debug("Process $$ calls $sub");
207 510 $class->$sub($conf);
208 }
209 51 return 1;
210 }
211  
212 ## @imethod protected void jailInit(hashRef args)
213 # Set default values for non-customized variables
214 # @param $args reference to the configuration hash
215 sub jailInit {
216 52 ▶ my ( $class, $conf ) = @_;
Subroutine jailInit: called CC=1 SCAR=0.0
Pod undocumented
217  
218 $class->tsv->{jail} = Lemonldap::NG::Handler::Main::Jail->new( {
219 useSafeJail => $conf->{useSafeJail},
220 customFunctions => $conf->{customFunctions},
221 multiValuesSeparator => $conf->{multiValuesSeparator},
222 }
223 52 );
224 $class->tsv->{jail}
225 52 ->build_jail( $class, $conf->{require}, $conf->{requireDontDie} );
226 }
227  
228 ## @imethod protected void defaultValuesInit(hashRef args)
229 # Set default values for non-customized variables
230 # @param $args reference to the configuration hash
231 sub defaultValuesInit {
232 52 ▶ my ( $class, $conf ) = @_;
Subroutine defaultValuesInit: called CC=11 SCAR=24.0
Pod undocumented
233  
234 $class->tsv->{$_} = $conf->{$_}
235 52 foreach ( qw(
236 cookieExpiration cookieName customFunctions
237 securedCookie timeout timeoutActivity
238 timeoutActivityInterval useRedirectOnError useRedirectOnForbidden
239 useSafeJail httpOnly whatToTrace handlerInternalCache
240 handlerServiceTokenTTL customToTrace lwpOpts lwpSslOpts
241 authChoiceAuthBasic authChoiceParam upgradeSession
242 hashedSessionStore eventQueueName eventStatus
243 statusQueueName useRedirectAjaxOnUnauthorized
244 )
245 );
246  
247 52 $class->tsv->{cipher} = Lemonldap::NG::Common::Crypto->new( $conf->{key} );
248 52 $class->tsv->{keyH} = sha256_hex( $conf->{key} );
249  
250 52 foreach my $opt (qw(https port maintenance)) {
251  
252 # Record default value in key '_'
253 156 $class->tsv->{$opt} = { _ => $conf->{$opt} };
254  
255 # Override with vhost options
256 156 ▶ if ( $conf->{vhostOptions} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"vhostOptions"}) 147 9 156
257 147 my $name = 'vhost' . ucfirst($opt);
258 147 foreach my $vhost ( sort keys %{ $conf->{vhostOptions} } ) {
259 264 ▶ $conf->{vhostOptions}->{$vhost} ||= {};
Condition50%1/2
$conf->{"vhostOptions"}{$vhost} ||= {}
l!l
2640
MC/DC0%0/1
$conf->{"vhostOptions"}{$vhost} ||= {}
$conf->{"vhostOptions"}{$vhost}
Truth table50%1/2
A
A= $conf->{"vhostOptions"}{$vhost}
Aresult
11
00
260 264 my $val = $conf->{vhostOptions}->{$vhost}->{$name};
261  
262 # Keep global value if $val is negative
263 264 ▶ if ( defined $val and $val >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val and $val >= 0) 85 179 264
Condition66%2/3
defined $val and $val >= 0
!ll&&!rl&&r
179085
MC/DC50%1/2
defined $val and $val >= 0
defined $val $val >= 0
Truth table66%2/3
A and B
A= defined $valB= $val >= 0
ABresult
0X0
100
111
264 85 $class->logger->debug(
265 "Options $opt for vhost $vhost: $val");
266 85 $class->tsv->{$opt}->{$vhost} = $val;
267 }
268 }
269 }
270 }
271 52 ▶ if ( $conf->{vhostOptions} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"vhostOptions"}) 49 3 52
272 49 foreach my $vhost ( sort keys %{ $conf->{vhostOptions} } ) {
273 $class->tsv->{type}->{$vhost} =
274 88 $conf->{vhostOptions}->{$vhost}->{vhostType};
275 $class->tsv->{authnLevel}->{$vhost} =
276 $conf->{vhostOptions}->{$vhost}->{vhostAuthnLevel}
277 88 ▶ || $conf->{defaultAuthnLevel};
Condition100%3/3
$conf->{'vhostOptions'}{$vhost}{'vhostAuthnLevel'} || $conf->{'defaultAuthnLevel'}
l!l&&r!l&&!r
31255
MC/DC100%2/2
$conf->{'vhostOptions'}{$vhost}{'vhostAuthnLevel'} || $conf->{'defaultAuthnLevel'}
$conf->{'vhostOptions'}{$vhost}{'vhostAuthnLevel'} $conf->{'defaultAuthnLevel'}
Truth table100%3/3
A || B
A= $conf->{'vhostOptions'}{$vhost}{'vhostAuthnLevel'}B= $conf->{'defaultAuthnLevel'}
ABresult
1X1
011
000
278 $class->tsv->{serviceTokenTTL}->{$vhost} =
279 88 $conf->{vhostOptions}->{$vhost}->{vhostServiceTokenTTL};
280 $class->tsv->{accessToTrace}->{$vhost} =
281 88 $conf->{vhostOptions}->{$vhost}->{vhostAccessToTrace};
282 $class->tsv->{devOpsRulesUrl}->{$vhost} =
283 88 $conf->{vhostOptions}->{$vhost}->{vhostDevOpsRulesUrl};
284 }
285 }
286 52 return 1;
287 }
288  
289 ## @imethod protected void portalInit(hashRef args)
290 # Verify that portal variable exists. Die unless
291 # @param $args reference to the configuration hash
292 sub portalInit {
293 51 ▶ my ( $class, $conf ) = @_;
Subroutine portalInit: called CC=3 SCAR=12.6
Pod undocumented
294 51 ▶ unless ( $conf->{portal} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($conf->{"portal"}) 0 51 51
295 0 $class->logger->error("portal parameter required");
296 0 return 0;
297 }
298 51 ▶ if ( $conf->{portal} =~ /[\$\(&\|"']/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'portal'} =~ /[\$\(&\|"']/) { } 0 51 51
299 ( $class->tsv->{portal} ) =
300 0 $class->conditionSub( $conf->{portal} );
301 }
302 else {
303 51 ▶ $class->tsv->{portal} = sub { return $conf->{portal} };
Subroutine __ANON__: called CC=1 SCAR=0.0
304 }
305 51 return 1;
306 }
307  
308 ## @imethod void locationRulesInit(hashRef args)
309 # Compile rules.
310 # Rules are stored in $args->{locationRules}->{<virtualhost>} that contains
311 # regexp=>test expressions where :
312 # - regexp is used to test URIs
313 # - test contains an expression used to grant the user
314 #
315 # This function creates 2 hashRef containing :
316 # - one list of the compiled regular expressions for each virtual host
317 # - one list of the compiled functions (compiled with conditionSub()) for each
318 # virtual host
319 # @param $args reference to the configuration hash
320 sub locationRulesInit {
321 56 ▶ my ( $class, $conf, $orules ) = @_;
Subroutine locationRulesInit: called CC=23 SCAR=33.7
Pod undocumented
322  
323 56 ▶ $orules ||= $conf->{locationRules};
Condition66%2/3
$orules ||= $conf->{"locationRules"}
l!l&&r!l&&!r
5510
MC/DC0%0/2
$orules ||= $conf->{"locationRules"}
$orules $conf->{"locationRules"}
Truth table66%2/3
A ||= B
A= $orulesB= $conf->{"locationRules"}
ABresult
1X1
011
000
324 56 $class->tsv->{vhostReg} = [];
325 56 my @lastReg;
326  
327 56 foreach my $vhost ( keys %$orules ) {
328 337 my $rules = $orules->{$vhost};
329 337 ▶ if ( $vhost =~ /[\%\*]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($vhost =~ /[\%\*]/) 160 177 337
330 my $expr = join '[^\.]*', map {
331 160 my $elt = $_;
332 200 join '.*', map { quotemeta $_ } split /\*/, $elt;
333 } split /\%/, $vhost;
334 160 ▶ if ($expr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr) { } 160 0 160
335 160 push @{ $class->tsv->{vhostReg} }, [ qr/^$expr$/, $vhost ];
336 }
337 else {
338 0 push @lastReg, [ qr/.+/, $vhost ];
339 }
340 }
341 337 $class->tsv->{locationCount}->{$vhost} = 0;
342 337 $class->tsv->{locationCondition}->{$vhost} = [];
343 337 $class->tsv->{locationProtection}->{$vhost} = [];
344 337 $class->tsv->{locationRegexp}->{$vhost} = [];
345 337 $class->tsv->{locationConditionText}->{$vhost} = [];
346 337 $class->tsv->{locationAuthnLevel}->{$vhost} = [];
347  
348 337 foreach my $url ( sort keys %{$rules} ) {
349 1051 my ( $cond, $prot ) = $class->conditionSub( $rules->{$url} );
350 1051 ▶ unless ($cond) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cond) 0 1051 1051
351 0 $class->tsv->{maintenance}->{$vhost} = 1;
352 $class->logger->error(
353 "Unable to build rule '$rules->{$url}': "
354 0 . $class->tsv->{jail}->error );
355 0 next;
356 }
357  
358 1051 ▶ if ( $url eq 'default' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($url eq 'default') { } 337 714 1051
359 337 $class->tsv->{defaultCondition}->{$vhost} = $cond;
360 337 $class->tsv->{defaultProtection}->{$vhost} = $prot;
361 }
362 else {
363 714 push @{ $class->tsv->{locationCondition}->{$vhost} }, $cond;
364 714 push @{ $class->tsv->{locationProtection}->{$vhost} }, $prot;
365 714 push @{ $class->tsv->{locationRegexp}->{$vhost} }, qr/$url/;
366 714 ▶ push @{ $class->tsv->{locationAuthnLevel}->{$vhost} },
Branch: 1 branch
BranchTrueFalseTotal
$url =~ /\(\?#AuthnLevel=(-?\d+)\)/ ? : 120 594 714
367 $url =~ /\(\?#AuthnLevel=(-?\d+)\)/
368 ? $1
369 : undef;
370 714 ▶ push @{ $class->tsv->{locationConditionText}->{$vhost} },
Branch: 2 branches
BranchTrueFalseTotal
$url =~ /^\(\?#(.*?)\)/ ? : 126 588 714
$url =~ /^(.*?)##(.+)$/ ? : 0 588 588
371 $url =~ /^\(\?#(.*?)\)/ ? $1
372 : $url =~ /^(.*?)##(.+)$/ ? $2
373 : $url;
374 714 $class->tsv->{locationCount}->{$vhost}++;
375 }
376 }
377  
378 # Default policy set to 'accept'
379 337 ▶ unless ( $class->tsv->{defaultCondition}->{$vhost} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->tsv->{"defaultCondition"}{$vhost}) 0 337 337
380 0 ▶ $class->tsv->{defaultCondition}->{$vhost} = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
381 0 $class->tsv->{defaultProtection}->{$vhost} = 0;
382 }
383 }
384 40 @{ $class->tsv->{vhostReg} } = sort {
385 193 my $av = $a->[1];
386 193 my $bv = $b->[1];
387 193 ▶ return 1 if $av =~ /^\*/ and $bv !~ /^\*/;
Branch: 1 branch
BranchTrueFalseTotal
if $av =~ /^\*/ and not $bv =~ /^\*/ 34 159 193
Condition66%2/3
$av =~ /^\*/ and not $bv =~ /^\*/
!ll&&!rl&&r
159034
MC/DC50%1/2
$av =~ /^\*/ and not $bv =~ /^\*/
$av =~ /^\*/ not $bv =~ /^\*/
Truth table66%2/3
A and not(B)
A= $av =~ /^\*/B= not $bv =~ /^\*/
ABresult
0X0
100
111
388 159 ▶ return -1 if $bv =~ /^\*/ and $av !~ /^\*/;
Branch: 1 branch
BranchTrueFalseTotal
if $bv =~ /^\*/ and not $av =~ /^\*/ 57 102 159
Condition66%2/3
$bv =~ /^\*/ and not $av =~ /^\*/
!ll&&!rl&&r
102057
MC/DC50%1/2
$bv =~ /^\*/ and not $av =~ /^\*/
$bv =~ /^\*/ not $av =~ /^\*/
Truth table66%2/3
A and not(B)
A= $bv =~ /^\*/B= not $av =~ /^\*/
ABresult
0X0
100
111
389 102 ▶ return 1 if $av =~ /^\%/ and $bv !~ /^\%/;
Branch: 1 branch
BranchTrueFalseTotal
if $av =~ /^\%/ and not $bv =~ /^\%/ 0 102 102
Condition33%1/3
$av =~ /^\%/ and not $bv =~ /^\%/
!ll&&!rl&&r
10200
MC/DC0%0/2
$av =~ /^\%/ and not $bv =~ /^\%/
$av =~ /^\%/ not $bv =~ /^\%/
Truth table33%1/3
A and not(B)
A= $av =~ /^\%/B= not $bv =~ /^\%/
ABresult
0X0
100
111
390 102 ▶ return -1 if $bv =~ /^\%/ and $av !~ /^\%/;
Branch: 1 branch
BranchTrueFalseTotal
if $bv =~ /^\%/ and not $av =~ /^\%/ 0 102 102
Condition33%1/3
$bv =~ /^\%/ and not $av =~ /^\%/
!ll&&!rl&&r
10200
MC/DC0%0/2
$bv =~ /^\%/ and not $av =~ /^\%/
$bv =~ /^\%/ not $av =~ /^\%/
Truth table33%1/3
A and not(B)
A= $bv =~ /^\%/B= not $av =~ /^\%/
ABresult
0X0
100
111
391 102 ▶ return length($bv) <=> length($av) || $av cmp $bv;
Condition33%1/3
length $bv <=> length $av || $av cmp $bv
l!l&&r!l&&!r
10200
MC/DC0%0/2
length $bv <=> length $av || $av cmp $bv
length $bv <=> length $av $av cmp $bv
Truth table33%1/3
A || B
A= length $bv <=> length $avB= $av cmp $bv
ABresult
1X1
011
000
392 56 ▶ } @{ $class->tsv->{vhostReg} } if @{ $class->tsv->{vhostReg} };
Branch: 1 branch
BranchTrueFalseTotal
if @{$class->tsv->{"vhostReg"};} 40 16 56
393 56 ▶ push @{ $class->tsv->{vhostReg} }, @lastReg if @lastReg;
Branch: 1 branch
BranchTrueFalseTotal
if @lastReg 0 56 56
394 56 return 1;
395 }
396  
397 ## @imethod protected void sessionStorageInit(hashRef args)
398 # Initialize the Apache::Session::* module choosed to share user's variables
399 # and the Cache::Cache module chosen to cache sessions
400 # @param $args reference to the configuration hash
401 sub sessionStorageInit {
402 51 ▶ my ( $class, $conf ) = @_;
Subroutine sessionStorageInit: called CC=10 SCAR=35.6
Pod undocumented
403  
404 # Global session storage
405 51 ▶ unless ( $class->tsv->{sessionStorageModule} = $conf->{globalStorage} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->tsv->{"sessionStorageModule"} = $conf->{"globalStorage"}) 0 51 51
406 0 $class->logger->error("globalStorage required");
407 0 return 0;
408 }
409 24 ▶ eval "use " . $class->tsv->{sessionStorageModule};
Subroutine BEGIN: called CC=1 SCAR=0.0
410 51 ▶ die($@) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 51 51
411 51 $class->tsv->{sessionStorageOptions} = $conf->{globalStorageOptions};
412  
413 # OIDC session storage
414 51 ▶ if ( $conf->{oidcStorage} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'oidcStorage'}) { } 0 51 51
415 0 eval "use " . $conf->{oidcStorage};
416 0 ▶ die($@) if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
417 0 $class->tsv->{oidcStorageModule} = $conf->{oidcStorage};
418 0 $class->tsv->{oidcStorageOptions} = $conf->{oidcStorageOptions};
419  
420 }
421 else {
422 51 $class->tsv->{oidcStorageModule} = $conf->{globalStorage};
423 51 $class->tsv->{oidcStorageOptions} = $conf->{globalStorageOptions};
424 }
425  
426 # Local session storage
427 51 ▶ if ( $conf->{localSessionStorage} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"localSessionStorage"}) 0 51 51
428 0 $class->tsv->{sessionCacheModule} = $conf->{localSessionStorage};
429 $class->tsv->{sessionCacheOptions} =
430 0 $conf->{localSessionStorageOptions};
431 0 ▶ $class->tsv->{sessionCacheOptions}->{default_expires_in} ||= 600;
Condition0%0/2
$class->tsv->{"sessionCacheOptions"}{"default_expires_in"} ||= 600
l!l
00
MC/DC0%0/1
$class->tsv->{"sessionCacheOptions"}{"default_expires_in"} ||= 600
$class->tsv->{"sessionCacheOptions"}{"default_expires_in"}
Truth table0%0/2
A
A= $class->tsv->{"sessionCacheOptions"}{"default_expires_in"}
Aresult
11
00
432  
433 0 ▶ if ( $conf->{status} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"status"}) 0 0 0
434 0 my $params = "";
435 0 ▶ if ( $class->tsv->{sessionCacheModule} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->tsv->{"sessionCacheModule"}) 0 0 0
436 $params = $class->tsv->{sessionCacheModule} . ',{' . join(
437 ',',
438 map {
439 "$_ => '"
440 0 . $class->tsv->{sessionCacheOptions}->{$_} . "'"
441 }
442 0 ▶ keys %{ $class->tsv->{sessionCacheOptions} // {} }
Condition0%0/2
$class->tsv->{"sessionCacheOptions"} // {}
l!l
00
MC/DC0%0/1
$class->tsv->{"sessionCacheOptions"} // {}
$class->tsv->{"sessionCacheOptions"}
Truth table0%0/2
A
A= $class->tsv->{"sessionCacheOptions"}
Aresult
11
00
443 ) . '}';
444 }
445 }
446 }
447 51 return 1;
448 }
449  
450 ## @imethod void headersInit(hashRef args)
451 # Create the subroutines used to insert headers into the HTTP request.
452 # @param $args reference to the configuration hash
453 sub headersInit {
454 56 ▶ my ( $class, $conf, $headers ) = @_;
Subroutine headersInit: called CC=8 SCAR=21.7
Pod undocumented
455 56 ▶ $headers ||= $conf->{exportedHeaders};
Condition100%3/3
$headers ||= $conf->{"exportedHeaders"}
l!l&&r!l&&!r
5483
MC/DC100%2/2
$headers ||= $conf->{"exportedHeaders"}
$headers $conf->{"exportedHeaders"}
Truth table100%3/3
A ||= B
A= $headersB= $conf->{"exportedHeaders"}
ABresult
1X1
011
000
456  
457 # Creation of the subroutine which will generate headers
458 56 foreach my $vhost ( keys %{$headers} ) {
459 108 ▶ unless ($vhost) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($vhost) 0 108 108
460 0 $class->logger->warn('Empty vhost in headers, skipping');
461 0 next;
462 }
463 108 ▶ $headers->{$vhost} ||= {};
Condition50%1/2
$headers->{$vhost} ||= {}
l!l
1080
MC/DC0%0/1
$headers->{$vhost} ||= {}
$headers->{$vhost}
Truth table50%1/2
A
A= $headers->{$vhost}
Aresult
11
00
464 108 my %headers = %{ $headers->{$vhost} };
465 108 $class->tsv->{headerList}->{$vhost} = [ keys %headers ];
466 108 my $sub = '';
467 108 foreach ( keys %headers ) {
468 134 ▶ $headers{$_} ||= "''";
Condition100%2/2
$headers{$_} ||= "''"
l!l
1286
MC/DC100%1/1
$headers{$_} ||= "''"
$headers{$_}
Truth table100%2/2
A
A= $headers{$_}
Aresult
11
00
469 134 my $val = $class->substitute( $headers{$_} ) . " // ''";
470 134 $sub .= "('$_' => $val),";
471 }
472  
473 108 ▶ unless ( $class->tsv->{forgeHeaders}->{$vhost} =
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->tsv->{"forgeHeaders"}{$vhost} = $class->buildSub($sub)) 0 108 108
474 $class->buildSub($sub) )
475 {
476 0 $class->tsv->{maintenance}->{$vhost} = 1;
477 $class->logger->error( "$class Unable to forge $vhost headers: "
478 0 . $class->tsv->{jail}->error );
479 }
480 }
481 56 return 1;
482 }
483  
484 ## @imethod protected void postUrlInit()
485 # Prepare methods to post form attributes
486 sub postUrlInit {
487 51 ▶ my ( $class, $conf ) = @_;
Subroutine postUrlInit: called CC=9 SCAR=38.2
Pod undocumented
488 51 ▶ return unless ( $conf->{post} );
Branch: 1 branch
BranchTrueFalseTotal
unless $conf->{"post"} 48 3 51
489  
490 # Browse all vhost
491 3 foreach my $vhost ( keys %{ $conf->{post} } ) {
492  
493 # Browse all POST URI
494 0 ▶ foreach my $url ( keys %{ $conf->{post}->{$vhost} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
$conf->{"post"}{$vhost} or {} 0 0 0
495 0 my $d = $conf->{post}->{$vhost}->{$url};
496 0 $class->logger->debug("Compiling POST data for $url");
497  
498 # Where to POST
499 0 ▶ $d->{target} ||= $url;
Condition0%0/3
$d->{"target"} ||= $url
l!l&&r!l&&!r
000
MC/DC0%0/2
$d->{"target"} ||= $url
$d->{"target"} $url
Truth table0%0/3
A ||= B
A= $d->{"target"}B= $url
ABresult
1X1
011
000
500 0 my $sub;
501 0 ▶ $d->{vars} ||= [];
Condition0%0/2
$d->{"vars"} ||= []
l!l
00
MC/DC0%0/1
$d->{"vars"} ||= []
$d->{"vars"}
Truth table0%0/2
A
A= $d->{"vars"}
Aresult
11
00
502 0 foreach my $input ( @{ delete $d->{vars} } ) {
503 0 $sub .=
504 "'$input->[0]' => " . $class->substitute( $input->[1] ) . ",";
505 }
506 0 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->tsv->{"inputPostData"}{$vhost}{delete $d->{"target"}} = $class->tsv->{"outputPostData"}{$vhost}{$url} = $class->buildSub($sub)) 0 0 0
507 $class->tsv->{inputPostData}->{$vhost}->{ delete $d->{target} }
508 = $class->tsv->{outputPostData}->{$vhost}->{$url} =
509 $class->buildSub($sub) )
510 {
511 0 $class->tsv->{maintenance}->{$vhost} = 1;
512 $class->logger->error( "$class: Unable to build post data: "
513 0 . $class->tsv->{jail}->error );
514 }
515  
516 0 $class->tsv->{postFormParams}->{$vhost}->{$url} = $d;
517 }
518 }
519 3 return 1;
520 }
521  
522 ## @imethod protected codeRef conditionSub(string cond)
523 # Returns a compiled function used to grant users (used by
524 # locationRulesInit(). The second value returned is a non null
525 # constant if URL is not protected (by "unprotect" or "skip"), 0 else.
526 # @param $cond The boolean expression to use
527 # @param $mainClass optional
528 # @return array (ref(sub), int)
529 sub conditionSub {
530 1051 ▶ my ( $class, $cond ) = @_;
Subroutine conditionSub: called CC=11 SCAR=26.4
Pod undocumented
531 1051 $cond =~ s/\(\?#(\d+)\)$//;
532 1051 ▶ my ( $OK, $NOK ) = ( sub { 1 }, sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
533  
534 # Simple cases : accept and deny
535 1051 ▶ return ( $OK, 0 )
Branch: 1 branch
BranchTrueFalseTotal
if $cond =~ /^accept$/i 381 670 1051
536 if ( $cond =~ /^accept$/i );
537 670 ▶ return ( $NOK, 0 )
Branch: 1 branch
BranchTrueFalseTotal
if $cond =~ /^deny$/i 133 537 670
538 if ( $cond =~ /^deny$/i );
539  
540 # Cases unprotect and skip : 2nd value is 1 or 2
541 537 ▶ return ( $OK, UNPROTECT )
Branch: 1 branch
BranchTrueFalseTotal
if $cond =~ /^unprotect$/i 0 537 537
542 if ( $cond =~ /^unprotect$/i );
543 537 ▶ return ( $OK, SKIP )
Branch: 1 branch
BranchTrueFalseTotal
if $cond =~ /^skip$/i 40 497 537
544 if ( $cond =~ /^skip$/i );
545  
546 # Case logout
547 497 ▶ if ( $cond =~ /^logout(?:_sso)?(?:\s+(.*))?$/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond =~ /^logout(?:_sso)?(?:\s+(.*))?$/i) 80 417 497
548 80 my $url = $1;
549 return (
550 $url
551 ? (
552 sub {
553 0 ▶ my ( $req, $session ) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
554 0 $session->{_logout} = $url;
555 0 return 0;
556 },
557 0
558 )
559 : (
560 sub {
561 0 ▶ my ( $req, $session ) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
562 0 $session->{_logout} = $class->tsv->{portal}->($req);
563 0 return 0;
564 },
565 80 ▶ 0
Branch: 1 branch
BranchTrueFalseTotal
$url ? : 0 80 80
566 )
567 );
568 }
569  
570 # logout_app
571 417 ▶ if ( $cond =~ /^logout_app(?:\s+(.*))?$/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cond =~ /^logout_app(?:\s+(.*))?$/i) { } 0 417 417
elsif ($cond =~ /^logout_app_sso(?:\s+(.*))?$/i) { } 0 417 417
572 0 return $class->logout_app($1);
573 }
574  
575 # logout_app_sso
576 elsif ( $cond =~ /^logout_app_sso(?:\s+(.*))?$/i ) {
577 0 return $class->logout_app_sso($1);
578 }
579  
580 417 my $mayskip = 0;
581 417 ▶ $mayskip = MAYSKIP if $cond =~ /\bskip\b/;
Branch: 1 branch
BranchTrueFalseTotal
if $cond =~ /\bskip\b/ 40 377 417
582  
583 # Replace some strings in condition
584 417 $cond = $class->substitute($cond);
585 417 my $sub;
586 417 ▶ unless ( $sub = $class->buildSub($cond) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sub = $class->buildSub($cond)) 0 417 417
587 $class->logger->error( "$class: Unable to build condition ($cond): "
588 0 . $class->tsv->{jail}->error );
589 }
590  
591 # Return sub and protected flag
592 417 return ( $sub, $mayskip );
593 }
594  
595 ## These methods should be overriden in subclasses
596 sub logout_app {
597 0 ▶ return ( sub { 1 }, 0 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine logout_app: not called CC=1 SCAR=6.9
Pod undocumented
598 }
599  
600 sub logout_app_sso {
601 0 ▶ return ( sub { 1 }, 0 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine logout_app_sso: not called CC=1 SCAR=6.9
Pod undocumented
602 }
603  
604 ## @method arrayref aliasInit
605 # @param options vhostOptions configuration item
606 # @return arrayref of vhost and aliases
607 sub aliasInit {
608 51 ▶ my ( $class, $conf ) = @_;
Subroutine aliasInit: called CC=5 SCAR=17.5
Pod undocumented
609  
610 51 delete $class->tsv->{vhostAlias};
611 51 ▶ foreach my $vhost ( keys %{ $conf->{vhostOptions} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
$conf->{"vhostOptions"} or {} 3 48 51
612 87 ▶ if ( my $aliases = $conf->{vhostOptions}->{$vhost}->{vhostAliases} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $aliases = $conf->{"vhostOptions"}{$vhost}{"vhostAliases"}) 0 87 87
613 0 foreach ( split /\s+/, $aliases ) {
614 0 $class->tsv->{vhostAlias}->{$_} = $vhost;
615 0 $class->logger->debug("Registering $_ as alias of $vhost");
616 }
617 }
618 }
619 51 return 1;
620 }
621  
622 # TODO: support wildcards in aliases
623  
624 ## @method arrayref oauth2Init
625 # @param options vhostOptions configuration item
626 # @return arrayref of vhost and aliases
627 sub oauth2Init {
628 51 ▶ my ( $class, $conf ) = @_;
Subroutine oauth2Init: called CC=5 SCAR=16.7
Pod undocumented
629  
630 51 ▶ foreach my $rp ( keys %{ $conf->{oidcRPMetaDataOptions} || {} } ) {
Branch: 1 branch
BranchTrueFalseTotal
$conf->{"oidcRPMetaDataOptions"} or {} 49 2 51
631 4 ▶ if ( $conf->{oidcRPMetaDataOptions}->{$rp}
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"oidcRPMetaDataOptions"}{$rp} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsClientID"}) 4 0 4
Condition33%1/3
$conf->{"oidcRPMetaDataOptions"}{$rp} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsClientID"}
!ll&&!rl&&r
004
MC/DC0%0/2
$conf->{"oidcRPMetaDataOptions"}{$rp} and $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsClientID"}
$conf->{"oidcRPMetaDataOptions"}{$rp} $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsClientID"}
Truth table33%1/3
A and B
A= $conf->{"oidcRPMetaDataOptions"}{$rp}B= $conf->{"oidcRPMetaDataOptions"}{$rp}{"oidcRPMetaDataOptionsClientID"}
ABresult
0X0
100
111
632 and $conf->{oidcRPMetaDataOptions}->{$rp}
633 ->{oidcRPMetaDataOptionsClientID} )
634 {
635 $class->tsv->{oauth2Options}->{$rp}->{clientId} =
636 $conf->{oidcRPMetaDataOptions}->{$rp}
637 4 ->{oidcRPMetaDataOptionsClientID};
638 }
639 }
640 51 return 1;
641 }
642  
643 sub msgBrokerInit {
644 51 ▶ my ( $class, $conf ) = @_;
Subroutine msgBrokerInit: called CC=3 SCAR=11.1
Pod undocumented
645  
646 51 ▶ my $brokerClass = $conf->{messageBroker} || '::NoBroker';
Condition50%1/2
$conf->{'messageBroker'} || '::NoBroker'
l!l
051
MC/DC0%0/1
$conf->{'messageBroker'} || '::NoBroker'
$conf->{'messageBroker'}
Truth table50%1/2
A
A= $conf->{'messageBroker'}
Aresult
11
00
647 51 $brokerClass =~ s/^::/Lemonldap::NG::Common::MessageBroker::/;
648 51 eval "require $brokerClass";
649 51 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 51 51
650 51 $class->tsv->{msgBrokerReader} = $brokerClass->new( $conf, $class->logger );
651 51 $class->tsv->{msgBrokerReader}->subscribe( $conf->{eventQueueName} );
652 51 $class->tsv->{msgBrokerWriter} = $brokerClass->new( $conf, $class->logger );
653 }
654  
655 sub substitute {
656 578 ▶ my ( $class, $expr ) = @_;
Subroutine substitute: called CC=2 SCAR=6.9
Pod undocumented
657 578 ▶ $expr //= '';
Condition100%2/2
$expr //= ""
l!l
5762
MC/DC100%1/1
$expr //= ""
$expr
Truth table100%2/2
A
A= $expr
Aresult
11
00
658  
659 # substitute special vars, just for retro-compatibility
660 578 $expr =~ s/\$date\b/&date/sg;
661 578 $expr =~ s/\$vhost\b/\$ENV{HTTP_HOST}/sg;
662 578 $expr =~ s/\$ip\b/\$ENV{REMOTE_ADDR}/sg;
663  
664 # substitute vars with session data, excepts special vars $_ and $\d+
665 578 $expr =~ s/\$(?!(?:ENV|env)\b)(_\w+|[a-zA-Z]\w*)/\$s->{$1}/sg;
666 578 $expr =~ s/\$ENV\{/\$r->{env}->\{/g;
667 578 $expr =~ s/\$env->\{/\$r->{env}->\{/g;
668 578 $expr =~ s/\bskip\b/q\{999_SKIP\}/g;
669  
670 # handle inGroup
671 578 $expr =~ s/\binGroup\(([^)]*)\)/listMatch(\$s->{'hGroups'},$1,1)/g;
672  
673 # handle has2f
674 578 $expr =~ s/\bhas2f\(([^),]*)\)/has2f_internal(\$s,$1)/g;
675  
676 # handle inSubnet
677 578 $expr =~ s/\binSubnet\(([^)]*)\)/ipInSubnet(\$r->{env}->{REMOTE_ADDR},$1)/g;
678  
679 # handle inSubnet
680 578 $expr =~
681 s/\binDomain\(([^)]*)\)/inDomain_internal(\$r->{env}->{HTTP_HOST},$1)/g;
682  
683 578 return $expr;
684 }
685  
686 sub buildSub {
687 552 ▶ my ( $class, $val ) = @_;
Subroutine buildSub: called CC=2 SCAR=7.4
Pod undocumented
688 my $res =
689 $class->tsv->{jail}
690 552 ->jail_reval("sub{my (\$r,\$s)=\@_; local *_;return($val)}");
691 552 ▶ unless ($res) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($res) 0 552 552
692 0 $class->logger->error( $class->tsv->{jail}->error );
693 }
694 552 return $res;
695 }
696  
697 27 1;
« Lemonldap/NG/Handler/ApacheMP2.pm ↑ Summary Lemonldap/NG/Handler/Main/Run.pm »