blib/lib/Linux/Shadow.pm

filter: Statementstmt 74.1% 43 / 58 Branchbran 25.0% 2 / 8 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 71.4% 10 / 14 Podpod 75.0% 3 / 4 totaltotal 56.8% 58 / 102 CC 9 SCAR 29.4
CC
9
Cov
58%
set_pwent_expire
56.0
AUTOLOAD
3.0
getpwnam
2.0
CRAP 18.9
↑ Summary Shadow.xs »
1 package Linux::Shadow;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 require Exporter;
10 1 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 our %EXPORT_TAGS = (
15 'all' => [
16 qw(
17 SHADOW
18 getspnam
19 getspent
20 setspent
21 endspent
22 )
23 ],
24 'getpw' => [
25 qw(
26 getpwnam
27 getpwuid
28 getpwent
29 )
30 ]
31 );
32  
33 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} }, @{ $EXPORT_TAGS{'getpw'} } );
34  
35 1 our @EXPORT = qw(
36 getspnam
37 getspent
38 setspent
39 endspent
40 );
41  
42 1 our $VERSION = '0.05';
43  
44 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.1
45 1 my $constname;
46 1 our $AUTOLOAD;
47 1 ( $constname = $AUTOLOAD ) =~ s/.*:://;
48 1 ▶ croak '&Linux::Shadow::constant not defined' if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 1 1
49 1 my ( $error, $val ) = constant($constname);
50 0 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 1 1
51 {
52 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
53 1 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: called CC=1 SCAR=0.0
54 }
55 1 goto &$AUTOLOAD;
56 }
57  
58 1 require XSLoader;
59 1 XSLoader::load( 'Linux::Shadow', $VERSION );
60  
61 0 ▶sub getpwnam {
Subroutine getpwnam: not called CC=1 SCAR=6.9
Pod documented
62  
63 0 my ($name) = @_;
64 0 my @pwent = CORE::getpwnam($name);
65 0 return set_pwent_expire(@pwent);
66  
67 }
68  
69 0 ▶sub getpwuid {
Subroutine getpwuid: not called CC=1 SCAR=6.9
Pod documented
70  
71 0 my ($uid) = @_;
72 0 my @pwent = CORE::getpwuid($uid);
73 0 return set_pwent_expire(@pwent);
74  
75 }
76  
77 0 ▶sub getpwent {
Subroutine getpwent: not called CC=1 SCAR=6.9
Pod documented
78  
79 0 my @pwent = CORE::getpwent();
80 0 return set_pwent_expire(@pwent);
81  
82 }
83  
84 0 ▶sub set_pwent_expire {
Subroutine set_pwent_expire: not called CC=7 SCAR=40.3
Pod undocumented
85  
86 0 my @pwent = @_;
87  
88 0 ▶ if ( @pwent && $pwent[0] && !defined $pwent[9] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@pwent and $pwent[0] and not defined $pwent[9]) 0 0 0
Condition0%0/6
@pwent and $pwent[0] and not defined $pwent[9]
!ll&&!rl&&r
000
@pwent and $pwent[0]
!ll&&!rl&&r
000
MC/DC0%0/3
@pwent and $pwent[0] and not defined $pwent[9]
@pwent $pwent[0] not defined $pwent[9]
Truth table0%0/4
A and B and not(C)
A= @pwentB= $pwent[0]C= not defined $pwent[9]
ABCresult
0XX0
10X0
1100
1111
89  
90 0 my @shadow = getspnam( $pwent[0] );
91 0 ▶ if ( @shadow && ( $shadow[0] eq $pwent[0] ) && defined $shadow[7] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@shadow and $shadow[0] eq $pwent[0] and defined $shadow[7]) 0 0 0
Condition0%0/6
@shadow and $shadow[0] eq $pwent[0] and defined $shadow[7]
!ll&&!rl&&r
000
@shadow and $shadow[0] eq $pwent[0]
!ll&&!rl&&r
000
MC/DC0%0/3
@shadow and $shadow[0] eq $pwent[0] and defined $shadow[7]
@shadow $shadow[0] eq $pwent[0] defined $shadow[7]
Truth table0%0/4
A and B and C
A= @shadowB= $shadow[0] eq $pwent[0]C= defined $shadow[7]
ABCresult
0XX0
10X0
1100
1111
92 0 $pwent[9] = $shadow[7];
93 }
94  
95 }
96  
97 0 return @pwent;
98  
99 }
100  
101 1 1;
102 __END__
↑ Summary Shadow.xs »