DRI/Protocol/RRI/Session.pm

filter: Statementstmt 36.1% 13 / 36 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 25.3% 17 / 67 CC 7 SCAR 33.6
CC
7
Cov
25%
login
56.0
register_commands
2.0
hello
2.0
CRAP 28.7
« DRI/Data/Contact/ARNES.pm ↑ Summary DRI/Protocol/EPP/Extensions/Nominet/Contact.pm »
1 ## Domain Registry Interface, RRI Session commands (DENIC-11)
2 ##
3 ## Copyright (c) 2007,2012 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. All rights reserved.
4 ## (c) 2013 Michael Holloway <michael@thedarkwinter.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 ####################################################################################################
15  
16 package Net::DRI::Protocol::RRI::Session;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 =pod
25  
26 =head1 NAME
27  
28 Net::DRI::Protocol::RRI::Session - RRI Session commands (DENIC-11) for Net::DRI
29  
30 =head1 DESCRIPTION
31  
32 Please see the README file for details.
33  
34 =head1 SUPPORT
35  
36 For now, support questions should be sent to:
37  
38 E<lt>tonnerre.lombard@sygroup.chE<gt>
39  
40 Please also see the SUPPORT file in the distribution.
41  
42 =head1 SEE ALSO
43  
44 E<lt>http://oss.bsdprojects.net/projects/netdri/E<gt>
45  
46 =head1 AUTHOR
47  
48 Tonnerre Lombard, E<lt>tonnerre.lombard@sygroup.chE<gt>
49  
50 =head1 COPYRIGHT
51  
52 Copyright (c) 2007,2013 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
53 All rights reserved.
54  
55 This program is free software; you can redistribute it and/or modify
56 it under the terms of the GNU General Public License as published by
57 the Free Software Foundation; either version 2 of the License, or
58 (at your option) any later version.
59  
60 See the LICENSE file that comes with this distribution for more details.
61  
62 =cut
63  
64 ####################################################################################################
65  
66 sub register_commands
67 {
68 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my %tmp=(
70 noop => [ \&hello ],
71 logout => [ \&logout ],
72 login => [ \&login ],
73 );
74  
75 0 return { 'session' => \%tmp };
76 }
77  
78 sub hello ## should trigger a greeting from server, allowed at any time
79 {
80 0 ▶ my ($rri)=@_;
Subroutine hello: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my $mes=$rri->message();
82 0 $mes->command(['hello']);
83 0 return;
84 }
85  
86 sub logout
87 {
88 0 ▶ my ($rri)=@_;
Subroutine logout: not called CC=1 SCAR=6.9
Pod undocumented
89 0 my $mes=$rri->message();
90 0 $mes->command(['logout']);
91 0 return;
92 }
93  
94 sub login
95 {
96 0 ▶ my ($rri,$id,$pass,$newpass,$opts)=@_;
Subroutine login: not called CC=7 SCAR=40.3
Pod undocumented
97 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('login & password') unless (defined($id) && $id && defined($pass) && $pass);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id and $id and defined $pass and $pass 0 0 0
Condition0%0/9
defined $id and $id and defined $pass and $pass
!ll&&!rl&&r
000
defined $id and $id and defined $pass
!ll&&!rl&&r
000
defined $id and $id
!ll&&!rl&&r
000
MC/DC0%0/4
defined $id and $id and defined $pass and $pass
defined $id $id defined $pass $pass
Truth table0%0/5
A and B and C and D
A= defined $idB= $idC= defined $passD= $pass
ABCDresult
0XXX0
10XX0
110X0
11100
11111
98  
99 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('login') unless Net::DRI::Util::xml_is_token($id,3,32);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($id, 3, 32) 0 0 0
100 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('password') unless Net::DRI::Util::xml_is_token($pass,6,32);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($pass, 6, 32) 0 0 0
101  
102 0 my $mes=$rri->message();
103 0 $mes->command(['login']);
104 0 my @d;
105 0 push @d,['user',$id];
106 0 push @d,['password',$pass];
107 0 $mes->cltrid(undef); # login fails with this
108 0 $mes->command_body(\@d);
109 0 return;
110 }
111  
112 ####################################################################################################
113 1 1;
« DRI/Data/Contact/ARNES.pm ↑ Summary DRI/Protocol/EPP/Extensions/Nominet/Contact.pm »