EPP/Test/VerisignCore.pm

filter: Statementstmt 82.7% 731 / 883 Branchbran 68.0% 328 / 482 Conditioncond 54.3% 112 / 206 MC/DCmcdc 27.9% 31 / 111 Subroutinesub 91.6% 33 / 36 Podpod 0.0% 0 / 20 totaltotal 71.0% 1235 / 1738 SCAR 77.9
CC
354
Cov
75%
domain_update
115.6
add_5d
89.1
domain_renew
49.5
CRAP 2422.5
« EPP/RRPProxy.pm ↑ Summary EPP/CoreNic.pm »
1 package IO::EPP::Test::VerisignCore;
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 IO::EPP::Test::VerisignCore
8  
9 =head1 SYNOPSIS
10  
11 Call IO::EPP::Verisign with parameter "test_mode=1"
12  
13 =head1 DESCRIPTION
14  
15 Module for testing IO::EPP::Verisign,
16 emulates answers of Verisign Core Server
17  
18 =head1 AUTHORS
19  
20 Vadim Likhota <vadiml@cpan.org>
21  
22 =cut
23  
24 1 ▶use Digest::MD5 qw(md5 md5_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 ▶use IO::EPP::Verisign;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use IO::EPP::Test::Server;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 1 ▶no utf8; # !!!
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 sub req {
35 166 ▶ my ( $obj, $out_data, $info ) = @_;
Subroutine req: called CC=31 SCAR=37.2
Pod undocumented
36  
37 166 my $in_data;
38  
39 166 ▶ if ( !$out_data or $out_data =~ m|<hello[^<>]+/>| ) {
Branch: 15 branches
BranchTrueFalseTotal
if (not $out_data or $out_data =~ m[<hello[^<>]+/>]) { } 29 137 166
elsif ($out_data and $out_data =~ /<login>/) { } 28 109 137
elsif ($out_data and $out_data =~ /<contact:/) { } 0 109 109
elsif ($out_data and $out_data =~ /<host:check/) { } 1 108 109
elsif ($out_data and $out_data =~ /<host:create/) { } 9 99 108
elsif ($out_data and $out_data =~ /<host:info/) { } 4 95 99
elsif ($out_data and $out_data =~ /<host:update/) { } 13 82 95
elsif ($out_data and $out_data =~ /<host:delete/) { } 3 79 82
elsif ($out_data and $out_data =~ /<domain:check/) { } 1 78 79
elsif ($out_data and $out_data =~ /<domain:create/) { } 9 69 78
elsif ($out_data and $out_data =~ /<domain:info/) { } 10 59 69
elsif ($out_data and $out_data =~ /<domain:renew/) { } 6 53 59
elsif ($out_data and $out_data =~ /<domain:update/) { } 19 34 53
elsif ($out_data and $out_data =~ /<domain:delete/) { } 6 28 34
elsif ($out_data and $out_data =~ m[<logout/>]) { } 28 0 28
Condition100%3/3
not $out_data or $out_data =~ m[<hello[^<>]+/>]
l!l&&r!l&&!r
281137
MC/DC100%2/2
not $out_data or $out_data =~ m[<hello[^<>]+/>]
not $out_data $out_data =~ m[<hello[^<>]+/>]
Truth table100%3/3
not(A) or B
A= not $out_dataB= $out_data =~ m[<hello[^<>]+/>]
ABresult
1X1
011
000
40 29 $in_data = hello( $out_data );
41 }
42 ▶ elsif ( $out_data and $out_data =~ m|<login>| ) {
Condition66%2/3
$out_data and $out_data =~ /<login>/
!ll&&!rl&&r
010928
MC/DC50%1/2
$out_data and $out_data =~ /<login>/
$out_data $out_data =~ /<login>/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<login>/
ABresult
0X0
100
111
43 28 $in_data = login( $out_data );
44 }
45 ▶ elsif ( $out_data and $out_data =~ m|<contact:| ) {
Condition33%1/3
$out_data and $out_data =~ /<contact:/
!ll&&!rl&&r
01090
MC/DC0%0/2
$out_data and $out_data =~ /<contact:/
$out_data $out_data =~ /<contact:/
Truth table33%1/3
A and B
A= $out_dataB= $out_data =~ /<contact:/
ABresult
0X0
100
111
46 0 $in_data = contacts();
47 }
48 ▶ elsif ( $out_data and $out_data =~ m|<host:check| ) {
Condition66%2/3
$out_data and $out_data =~ /<host:check/
!ll&&!rl&&r
01081
MC/DC50%1/2
$out_data and $out_data =~ /<host:check/
$out_data $out_data =~ /<host:check/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<host:check/
ABresult
0X0
100
111
49 1 $in_data = host_check( $obj, $out_data );
50 }
51 ▶ elsif ( $out_data and $out_data =~ m|<host:create| ) {
Condition66%2/3
$out_data and $out_data =~ /<host:create/
!ll&&!rl&&r
0999
MC/DC50%1/2
$out_data and $out_data =~ /<host:create/
$out_data $out_data =~ /<host:create/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<host:create/
ABresult
0X0
100
111
52 9 $in_data = host_create( $obj, $out_data );
53 }
54 ▶ elsif ( $out_data and $out_data =~ m|<host:info| ) {
Condition66%2/3
$out_data and $out_data =~ /<host:info/
!ll&&!rl&&r
0954
MC/DC50%1/2
$out_data and $out_data =~ /<host:info/
$out_data $out_data =~ /<host:info/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<host:info/
ABresult
0X0
100
111
55 4 $in_data = host_info( $obj, $out_data );
56 }
57 ▶ elsif ( $out_data and $out_data =~ m|<host:update| ) {
Condition66%2/3
$out_data and $out_data =~ /<host:update/
!ll&&!rl&&r
08213
MC/DC50%1/2
$out_data and $out_data =~ /<host:update/
$out_data $out_data =~ /<host:update/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<host:update/
ABresult
0X0
100
111
58 13 $in_data = host_update( $obj, $out_data );
59 }
60 ▶ elsif ( $out_data and $out_data =~ m|<host:delete| ) {
Condition66%2/3
$out_data and $out_data =~ /<host:delete/
!ll&&!rl&&r
0793
MC/DC50%1/2
$out_data and $out_data =~ /<host:delete/
$out_data $out_data =~ /<host:delete/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<host:delete/
ABresult
0X0
100
111
61 3 $in_data = host_delete( $obj, $out_data );
62 }
63 ▶ elsif ( $out_data and $out_data =~ m|<domain:check| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:check/
!ll&&!rl&&r
0781
MC/DC50%1/2
$out_data and $out_data =~ /<domain:check/
$out_data $out_data =~ /<domain:check/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:check/
ABresult
0X0
100
111
64 1 $in_data = domain_check( $obj, $out_data );
65 }
66 ▶ elsif ( $out_data and $out_data =~ m|<domain:create| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:create/
!ll&&!rl&&r
0699
MC/DC50%1/2
$out_data and $out_data =~ /<domain:create/
$out_data $out_data =~ /<domain:create/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:create/
ABresult
0X0
100
111
67 9 $in_data = domain_create( $obj, $out_data );
68 }
69 ▶ elsif ( $out_data and $out_data =~ m|<domain:info| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:info/
!ll&&!rl&&r
05910
MC/DC50%1/2
$out_data and $out_data =~ /<domain:info/
$out_data $out_data =~ /<domain:info/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:info/
ABresult
0X0
100
111
70 10 $in_data = domain_info( $obj, $out_data );
71 }
72 ▶ elsif ( $out_data and $out_data =~ m|<domain:renew| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:renew/
!ll&&!rl&&r
0536
MC/DC50%1/2
$out_data and $out_data =~ /<domain:renew/
$out_data $out_data =~ /<domain:renew/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:renew/
ABresult
0X0
100
111
73 6 $in_data = domain_renew( $obj, $out_data );
74 }
75 ▶ elsif ( $out_data and $out_data =~ m|<domain:update| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:update/
!ll&&!rl&&r
03419
MC/DC50%1/2
$out_data and $out_data =~ /<domain:update/
$out_data $out_data =~ /<domain:update/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:update/
ABresult
0X0
100
111
76 19 $in_data = domain_update( $obj, $out_data );
77 }
78 ▶ elsif ( $out_data and $out_data =~ m|<domain:delete| ) {
Condition66%2/3
$out_data and $out_data =~ /<domain:delete/
!ll&&!rl&&r
0286
MC/DC50%1/2
$out_data and $out_data =~ /<domain:delete/
$out_data $out_data =~ /<domain:delete/
Truth table66%2/3
A and B
A= $out_dataB= $out_data =~ /<domain:delete/
ABresult
0X0
100
111
79 6 $in_data = domain_delete( $obj, $out_data );
80 }
81 ▶ elsif ( $out_data and $out_data =~ m|<logout/>| ) {
Condition33%1/3
$out_data and $out_data =~ m[<logout/>]
!ll&&!rl&&r
0028
MC/DC0%0/2
$out_data and $out_data =~ m[<logout/>]
$out_data $out_data =~ m[<logout/>]
Truth table33%1/3
A and B
A= $out_dataB= $out_data =~ m[<logout/>]
ABresult
0X0
100
111
82 28 $in_data = logout( $out_data );
83 }
84 else {
85 0 print "FAIL $info!\n";
86 0 die $out_data;
87 }
88  
89 166 return $in_data;
90 }
91  
92  
93 1 our %statuses = (
94 clientHold => '+',
95 clientRenewProhibited => 'renewed',
96 clientDeleteProhibited => 'deleted',
97 clientUpdateProhibited => 'updated',
98 clientTransferProhibited => 'transfered',
99 serverHold => '+',
100 serverRenewProhibited => 'renewed',
101 serverDeleteProhibited => 'deleted',
102 serverUpdateProhibited => 'updated',
103 serverTransferProhibited => 'transfered',
104 );
105  
106  
107 sub get_date {
108 76 ▶ my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime(time);
Subroutine get_date: called CC=1 SCAR=0.0
Pod undocumented
109  
110 76 $year += 1900;
111 76 $mon += 1;
112  
113 76 my $dt1 = sprintf( '%0004d-%02d-%02dT%02d:%02d:%02d.0Z', $year, $mon, $mday, $hour, $min, $sec );
114  
115 76 return $dt1;
116 }
117  
118 sub add_5d {
119 28 ▶ my ( $dt ) = @_;
Subroutine add_5d: called CC=23 SCAR=44.9
Pod undocumented
120  
121 28 my ( $y, $m, $d ) = $dt =~ /^(\d{4})-(\d{2})-(\d{2})/;
122  
123 28 $d += 5;
124 28 $m += 0;
125  
126 28 ▶ if ( $m == 1 || $m == 3 || $m == 5 || $m == 7 || $m == 8 || $m == 10 || $m == 12 and $d > 31 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m == 1 || $m == 3 || $m == 5 || $m == 7 || $m == 8 || $m == 10 || $m == 12 and $d > 31) 23 5 28
Condition47%10/21
$m == 1 || $m == 3 || $m == 5 || $m == 7 || $m == 8 || $m == 10 || $m == 12 and $d > 31
!ll&&!rl&&r
0523
$m == 1 or $m == 3 or $m == 5 or $m == 7 or $m == 8 or $m == 10 or $m == 12
l!l&&r!l&&!r
2800
$m == 1 or $m == 3 or $m == 5 or $m == 7 or $m == 8 or $m == 10
l!l&&r!l&&!r
2800
$m == 1 or $m == 3 or $m == 5 or $m == 7 or $m == 8
l!l&&r!l&&!r
2350
$m == 1 or $m == 3 or $m == 5 or $m == 7
l!l&&r!l&&!r
0235
$m == 1 or $m == 3 or $m == 5
l!l&&r!l&&!r
0028
$m == 1 or $m == 3
l!l&&r!l&&!r
0028
MC/DC0%0/8
$m == 1 || $m == 3 || $m == 5 || $m == 7 || $m == 8 || $m == 10 || $m == 12 and $d > 31
$m == 1 $m == 3 $m == 5 $m == 7 $m == 8 $m == 10 $m == 12 $d > 31
Truth table13%2/15
A or B or C or D or E or F or G and H
A= $m == 1B= $m == 3C= $m == 5D= $m == 7E= $m == 8F= $m == 10G= $m == 12H= $d > 31
ABCDEFGHresult
0000000X0
1XXXXXX00
01XXXXX00
001XXXX00
0001XXX00
00001XX00
000001X00
000000100
1XXXXXX11
01XXXXX11
001XXXX11
0001XXX11
00001XX11
000001X11
000000111
127 23 $d -= 31;
128 23 $m++;
129 }
130  
131 28 ▶ if ( $m == 4 || $m == 6 || $m == 9 || $m == 11 and $d > 30 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m == 4 || $m == 6 || $m == 9 || $m == 11 and $d > 30) 0 28 28
Condition33%4/12
$m == 4 || $m == 6 || $m == 9 || $m == 11 and $d > 30
!ll&&!rl&&r
2800
$m == 4 or $m == 6 or $m == 9 or $m == 11
l!l&&r!l&&!r
0028
$m == 4 or $m == 6 or $m == 9
l!l&&r!l&&!r
0028
$m == 4 or $m == 6
l!l&&r!l&&!r
0028
MC/DC0%0/5
$m == 4 || $m == 6 || $m == 9 || $m == 11 and $d > 30
$m == 4 $m == 6 $m == 9 $m == 11 $d > 30
Truth table11%1/9
A or B or C or D and E
A= $m == 4B= $m == 6C= $m == 9D= $m == 11E= $d > 30
ABCDEresult
0000X0
1XXX00
01XX00
001X00
000100
1XXX11
01XX11
001X11
000111
132 0 $d -= 30;
133 0 $m++;
134 }
135  
136 28 ▶ if ( $m == 2 && $y % 4 == 0 and $d > 29 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m == 2 and $y % 4 == 0 and $d > 29) 0 28 28
Condition33%2/6
$m == 2 and $y % 4 == 0 and $d > 29
!ll&&!rl&&r
2800
$m == 2 and $y % 4 == 0
!ll&&!rl&&r
2800
MC/DC0%0/3
$m == 2 and $y % 4 == 0 and $d > 29
$m == 2 $y % 4 == 0 $d > 29
Truth table25%1/4
A and B and C
A= $m == 2B= $y % 4 == 0C= $d > 29
ABCresult
0XX0
10X0
1100
1111
137 0 $d -= 29;
138 0 $m++;
139 }
140  
141 28 ▶ if ( $m == 2 && $y % 4 != 0 and $d > 28 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m == 2 and $y % 4 != 0 and $d > 28) 0 28 28
Condition33%2/6
$m == 2 and $y % 4 != 0 and $d > 28
!ll&&!rl&&r
2800
$m == 2 and $y % 4 != 0
!ll&&!rl&&r
2800
MC/DC0%0/3
$m == 2 and $y % 4 != 0 and $d > 28
$m == 2 $y % 4 != 0 $d > 28
Truth table25%1/4
A and B and C
A= $m == 2B= $y % 4 != 0C= $d > 28
ABCresult
0XX0
10X0
1100
1111
142 0 $d -= 28;
143 0 $m++;
144 }
145  
146 28 ▶ if ( $m == 13 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m == 13) 0 28 28
147 0 $m = 1;
148 0 $y++;
149 }
150  
151 28 ▶ $d = '0'.$d if $d < 10;
Branch: 1 branch
BranchTrueFalseTotal
if $d < 10 28 0 28
152 28 ▶ $m = '0'.$m if $m < 10;
Branch: 1 branch
BranchTrueFalseTotal
if $m < 10 28 0 28
153  
154 28 $dt =~ s/^(\d{4}-\d{2}-\d{2})/$y-$m-$d/;
155  
156 28 return $dt;
157 }
158  
159 sub add_y {
160 2 ▶ my ( $dt, $y ) = @_;
Subroutine add_y: called CC=3 SCAR=12.0
Pod undocumented
161  
162 2 my ( $y0 ) = $dt =~ /^(\d{4})/;
163  
164 2 $y0 += $y;
165  
166 2 $dt =~ s/^(\d{4})/$y0/;
167  
168 2 ▶ if ( $dt =~ /^\d{4}-02-29/ and $y % 4 != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dt =~ /^\d{4}-02-29/ and $y % 4 != 0) 0 2 2
Condition33%1/3
$dt =~ /^\d{4}-02-29/ and $y % 4 != 0
!ll&&!rl&&r
200
MC/DC0%0/2
$dt =~ /^\d{4}-02-29/ and $y % 4 != 0
$dt =~ /^\d{4}-02-29/ $y % 4 != 0
Truth table33%1/3
A and B
A= $dt =~ /^\d{4}-02-29/B= $y % 4 != 0
ABresult
0X0
100
111
169 0 $dt =~ s/-02-29/-03-01/;
170 }
171  
172 2 return $dt;
173 }
174  
175  
176 sub get_svtrid {
177 138 ▶ my $i = int( rand( 9999999999 ) );
Subroutine get_svtrid: called CC=1 SCAR=0.0
Pod undocumented
178 138 my $j = int( rand( 9999999 ) );
179 138 my $k = int( rand( 999999 ) );
180  
181 138 return $i . '-' . $j . $k;
182 }
183  
184  
185 sub _fail_schema {
186 0 ▶ my ( $err ) = @_;
Subroutine _fail_schema: not called CC=1 SCAR=6.9
187  
188 0 my $svtrid = get_svtrid();
189  
190 0 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="2001"><msg>Command syntax error</msg><extValue><value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"><epp:undef/></value><reason>XML Schema Validation Error: [SAXException] org.xml.sax.SAXException: EPPXMLErrorHandler.error() :
191 $err</reason></extValue></result><trID><svTRID>$svtrid</svTRID></trID></response></epp>|;
192 }
193  
194 sub _fail_schema2 {
195 3 ▶ my ( $err ) = @_;
Subroutine _fail_schema2: called CC=1 SCAR=0.0
196  
197 3 my $svtrid = get_svtrid();
198  
199 3 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="2001"><msg>Command syntax error</msg><extValue><value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"><epp:undef/></value><reason>XML Schema Validation Error: $err</reason></extValue></result><trID><svTRID>$svtrid</svTRID></trID></response></epp>|;
200 }
201  
202  
203 sub _fail_namestore {
204 0 ▶ my ( $cltrid ) = @_;
Subroutine _fail_namestore: not called CC=1 SCAR=6.9
205  
206 0 my $svtrid = get_svtrid();
207  
208 0 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="2306"><msg>Parameter value policy error</msg><extValue><value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"><epp:undef/></value><reason>NameStore Extension not provided</reason></extValue></result><extension><namestoreExt:nsExtErrData xmlns:namestoreExt="http://www.verisign-grs.com/epp/namestoreExt-1.1" xsi:schemaLocation="http://www.verisign-grs.com/epp/namestoreExt-1.1 namestoreExt-1.1.xsd"><namestoreExt:msg code="1">Specified sub-product does not exist</namestoreExt:msg></namestoreExt:nsExtErrData></extension><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|
209 }
210  
211 sub _fail_answ {
212 29 ▶ my ( $cltrid, $code, $msg ) = @_;
Subroutine _fail_answ: called CC=1 SCAR=0.0
213  
214 29 my $svtrid = get_svtrid();
215  
216 29 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="$code"><msg>$msg</msg></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
217 }
218  
219 sub _fail_answ_with_reason {
220 21 ▶ my ( $cltrid, $code, $msg, $reason ) = @_;
Subroutine _fail_answ_with_reason: called CC=1 SCAR=0.0
221  
222 21 my $svtrid = get_svtrid();
223  
224 21 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="$code"><msg>$msg</msg><extValue><value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"><epp:undef/></value><reason>$reason</reason></extValue></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
225 }
226  
227  
228 sub _ok_answ {
229 13 ▶ my ( $cltrid, $answ, $ext ) = @_;
Subroutine _ok_answ: called CC=2 SCAR=6.9
230  
231 13 ▶ if ( $ext ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ext) { } 7 6 13
232 7 $ext = "<extension>$ext</extension>";
233 }
234 else {
235 6 $ext = '';
236 }
237  
238 13 my $svtrid = get_svtrid();
239  
240 13 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="1000"><msg>Command completed successfully</msg></result><resData>$answ</resData>$ext<trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
241 }
242  
243 sub _ok_answ2 {
244 2 ▶ my ( $cltrid, $answ, $ext ) = @_;
Subroutine _ok_answ2: called CC=2 SCAR=7.2
245  
246 2 ▶ if ( $ext ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ext) { } 0 2 2
247 0 $ext = qq|
248 <extension>
249 $ext
250 </extension>|;
251 }
252 else {
253 2 $ext = '';
254 }
255  
256 2 my $svtrid = get_svtrid();
257  
258 2 return qq|<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
259 <response>
260 <result code="1000">
261 <msg>Command completed successfully</msg>
262 </result>
263 <resData>
264 $answ
265 </resData>$ext
266 <trID>
267 <clTRID>$cltrid</clTRID>
268 <svTRID>$svtrid</svTRID>
269 </trID>
270 </response>
271 </epp>
272 |;
273 }
274  
275 sub _min_answ {
276 13 ▶ my ( $cltrid ) = @_;;
Subroutine _min_answ: called CC=1 SCAR=0.0
277  
278 13 my $svtrid = get_svtrid();
279  
280 13 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="1000"><msg>Command completed successfully</msg></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
281 }
282  
283  
284 sub _check_dom_dates {
285 25 ▶ my ( $s, $dname ) = @_;
Subroutine _check_dom_dates: called CC=8 SCAR=25.4
286  
287 25 my $dom = $s->data->{doms}{$dname};
288  
289 25 my $now = get_date();
290  
291 25 ▶ if ( $now gt $dom->{exp_date} and not $dom->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now gt $dom->{"exp_date"} and not $dom->{"statuses"}{"pendingDelete"}) 0 25 25
Condition33%1/3
$now gt $dom->{"exp_date"} and not $dom->{"statuses"}{"pendingDelete"}
!ll&&!rl&&r
2500
MC/DC0%0/2
$now gt $dom->{"exp_date"} and not $dom->{"statuses"}{"pendingDelete"}
$now gt $dom->{"exp_date"} not $dom->{"statuses"}{"pendingDelete"}
Truth table33%1/3
A and not(B)
A= $now gt $dom->{"exp_date"}B= not $dom->{"statuses"}{"pendingDelete"}
ABresult
0X0
100
111
292 # check on autoRenew
293 0 my $end_auto_renew = add_5d( $dom->{exp_date} );
294  
295 0 ▶ if ( $end_auto_renew gt $now ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($end_auto_renew gt $now) 0 0 0
296 0 $dom->{exp_date} = add_y( $dom->{exp_date} );
297 0 print "updated exp_date\n";
298 }
299 }
300  
301 25 ▶ if ( $dom->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{"pendingDelete"}) 5 20 25
302 # check on redemption time
303 5 my $end_del_date = add_5d( add_5d( $dom->{del_date} ) );
304  
305 5 ▶ if ( $now gt $end_del_date ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now gt $end_del_date) 0 5 5
306 0 delete $s->{doms}{$dname};
307 }
308  
309 5 ▶ if ( $dom->{statuses}{pendingRestore} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{"pendingRestore"}) 2 3 5
310 2 my $end_rest_date = add_5d( $dom->{upd_date} );
311  
312 2 ▶ if ( $now gt $end_rest_date ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now gt $end_rest_date) 0 2 2
313 0 delete $dom->{statuses}{pendingRestore};
314 }
315 }
316 }
317 }
318  
319  
320 sub hello {
321 29 ▶ my $dt = get_date();
Subroutine hello: called CC=1 SCAR=0.0
Pod undocumented
322  
323 29 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><greeting><svID>VeriSign Com/Net EPP Registration Server</svID><svDate>$dt</svDate><svcMenu><version>1.0</version><lang>en</lang><objURI>urn:ietf:params:xml:ns:domain-1.0</objURI><objURI>urn:ietf:params:xml:ns:contact-1.0</objURI><objURI>urn:ietf:params:xml:ns:host-1.0</objURI><objURI>http://www.verisign.com/epp/registry-1.0</objURI><objURI>http://www.verisign.com/epp/lowbalance-poll-1.0</objURI><objURI>http://www.verisign.com/epp/rgp-poll-1.0</objURI><svcExtension><extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI><extURI>http://www.verisign.com/epp/whoisInf-1.0</extURI><extURI>http://www.verisign.com/epp/idnLang-1.0</extURI><extURI>urn:ietf:params:xml:ns:coa-1.0</extURI><extURI>http://www.verisign-grs.com/epp/namestoreExt-1.1</extURI><extURI>http://www.verisign.com/epp/sync-1.0</extURI><extURI>http://www.verisign.com/epp/relatedDomain-1.0</extURI><extURI>urn:ietf:params:xml:ns:verificationCode-1.0</extURI><extURI>urn:ietf:params:xml:ns:launch-1.0</extURI><extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI><extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI></svcExtension></svcMenu><dcp><access><all/></access><statement><purpose><admin/><other/><prov/></purpose><recipient><ours/><public/><unrelated/></recipient><retention><indefinite/></retention></statement></dcp></greeting></epp>|;
324 }
325  
326  
327 sub login {
328 28 ▶ my ( $body ) = @_;
Subroutine login: called CC=13 SCAR=33.2
Pod undocumented
329  
330 28 ▶ unless ( $body =~ s|^<\?xml version="1.0" encoding="UTF-8"\?>\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>\s+//s) 0 28 28
331 0 return _fail_schema( q|Line....: 1
332 Column..: 2
333 Message.: : The markup in the document preceding the root element must be well-formed.| );
334 }
335  
336 28 ▶ unless ( $body =~ s|^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+//s) 0 28 28
337 0 return _fail_schema( q|Line....: 2
338 Column..: 173
339 Message.: : cvc-complex-type.3.2.2: Attribute 'xxx' is not allowed to appear in element 'epp'.| );
340 }
341  
342 28 ▶ unless ( $body =~ s|\s*</epp>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[\s*</epp>\s*][]s) 0 28 28
343 0 return _fail_schema( q|Line....: 11111
344 Column..: 6
345 Message.: : The end-tag for element type "epp" must end with a '&gt;' delimiter.| );
346 }
347  
348 28 ▶ unless ( $body =~ s|<command>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/<command>\s*//s) 0 28 28
349 0 return _fail_schema( q|Line....: 3
350 Column..: 12
351 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":greeting, "urn:ietf:params:xml:ns:epp-1.0":hello, "urn:ietf:params:xml:ns:epp-1.0":command, "urn:ietf:params:xml:ns:epp-1.0":response, "urn:ietf:params:xml:ns:epp-1.0":extension}' is expected.| );
352 }
353  
354 28 ▶ unless ( $body =~ s|\s*</command>||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[\s*</command>][]s) 0 28 28
355 0 return _fail_schema( q|Line....: 22222
356 Column..: 11
357 Message.: : The end-tag for element type "command" must end with a '&gt;' delimiter.| );
358 }
359  
360 28 ▶ unless ( $body =~ s|<login>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/<login>\s*//s) 0 28 28
361 0 return _fail_schema( q|Line....: 4
362 Column..: 11
363 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":check, "urn:ietf:params:xml:ns:epp-1.0":create, "urn:ietf:params:xml:ns:epp-1.0":delete, "urn:ietf:params:xml:ns:epp-1.0":info, "urn:ietf:params:xml:ns:epp-1.0":login, "urn:ietf:params:xml:ns:epp-1.0":logout, "urn:ietf:params:xml:ns:epp-1.0":poll, "urn:ietf:params:xml:ns:epp-1.0":renew, "urn:ietf:params:xml:ns:epp-1.0":transfer, "urn:ietf:params:xml:ns:epp-1.0":update}' is expected.| );
364 }
365  
366 28 my ( $cltrid ) = $body =~ m|<clTRID>([0-9A-Za-z\-]+)</clTRID>|;
367  
368 28 ▶ unless ( $cltrid ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cltrid) 0 28 28
369 0 return _fail_schema( q|Line....: 11111
370 Column..: 22222
371 Message.: : cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '3' for type 'trIDStringType'.| );
372 }
373  
374 28 ▶ unless ( $body =~ s|\s*</login>.+$||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[\s*</login>.+$][]s) 0 28 28
375 0 return _fail_schema( q|Line....: 27
376 Column..: 10
377 Message.: : The end-tag for element type "login" must end with a '&gt;' delimiter.| );
378 }
379  
380 28 my ( $login ) = $body =~ m|<clID>([0-9A-Za-z_\-]+)</clID>|;
381  
382 28 ▶ return q|Line....: 5
Branch: 1 branch
BranchTrueFalseTotal
unless $login 0 28 28
383 Column..: 17
384 Message.: : cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '3' for type 'clIDType'.|
385 unless $login;
386  
387 28 my ( $pass ) = $body =~ m|<pw>([0-9A-Za-z!\@\$\%*_.:=+?#,"'\-{}\[\]\(\)]+)</pw>|;
388  
389 28 ▶ if ( !$pass || length( $pass ) < 6 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $pass or length $pass < 6) 0 28 28
Condition33%1/3
not $pass or length $pass < 6
l!l&&r!l&&!r
0028
MC/DC0%0/2
not $pass or length $pass < 6
not $pass length $pass < 6
Truth table33%1/3
not(A) or B
A= not $passB= length $pass < 6
ABresult
1X1
011
000
390 0 return q|Line....: 6
391 Column..: 13
392 Message.: : cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '6' for type 'pwType'.|;
393 }
394  
395 28 my $svtrid = get_svtrid();
396  
397 28 ▶ if ( $pass eq 'fail-pass' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pass eq "fail-pass") 0 28 28
398 0 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="2200"><msg>Authentication error</msg></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
399 }
400  
401 28 return qq|<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="1000"><msg>Welcome user.</msg></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
402 }
403  
404  
405 sub contacts {
406 0 ▶ my $svtrid = get_svtrid();
Subroutine contacts: not called CC=1 SCAR=6.9
Pod undocumented
407  
408 0 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="2306"><msg>Parameter value policy error</msg><extValue><value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"><epp:undef/></value><reason>Sub product dotCOM does NOT support contact</reason></extValue></result><trID><clTRID>11111</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
409 }
410  
411  
412 sub _check_body {
413 81 ▶ my ( $body_ref ) = @_;
Subroutine _check_body: called CC=13 SCAR=32.7
414  
415 81 ▶ unless ( $$body_ref =~ s|^<\?xml version="1.0" encoding="UTF-8"\?>\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>\s+//s) 0 81 81
416 0 return _fail_schema( q|Line....: 1
417 Column..: 2
418 Message.: : The markup in the document preceding the root element must be well-formed.| );
419 }
420  
421 81 ▶ unless ( $$body_ref =~ s|^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s/^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+//s) 0 81 81
422 0 return _fail_schema( q|Line....: 2
423 Column..: 173
424 Message.: : cvc-complex-type.3.2.2: Attribute 'xxx' is not allowed to appear in element 'epp'.| );
425 }
426  
427 81 ▶ unless ( $$body_ref =~ s|\s*</epp>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s[\s*</epp>\s*][]s) 0 81 81
428 0 return _fail_schema( q|Line....: 11111
429 Column..: 6
430 Message.: : The end-tag for element type "epp" must end with a '&gt;' delimiter.| );
431 }
432  
433 81 ▶ unless ( $$body_ref =~ s|<command>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s/<command>\s*//s) 0 81 81
434 0 return _fail_schema( q|Line....: 3
435 Column..: 12
436 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":greeting, "urn:ietf:params:xml:ns:epp-1.0":hello, "urn:ietf:params:xml:ns:epp-1.0":command, "urn:ietf:params:xml:ns:epp-1.0":response, "urn:ietf:params:xml:ns:epp-1.0":extension}' is expected.| );
437 }
438  
439 81 ▶ unless ( $$body_ref =~ s|\s*</command>||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s[\s*</command>][]s) 0 81 81
440 0 return _fail_schema( q|Line....: 22222
441 Column..: 11
442 Message.: : The end-tag for element type "command" must end with a '&gt;' delimiter.| );
443 }
444  
445 81 my ( $cltrid ) = $$body_ref =~ m|<clTRID>([0-9A-Za-z\-]+)</clTRID>|;
446  
447 81 ▶ if ( $cltrid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cltrid) { } 81 0 81
448 81 $$body_ref =~ s|\s*<clTRID>[^<>]+</clTRID>\s*||s
449 }
450 else {
451 0 return _fail_schema( q|Line....: 11111
452 Column..: 22222
453 Message.: : cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '3' for type 'trIDStringType'.| );
454 }
455  
456 81 ▶ unless ( $$body_ref =~ m{<namestoreExt:subProduct>dot(COM|NET|EDU)</namestoreExt:subProduct>} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ m[<namestoreExt:subProduct>dot(COM|NET|EDU)</namestoreExt:subProduct>]) 0 81 81
457 0 return _fail_namestore( $cltrid );
458 }
459  
460 81 ▶ unless ( $$body_ref =~ s|\s*<namestoreExt:namestoreExt[^<>]+>.+</namestoreExt:namestoreExt>||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s[\s*<namestoreExt:namestoreExt[^<>]+>.+</namestoreExt:namestoreExt>][]s) 0 81 81
461 0 return _fail_namestore( $cltrid );
462 }
463  
464 81 my $cmd;
465 81 ▶ if ( $$body_ref =~ s/<(check|create|info|renew|update|delete)>\s*//s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$body_ref =~ s/<(check|create|info|renew|update|delete)>\s*//s) { } 81 0 81
466 81 $cmd = $1;
467 }
468 else {
469 0 return _fail_schema( q|Line....: 4
470 Column..: 11
471 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":check, "urn:ietf:params:xml:ns:epp-1.0":create, "urn:ietf:params:xml:ns:epp-1.0":delete, "urn:ietf:params:xml:ns:epp-1.0":info, "urn:ietf:params:xml:ns:epp-1.0":login, "urn:ietf:params:xml:ns:epp-1.0":logout, "urn:ietf:params:xml:ns:epp-1.0":poll, "urn:ietf:params:xml:ns:epp-1.0":renew, "urn:ietf:params:xml:ns:epp-1.0":transfer, "urn:ietf:params:xml:ns:epp-1.0":update}' is expected.| );
472 }
473  
474 81 ▶ unless ( $$body_ref =~ s|\s*</$cmd>.+$||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s[\s*</$cmd>.+$][]s) 0 81 81
475 0 return _fail_schema( qq|Line....: 22222
476 Column..: 10
477 Message.: : The end-tag for element type "$cmd" must end with a '&gt;' delimiter.| );
478 }
479  
480 81 my $type;
481 81 ▶ if ( $$body_ref =~ s/\s*<(host|domain):$cmd[^<>]+>\s*//s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$body_ref =~ s/\s*<(host|domain):${cmd}[^<>]+>\s*//s) { } 81 0 81
482 81 $type = $1;
483 }
484 else {
485 0 return _fail_schema( q|Line....: 5
486 Column..: 128
487 Message.: : cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'xxxxxx'.| );
488 }
489  
490 81 ▶ unless ( $$body_ref =~ s|\s*</$type:$cmd>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$body_ref =~ s[\s*</$type:$cmd>\s*][]s) 0 81 81
491 0 return _fail_schema( qq|Line....: 7
492 Column..: 16
493 Message.: : The end-tag for element type "$type:$cmd" must end with a '&gt;' delimiter.| );
494 }
495  
496 81 return ( 0, $cltrid );
497 }
498  
499  
500 sub host_check {
501 1 ▶ my ( $obj, $body ) = @_;
Subroutine host_check: called CC=6 SCAR=18.4
Pod undocumented
502  
503 1 my @chb = _check_body( \$body );
504  
505 1 my $cltrid;
506  
507 1 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 1 1
508 0 return @chb;
509 }
510 else {
511 1 $cltrid = $chb[1];
512 }
513  
514 1 my ( @hosts ) = $body =~ m|(<host:name>[^<>]+</host:name>)|g;
515  
516 1 ▶ unless ( scalar @hosts ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @hosts) 0 1 1
517 0 _fail_schema( q|Line....: 7
518 Column..: 17
519 Message.: : cvc-complex-type.2.4.b: The content of element 'host:check' is not complete. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| );
520 }
521  
522 1 my $srv_url = $obj->{sock};
523 1 my $s = new IO::EPP::Test::Server( $srv_url );
524 1 my $answ_list = '';
525 1 foreach my $row ( @hosts ) {
526 5 my ( $ns ) = $row =~ m|<host:name>([^<>]+)</host:name>|;
527 5 $ns = lc $ns;
528  
529 5 my $avail = 1;
530  
531 5 ▶ if ( $s->data->{nss}{$ns} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($s->data->{'nss'}{$ns}) { } 0 5 5
elsif (not $ns =~ /^[0-9a-z\.\-]+\.[0-9a-z\-]+$/) { } 2 3 5
532 0 $avail = 0;
533 }
534 elsif ( $ns !~ /^[0-9a-z\.\-]+\.[0-9a-z\-]+$/ ) {
535 2 $avail = 0;
536 }
537  
538 5 $answ_list .= qq|<host:cd><host:name avail="$avail">$ns</host:name></host:cd>|;
539 }
540  
541 1 return _ok_answ( $cltrid, qq|<host:chkData xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">$answ_list</host:chkData>| );
542 }
543  
544  
545 sub host_create {
546 9 ▶ my ( $obj, $body ) = @_;
Subroutine host_create: called CC=17 SCAR=28.5
Pod undocumented
547  
548 9 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
549  
550 9 my @chb = _check_body( \$body );
551  
552 9 my $cltrid;
553  
554 9 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 9 9
555 0 return @chb;
556 }
557 else {
558 9 $cltrid = $chb[1];
559 }
560  
561 9 my ( $ns, $dname );
562  
563 9 ▶ if ( $body =~ m|<host:name>([^<>]+)</host:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:name>([^<>]+)</host:name>]) { } 9 0 9
564 9 $ns = lc $1;
565 }
566 else {
567 0 return _fail_schema( q|Line....: 6
568 Column..: 17
569 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'host:name'. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| );
570 }
571  
572 9 ▶ unless ( $ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/) 1 8 9
573 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
574 }
575  
576 # need error for unknown tld: _fail_answ( $cltrid, '2305', 'Object association prohibits operation' )
577  
578 8 my $srv_url = $obj->{sock};
579 8 my $s = new IO::EPP::Test::Server( $srv_url );
580  
581 8 my $nss = $s->data->{nss};
582 8 my $doms = $s->data->{doms};
583  
584 8 ▶ if ( $nss->{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$ns}) 2 6 8
585 2 ▶ if ( $nss->{$ns}{owner} eq $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$ns}{'owner'} eq $obj->{'user'}) { } 1 1 2
586 1 return _fail_answ( $cltrid, '2302', 'Object exists' );
587 }
588 else {
589 1 return _fail_answ( $cltrid, '2201', 'Authorization error' );
590 }
591 }
592  
593 6 my ( $tld ) = $ns =~ /\.([0-9a-z\-]+)$/;
594  
595 6 my @v4;
596 my @v6;
597  
598 6 ▶ if ( $tld =~ /^(com|net|edu)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld =~ /^(com|net|edu)$/) 5 1 6
599 # need ip & Co
600 5 ( $dname ) = $ns =~ /\.([0-9a-z\-]+\.[a-z]+)$/;
601  
602 5 ▶ unless ( $doms->{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($doms->{$dname}) 1 4 5
603 1 return _fail_answ( $cltrid, '2305', 'Object association prohibits operation' );
604 }
605  
606 4 ▶ if ( $doms->{$dname}{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($doms->{$dname}{"owner"} ne $obj->{"user"}) 0 4 4
607 0 return _fail_answ( $cltrid, '2201', 'Authorization error' );
608 }
609  
610 4 @v4 = $body =~ m|<host:addr ip="v4">([^<>]+)</host:addr>|g;
611 4 @v6 = $body =~ m|<host:addr ip="v6">([^<>]+)</host:addr>|g;
612  
613 4 ▶ if ( scalar( @v4 ) + scalar( @v6 ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar(@v4) + scalar(@v6) == 0) 1 3 4
614 1 return _fail_answ( $cltrid, '2003', 'Required parameter missing' );
615 }
616  
617 3 foreach my $v ( @v4 ) {
618 2 ▶ unless ( $v =~ /^\d+\.\d+\.\d+\.\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ /^\d+\.\d+\.\d+\.\d+$/) 0 2 2
619 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
620 }
621 }
622 3 foreach my $v ( @v6 ) {
623 2 ▶ unless ( $v =~ /^[0-9a-z:]{1,29}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ /^[0-9a-z:]{1,29}$/) 1 1 2
624 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
625 }
626 }
627 }
628  
629 3 my $cre_date = get_date();
630  
631 3 my $roid = md5_hex($ns.$cre_date);
632 3 $roid =~ s/[a-f]//ig;
633  
634 3 my %v4;
635 3 $v4{$_} = '+' for @v4;
636 3 my %v6;
637 3 $v6{$_} = '+' for @v6;
638  
639 3 $nss->{$ns} = { avail => 0, reason => 'in use', statuses => { ok => '+' }, creater => $obj->{user}, owner => $obj->{user}, cre_date => $cre_date, addr_v4 => \%v4, addr_v6 => \%v6, roid => $roid . '_HOST_CNE-VRSN' };
640  
641 3 ▶ if ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dname) 2 1 3
642 2 $doms->{$dname}{hosts}{$ns} = '+';
643 }
644  
645 3 return _ok_answ( $cltrid, qq|<host:creData xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd"><host:name>$ns</host:name><host:crDate>$cre_date</host:crDate></host:creData>| );
646 }
647  
648  
649  
650 sub host_info {
651 4 ▶ my ( $obj, $body ) = @_;
Subroutine host_info: called CC=11 SCAR=24.3
Pod undocumented
652  
653 4 my @chb = _check_body( \$body );
654  
655 4 my $cltrid;
656  
657 4 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 4 4
658 0 return @chb;
659 }
660 else {
661 4 $cltrid = $chb[1];
662 }
663  
664 4 my $ns;
665  
666 4 ▶ if ( $body =~ m|<host:name>([^<>]+)</host:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:name>([^<>]+)</host:name>]) { } 4 0 4
667 4 $ns = lc $1;
668 }
669 else {
670 0 return _fail_schema( q|Line....: 6
671 Column..: 17
672 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'host:name'. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| );
673 }
674  
675 4 ▶ unless ( $ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/) 1 3 4
676 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
677 }
678  
679 # need error for unknown tld: _fail_answ( $cltrid, '2305', 'Object association prohibits operation' )
680  
681 3 my $srv_url = $obj->{sock};
682 3 my $s = new IO::EPP::Test::Server( $srv_url );
683  
684 3 ▶ unless ( $s->data->{nss}{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"nss"}{$ns}) 1 2 3
685 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
686 }
687  
688 2 my $host = $s->data->{nss}{$ns};
689  
690 2 ▶ if ( $host->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"owner"} ne $obj->{"user"}) 1 1 2
691 1 return _fail_answ( $cltrid, '2201', 'Authorization error' );
692 }
693  
694 1 my $answ = '<host:infData xmlns:host="urn:ietf:params:xml:ns:host-1.0">';
695 1 $answ .= "<host:name>$ns</host:name>";
696 1 $answ .= "<host:roid>" . $host->{roid} . "</host:roid>";
697 1 for my $st ( keys %{$host->{statuses}} ) {
698 1 $answ .= qq|<host:status s="$st"/>|;
699 }
700 1 for my $ip4 ( sort keys %{$host->{addr_v4}} ) {
701 1 $answ .= qq|<host:addr ip="v4">$ip4</host:addr>|;
702 }
703 1 for my $ip6 ( sort keys %{$host->{addr_v6}} ) {
704 1 $answ .= qq|<host:addr ip="v4">$ip6</host:addr>|;
705 }
706 1 $answ .= "<host:clID>$$host{owner}</host:clID>";
707 1 $answ .= "<host:crID>$$host{creater}</host:crID>";
708 1 $answ .= "<host:crDate>$$host{cre_date}</host:crDate>";
709 1 ▶ if ( $host->{updater} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{'updater'}) { } 0 1 1
710 0 $answ .= "<host:upID>$$host{updater}</host:upID>";
711 }
712 else {
713 1 $answ .= "<host:upID>$$host{creater}</host:upID>";
714 }
715 1 ▶ if ( $host->{upd_date} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{'upd_date'}) { } 0 1 1
716 0 $answ .= "<host:upDate>$$host{upd_date}</host:upDate>";
717 }
718 else {
719 1 $answ .= "<host:upDate>$$host{cre_date}</host:upDate>";
720 }
721 1 $answ .= '</host:infData>';
722  
723 1 return _ok_answ( $cltrid, $answ );
724 }
725  
726  
727  
728 sub host_update {
729 13 ▶ my ( $obj, $body ) = @_;
Subroutine host_update: called CC=35 SCAR=37.2
Pod undocumented
730  
731 13 my @chb = _check_body( \$body );
732  
733 13 my $cltrid;
734  
735 13 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 13 13
736 0 return @chb;
737 }
738 else {
739 13 $cltrid = $chb[1];
740 }
741  
742 13 my $ns;
743  
744 13 ▶ if ( $body =~ m|<host:name>([^<>]+)</host:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:name>([^<>]+)</host:name>]) { } 13 0 13
745 13 $ns = lc $1;
746 }
747 else {
748 0 return _fail_schema( q|Line....: 6
749 Column..: 17
750 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'host:name'. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| );
751 }
752  
753 13 ▶ unless ( $ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/) 0 13 13
754 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
755 }
756  
757 # need error for unknown tld: _fail_answ( $cltrid, '2305', 'Object association prohibits operation' )
758  
759 13 my $srv_url = $obj->{sock};
760 13 my $s = new IO::EPP::Test::Server( $srv_url );
761  
762 13 ▶ unless ( $s->data->{nss}{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"nss"}{$ns}) 1 12 13
763 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
764 }
765  
766 12 my $host = $s->data->{nss}{$ns};
767  
768 12 ▶ if ( $host->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"owner"} ne $obj->{"user"}) 1 11 12
769 1 return _fail_answ( $cltrid, '2201', 'Authorization error' );
770 }
771  
772 # first check data
773 11 my ( @a4, @a6, @d4, @d6, @ast, @dst );
774  
775 11 for my $act ( 'add', 'rem' ) {
776 17 ▶ if ( $body =~ m|<host:$act>(.+?)</host:$act>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:$act>(.+?)</host:$act>]s) 12 5 17
777 12 my $ab = $1;
778  
779 12 my @v4 = $ab =~ m|<host:addr ip="v4">([^<>]+)</host:addr>|g;
780 12 my @v6 = $ab =~ m|<host:addr ip="v6">([^<>]+)</host:addr>|g;
781  
782 12 foreach my $v ( @v4 ) {
783 5 ▶ unless ( $v =~ /^\d+\.\d+\.\d+\.\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ /^\d+\.\d+\.\d+\.\d+$/) 0 5 5
784 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
785 }
786  
787 5 ▶ if ( $act eq 'add' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($act eq 'add') { } 2 3 5
788 2 ▶ if ( $host->{addr_v4}{$v} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"addr_v4"}{$v}) 1 1 2
789 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$v addr is already associated" );
790 }
791  
792 1 push @a4, $v;
793 }
794 else {
795 3 ▶ unless ( $host->{addr_v4}{$v} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($host->{"addr_v4"}{$v}) 1 2 3
796 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$v addr not found" );
797 }
798  
799 2 push @d4, $v;
800 }
801 }
802  
803 10 foreach my $v ( @v6 ) {
804 2 ▶ unless ( $v =~ /^[0-9a-f:]{1,29}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v =~ /^[0-9a-f:]{1,29}$/) 1 1 2
805 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
806 }
807  
808 1 ▶ if ( $act eq 'add' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($act eq 'add') { } 0 1 1
809 0 ▶ if ( $host->{addr_v6}{$v} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"addr_v6"}{$v}) 0 0 0
810 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$v addr is already associated" );
811 }
812  
813 0 push @a6, $v;
814 }
815 else {
816 1 ▶ unless ( $host->{addr_v6}{$v} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($host->{"addr_v6"}{$v}) 0 1 1
817 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$v addr not found" );
818 }
819  
820 1 push @d6, $v;
821 }
822 }
823  
824 9 my @st = $ab =~ m|<host:status s="([^"]+)"/>|g;
825  
826 9 foreach my $st ( @st ) {
827 6 ▶ if ( $st !~ /^(clientDeleteProhibited|clientUpdateProhibited|linked|ok|pendingCreate|pendingDelete|pendingTransfer|pendingUpdate| serverDeleteProhibited|serverUpdateProhibited)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($st =~ /^(clientDeleteProhibited|clientUpdateProhibited|linked|ok|pendingCreate|pendingDelete|pendingTransfer|pendingUpdate| serverDeleteProhibited|serverUpdateProhibited)$/) 1 5 6
828 1 return _fail_schema2( qq|Line: 8, Column: 46, Message: cvc-enumeration-valid: Value '$st' is not facet-valid with respect to enumeration '[clientDeleteProhibited, clientUpdateProhibited, linked, ok, pendingCreate, pendingDelete, pendingTransfer, pendingUpdate, serverDeleteProhibited, serverUpdateProhibited]'. It must be a value from the enumeration.| );
829 }
830  
831 5 ▶ if ( $st !~ /^(clientDeleteProhibited|clientUpdateProhibited)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($st =~ /^(clientDeleteProhibited|clientUpdateProhibited)$/) 1 4 5
832 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "request contains no actual object updates" );
833 }
834  
835 4 ▶ if ( $act eq 'add' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($act eq 'add') { } 2 2 4
836 2 ▶ if ( $host->{statuses}{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"statuses"}{$st}) 1 1 2
837 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$st status is already associated" );
838 }
839  
840 1 push @ast, $st;
841 }
842 else {
843 2 ▶ unless ( $host->{statuses}{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($host->{"statuses"}{$st}) 1 1 2
844 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$st status not found" );
845 }
846  
847 1 push @dst, $st;
848 }
849 }
850 }
851 }
852  
853 4 ▶ if ( ( scalar( @a4 ) + scalar( @a6 ) ) == 0 and ( scalar( @d4 ) + scalar( @d6 ) > 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar(@a4) + scalar(@a6) == 0 and scalar(@d4) + scalar(@d6) > 0) 1 3 4
Condition100%3/3
scalar(@a4) + scalar(@a6) == 0 and scalar(@d4) + scalar(@d6) > 0
!ll&&!rl&&r
121
MC/DC100%2/2
scalar(@a4) + scalar(@a6) == 0 and scalar(@d4) + scalar(@d6) > 0
scalar(@a4) + scalar(@a6) == 0 scalar(@d4) + scalar(@d6) > 0
Truth table100%3/3
A and B
A= scalar(@a4) + scalar(@a6) == 0B= scalar(@d4) + scalar(@d6) > 0
ABresult
0X0
100
111
854 1 ▶ if ( ( scalar( @d4 ) + scalar( @d6 ) ) == ( scalar( keys %{$host->{addr_v4}} ) + scalar( keys %{$host->{addr_v6}} ) ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar(@d4) + scalar(@d6) == scalar(keys %{$$host{"addr_v4"};}) + scalar(keys %{$$host{"addr_v6"};})) 1 0 1
855 1 return _fail_answ( $cltrid, '2003', 'Required parameter missing' );
856 }
857 }
858  
859 3 ▶ if ( $body =~ m|<host:chg/>| or $body =~ m|<host:chg></host:chg>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:chg/>] or $body =~ m[<host:chg></host:chg>]) 0 3 3
Condition33%1/3
$body =~ m[<host:chg/>] or $body =~ m[<host:chg></host:chg>]
l!l&&r!l&&!r
003
MC/DC0%0/2
$body =~ m[<host:chg/>] or $body =~ m[<host:chg></host:chg>]
$body =~ m[<host:chg/>] $body =~ m[<host:chg></host:chg>]
Truth table33%1/3
A or B
A= $body =~ m[<host:chg/>]B= $body =~ m[<host:chg></host:chg>]
ABresult
1X1
011
000
860 0 return _fail_schema2( qq|Line: 13, Column: 16, Message: cvc-complex-type.2.4.b: The content of element 'host:chg' is not complete. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| )
861 }
862  
863 # TODO: chg name
864 =rem
865 2019-12-29 05:01:50 SRS::Comm::Provider::EPP::Base::epp_log:95
866 pid: 2559
867 update_ns request:
868 <?xml version="1.0" encoding="UTF-8"?>
869 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
870 <command>
871 <update>
872 <host:update xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">
873 <host:name>ns2.medinavai.com</host:name>
874 <host:chg><host:name>ns2.medinavai.com.deletednss.com</host:name></host:chg>
875 </host:update>
876 </update>
877 <extension>
878 <namestoreExt:namestoreExt xmlns:namestoreExt="http://www.verisign-grs.com/epp/namestoreExt-1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.verisign-grs.com/epp/namestoreExt-
879 1.1 namestoreExt-1.1.xsd">
880 <namestoreExt:subProduct>dotCOM</namestoreExt:subProduct>
881 </namestoreExt:namestoreExt>
882 </extension>
883 <clTRID>25d436e52c40ae318b831e52350d8352</clTRID>
884 </command>
885 </epp>
886  
887 2019-12-29 05:01:50 SRS::Comm::Provider::EPP::Base::epp_log:95
888 pid: 2559
889 req_time: 0.1559
890 update_ns answer:
891 <?xml version="1.0" encoding="UTF-8"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="1000"><msg>Command completed successfully</msg></result><trID><clTRID>25d436e52c40ae318b831e52350d8352</clTRID><s
892 vTRID>4521195083-1577584910758-20475271877</svTRID></trID></response></epp>
893 =cut
894 # after update
895  
896 # only first add, after delete: so the registy works
897 3 $host->{addr_v4}{$_} = '+' for @a4;
898  
899 3 $host->{addr_v6}{$_} = '+' for @a6;
900  
901 3 $host->{statuses}{$_} = '+' for @ast;
902  
903 3 delete $host->{addr_v4}{$_} for @d4;
904  
905 3 delete $host->{addr_v6}{$_} for @d6;
906  
907 3 delete $host->{statuses}{$_} for @dst;
908  
909 3 return _min_answ( $cltrid );
910 }
911  
912  
913 sub host_delete {
914 3 ▶ my ( $obj, $body ) = @_;
Subroutine host_delete: called CC=8 SCAR=21.5
Pod undocumented
915  
916 3 my @chb = _check_body( \$body );
917  
918 3 my $cltrid;
919  
920 3 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 3 3
921 0 return @chb;
922 }
923 else {
924 3 $cltrid = $chb[1];
925 }
926  
927 3 my $ns;
928  
929 3 ▶ if ( $body =~ m|<host:name>([^<>]+)</host:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<host:name>([^<>]+)</host:name>]) { } 3 0 3
930 3 $ns = lc $1;
931 }
932 else {
933 0 return _fail_schema( q|Line....: 6
934 Column..: 17
935 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'host:name'. One of '{"urn:ietf:params:xml:ns:host-1.0":name}' is expected.| );
936 }
937  
938 3 ▶ unless ( $ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ns =~ /^[0-9a-z][0-9a-z\-\.]*[0-9a-z]\.[0-9a-z][0-9a-z\-]*[0-9a-z]$/) 0 3 3
939 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
940 }
941  
942 # need error for unknown tld: _fail_answ( $cltrid, '2305', 'Object association prohibits operation' )
943  
944 3 my $srv_url = $obj->{sock};
945 3 my $s = new IO::EPP::Test::Server( $srv_url );
946  
947 3 ▶ unless ( $s->data->{nss}{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"nss"}{$ns}) 1 2 3
948 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
949 }
950  
951 2 my $host = $s->data->{nss}{$ns};
952  
953 2 ▶ if ( $host->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"owner"} ne $obj->{"user"}) 1 1 2
954 1 return _fail_answ( $cltrid, '2201', 'Authorization error' );
955 }
956  
957 1 ▶ if ( $host->{statuses}{linked} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host->{"statuses"}{"linked"}) 0 1 1
958 0 return _fail_answ( $cltrid, '2305', 'Object association prohibits operation' );
959 }
960  
961 1 my $dname;
962  
963 1 ▶ if ( $ns =~ /\b(com|net|edu)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ns =~ /\b(com|net|edu)$/) 1 0 1
964 1 ( $dname ) = $ns =~ /\.([0-9a-z\-]+\.[a-z]+)$/;
965  
966 1 my $doms = $s->data->{doms};
967  
968 1 delete $doms->{$dname}{hosts}{$ns};
969 }
970  
971 1 delete $s->data->{nss}{$ns};
972  
973 1 my $svtrid = get_svtrid();
974  
975 1 return _min_answ( $cltrid );
976 }
977  
978  
979 sub domain_check {
980 1 ▶ my ( $obj, $body ) = @_;
Subroutine domain_check: called CC=10 SCAR=25.5
Pod undocumented
981  
982 1 my @chb = _check_body( \$body );
983  
984 1 my $cltrid;
985  
986 1 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 1 1
987 0 return @chb;
988 }
989 else {
990 1 $cltrid = $chb[1];
991 }
992  
993 1 my ( @domains ) = $body =~ m|(<domain:name>[^<>]+</domain:name>)|g;
994  
995 1 ▶ unless ( scalar @domains ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @domains) 0 1 1
996 0 return _fail_body( 'domain:name' );
997 }
998  
999 1 my $srv_url = $obj->{sock};
1000 1 my $s = new IO::EPP::Test::Server( $srv_url );
1001 1 my $doms = $s->data->{doms};
1002  
1003 1 my $answ_list = '';
1004 1 foreach my $row ( @domains ) {
1005 6 my ( $dm ) = $row =~ m|<domain:name>([^<>]+)</domain:name>|;
1006  
1007 6 my ( $avail, $reason );
1008  
1009 6 ▶ if ( $doms->{$dm} ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($doms->{$dm}) { } 0 6 6
elsif (not $dm =~ /^[0-9-a-z\-]+\.[a-z]+$/) { } 1 5 6
elsif ($dm =~ /^reg*\.(com|net|edu)$/) { } 0 5 5
elsif ($dm =~ /\.(com|net|edu)$/) { } 4 1 5
1010 0 $avail = $doms->{$dm}{avail};
1011 0 $reason = $doms->{$dm}{reason};
1012 }
1013 elsif ( $dm !~ /^[0-9-a-z\-]+\.[a-z]+$/ ) {
1014 1 $avail = 0;
1015 1 $reason = '<domain:reason>Invalid Domain Name</domain:reason>';
1016 }
1017 elsif ( $dm =~ /^reg*\.(com|net|edu)$/ ) { # reged
1018 0 $avail = 0;
1019 0 $reason = '<domain:reason>Domain exists</domain:reason>';
1020 }
1021 elsif ( $dm =~ /\.(com|net|edu)$/ ) {
1022 4 ▶ $avail = int( rand( 10 ) ) > 1 ? 1 : 0; # 10% are not avail
Branch: 1 branch
BranchTrueFalseTotal
int rand 10 > 1 ? : 4 0 4
1023  
1024 4 ▶ if ( $avail ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($avail) { } 4 0 4
1025 4 $reason = '';
1026 }
1027 else {
1028 0 $reason = '<domain:reason>Domain exists</domain:reason>';
1029  
1030 0 $doms->{$dm}{avail} = 0;
1031 0 $doms->{$dm}{reason} = 'Domain exists';
1032 }
1033 }
1034 else {
1035 1 $avail = 0;
1036 1 $reason = '<domain:reason>Not an authoritative TLD</domain:reason>';
1037 }
1038  
1039 6 $answ_list .= qq|<domain:cd><domain:name avail="$avail">$dm</domain:name>$reason</domain:cd>|;
1040 }
1041  
1042 1 return _ok_answ( $cltrid, qq|<domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">$answ_list</domain:chkData>| );
1043 }
1044  
1045  
1046 sub domain_create {
1047 9 ▶ my ( $obj, $body ) = @_;
Subroutine domain_create: called CC=31 SCAR=38.5
Pod undocumented
1048  
1049 9 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
1050 9 my ( $lang ) = $body =~ m|<idnLang:tag[^<>]+">([A-Z]{3})</idnLang:tag>|;
1051  
1052 9 my @chb = _check_body( \$body );
1053  
1054 9 my $cltrid;
1055  
1056 9 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 9 9
1057 0 return @chb;
1058 }
1059 else {
1060 9 $cltrid = $chb[1];
1061 }
1062  
1063 9 my $dname;
1064 9 ▶ if ( $body =~ m|<domain:name>([^<>]*)</domain:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:name>([^<>]*)</domain:name>]) { } 9 0 9
1065 9 $dname = lc $1;
1066 }
1067 else {
1068 0 return _fail_schema2( q|Line: 8, Column: 21, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":names}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":name}' is expected.| );
1069 }
1070  
1071 9 ▶ unless ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname) 0 9 9
1072 0 return _fail_schema2( q|Line: 8, Column: 34, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| );
1073 }
1074  
1075 9 ▶ unless ( $dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/) 1 8 9
1076 1 return _fail_answ_with_reason( $cltrid, '2005', 'Parameter value syntax error', 'Domain name contains an invalid DNS character' );
1077 }
1078  
1079 8 my ( $tld ) = $dname =~ /\.([0-9a-z\-]+)$/;
1080  
1081 8 ▶ if ( $tld ne lc( $subProduct ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld ne lc $subProduct) 2 6 8
1082 2 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value syntax error', 'Subproduct ID does not match the domain TLD' );
1083 }
1084  
1085 6 my $period;
1086 6 ▶ if ( $body =~ m|<domain:period unit="y">([^<>]*)</domain:period>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:period unit="y">([^<>]*)</domain:period>]) { } 6 0 6
1087 6 $period = $1;
1088 }
1089 else {
1090 0 return _fail_schema2( q|Line: 9, Column: 32, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":xxxxxx}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":period, "urn:ietf:params:xml:ns:domain-1.0":ns, "urn:ietf:params:xml:ns:domain-1.0":registrant, "urn:ietf:params:xml:ns:domain-1.0":contact, "urn:ietf:params:xml:ns:domain-1.0":authInfo}' is expected.| );
1091 }
1092  
1093 6 ▶ unless ( $period and $period =~ /^[0-9]+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($period and $period =~ /^[0-9]+$/) 0 6 6
Condition33%1/3
$period and $period =~ /^[0-9]+$/
!ll&&!rl&&r
006
MC/DC0%0/2
$period and $period =~ /^[0-9]+$/
$period $period =~ /^[0-9]+$/
Truth table33%1/3
A and B
A= $periodB= $period =~ /^[0-9]+$/
ABresult
0X0
100
111
1094 0 return _fail_schema2( qq|Line: 9, Column: 47, Message: cvc-datatype-valid.1.2.1: '$period' is not a valid value for 'integer'.| );
1095 }
1096  
1097 6 ▶ if ( $period < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($period < 1) 0 6 6
1098 0 return _fail_schema2( qq|Line: 9, Column: 48, Message: cvc-minInclusive-valid: Value '$period' is not facet-valid with respect to minInclusive '1' for type 'pLimitType'.| );
1099 }
1100  
1101 6 ▶ if ( $period > 99 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($period > 99) 0 6 6
1102 0 return _fail_schema2( qq|Line: 9, Column: 50, Message: cvc-maxInclusive-valid: Value '$period' is not facet-valid with respect to maxInclusive '99' for type 'pLimitType'.| );
1103 }
1104  
1105 6 ▶ if ( $period > 10 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($period > 10) 1 5 6
1106 1 return _fail_answ( $cltrid, '2306', 'Parameter value policy error' );
1107 }
1108  
1109 5 my @nss;
1110 5 ▶ if ( $body =~ m|<domain:ns>(.+)</domain:ns>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:ns>(.+)</domain:ns>]s) 2 3 5
1111 2 my $nss = $1;
1112  
1113 2 my @rows = $body =~ m|<domain:hostObj>(.*)</domain:hostObj>|g;
1114  
1115 2 foreach my $row ( @rows ) {
1116 4 ▶ unless ( $row ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($row) 0 4 4
1117 0 return _fail_schema2( q|12, Column: 42, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| ) ;
1118 }
1119  
1120 4 ▶ if ( $row !~ /^([0-9a-z][0-9a-z\-]*[0-9a-z]\.)+[0-9a-z][0-9a-z\-]*[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($row =~ /^([0-9a-z][0-9a-z\-]*[0-9a-z]\.)+[0-9a-z][0-9a-z\-]*[0-9a-z]$/) 0 4 4
1121 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1122 }
1123  
1124 4 push @nss, $row;
1125 }
1126 }
1127  
1128 5 my $authinfo;
1129 5 ▶ if ( $body =~ m|<domain:authInfo>(.*)</domain:authInfo>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:authInfo>(.*)</domain:authInfo>]s) { } 5 0 5
1130 5 my $row = $1;
1131  
1132 5 ▶ if ( $row && $row =~ m|<domain:pw>(.*)</domain:pw>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row and $row =~ m[<domain:pw>(.*)</domain:pw>]s) { } 5 0 5
Condition33%1/3
$row and $row =~ m[<domain:pw>(.*)</domain:pw>]s
!ll&&!rl&&r
005
MC/DC0%0/2
$row and $row =~ m[<domain:pw>(.*)</domain:pw>]s
$row $row =~ m[<domain:pw>(.*)</domain:pw>]s
Truth table33%1/3
A and B
A= $rowB= $row =~ m[<domain:pw>(.*)</domain:pw>]s
ABresult
0X0
100
111
1133 5 $authinfo = $1;
1134  
1135 5 ▶ unless ( $authinfo ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($authinfo) 0 5 5
1136 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', 'Auth Info not provided' );
1137 }
1138  
1139 5 ▶ unless ( $authinfo =~ /[A-Z]/ && $authinfo =~ /[a-z]/ && $authinfo =~ /[0-9]/ && $authinfo =~ /[!\@\$\%*_.:\-=+?#,"'\\\/<>\[\]\{\}]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($authinfo =~ /[A-Z]/ and $authinfo =~ /[a-z]/ and $authinfo =~ /[0-9]/ and $authinfo =~ m([!\@\$\%*_.:\-=+?#,"'\\/<>\[\]\{\}])) 0 4 4
Condition66%6/9
$authinfo =~ /[A-Z]/ and $authinfo =~ /[a-z]/ and $authinfo =~ /[0-9]/ and $authinfo =~ m([!\@\$\%*_.:\-=+?#,"'\\/<>\[\]\{\}])
!ll&&!rl&&r
104
$authinfo =~ /[A-Z]/ and $authinfo =~ /[a-z]/ and $authinfo =~ /[0-9]/
!ll&&!rl&&r
104
$authinfo =~ /[A-Z]/ and $authinfo =~ /[a-z]/
!ll&&!rl&&r
104
MC/DC25%1/4
$authinfo =~ /[A-Z]/ and $authinfo =~ /[a-z]/ and $authinfo =~ /[0-9]/ and $authinfo =~ m([!\@\$\%*_.:\-=+?#,"'\\/<>\[\]\{\}])
$authinfo =~ /[A-Z]/ $authinfo =~ /[a-z]/ $authinfo =~ /[0-9]/ $authinfo =~ m([!\@\$\%*_.:\-=+?#,"'\\/<>\[\]\{\}])
Truth table40%2/5
A and B and C and D
A= $authinfo =~ /[A-Z]/B= $authinfo =~ /[a-z]/C= $authinfo =~ /[0-9]/D= $authinfo =~ m([!\@\$\%*_.:\-=+?#,"'\\/<>\[\]\{\}])
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1140 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', 'Invalid Auth Info' );
1141 }
1142 }
1143 else {
1144 0 return _fail_schema2( q|Line: 15, Column: 25, Message: cvc-complex-type.2.4.b: The content of element 'domain:authInfo' is not complete. One of '{"urn:ietf:params:xml:ns:domain-1.0":pw, "urn:ietf:params:xml:ns:domain-1.0":ext}' is expected.| );
1145 }
1146 }
1147 else {
1148 0 return _fail_schema2( q|Line: 14, Column: 21, Message: cvc-complex-type.2.4.b: The content of element 'domain:create' is not complete. One of '{"urn:ietf:params:xml:ns:domain-1.0":registrant, "urn:ietf:params:xml:ns:domain-1.0":contact, "urn:ietf:params:xml:ns:domain-1.0":authInfo}' is expected.| );
1149 }
1150  
1151 4 my $srv_url = $obj->{sock};
1152 4 my $s = new IO::EPP::Test::Server( $srv_url );
1153 4 my $hosts = $s->data->{nss};
1154 4 my $doms = $s->data->{doms};
1155  
1156 4 ▶ if ( $dname =~ /^xn--/ and !$lang ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dname =~ /^xn--/ and not $lang) 1 3 4
Condition66%2/3
$dname =~ /^xn--/ and not $lang
!ll&&!rl&&r
301
MC/DC50%1/2
$dname =~ /^xn--/ and not $lang
$dname =~ /^xn--/ not $lang
Truth table66%2/3
A and not(B)
A= $dname =~ /^xn--/B= not $lang
ABresult
0X0
100
111
1157 1 return _fail_answ_with_reason( $cltrid, '2003', 'Required parameter missing', 'Language Extension required for IDN label domain names.' );
1158 }
1159  
1160 3 ▶ if ( $doms->{$dname} || $dname =~ /^reg/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($doms->{$dname} or $dname =~ /^reg/) 1 2 3
Condition66%2/3
$doms->{$dname} or $dname =~ /^reg/
l!l&&r!l&&!r
102
MC/DC50%1/2
$doms->{$dname} or $dname =~ /^reg/
$doms->{$dname} $dname =~ /^reg/
Truth table66%2/3
A or B
A= $doms->{$dname}B= $dname =~ /^reg/
ABresult
1X1
011
000
1161 1 return _fail_answ( $cltrid, '2302', 'Object exists' );
1162 }
1163  
1164 2 my %nss;
1165 2 foreach my $ns ( @nss ) {
1166 3 ▶ unless ( $hosts->{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hosts->{$ns}) 1 2 3
1167 1 return _fail_answ_with_reason( $cltrid, '2303', 'Object does not exist', "ns $ns does not exist" );
1168 }
1169  
1170 2 $nss{$ns} = '+';
1171 }
1172  
1173 1 my $cre_date = get_date();
1174 1 my $exp_date = add_y( $cre_date, 1 );
1175  
1176 1 my $roid = uc( md5_hex($dname.$cre_date) );
1177  
1178 $doms->{$dname} = {
1179 nss => \%nss,
1180 hosts => {},
1181 cre_date => $cre_date,
1182 upd_date => $cre_date,
1183 exp_date => $exp_date,
1184 authInfo => $authinfo,
1185 roid => $roid.'_DOMAIN_'.$subProduct.'-VRSN',
1186 statuses => { 'ok' => '+' },
1187 creater => $obj->{user},
1188 owner => $obj->{user},
1189 updater => $obj->{user},
1190 1 avail => 0,
1191 reason => 'Domain exists',
1192 };
1193  
1194 1 foreach my $ns ( keys %nss ) {
1195 2 $hosts->{$ns}{statuses}{linked}++;
1196 }
1197  
1198 1 return _ok_answ2( $cltrid, qq|
1199 <domain:creData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
1200 <domain:name>$dname</domain:name>
1201 <domain:crDate>$cre_date</domain:crDate>
1202 <domain:exDate>$exp_date</domain:exDate>
1203 </domain:creData>
1204 | );
1205 }
1206  
1207  
1208 sub domain_info {
1209 10 ▶ my ( $obj, $body ) = @_;
Subroutine domain_info: called CC=28 SCAR=36.4
Pod undocumented
1210  
1211 10 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
1212  
1213 10 my @chb = _check_body( \$body );
1214  
1215 10 my $cltrid;
1216  
1217 10 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 10 10
1218 0 return @chb;
1219 }
1220 else {
1221 10 $cltrid = $chb[1];
1222 }
1223  
1224 10 my ( $show_hosts, $dname );
1225 10 ▶ if ( $body =~ m|<domain:name(\s+host="([A-Za-z]+)")?>([^<>]*)</domain:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:name(\s+host="([A-Za-z]+)")?>([^<>]*)</domain:name>]) { } 10 0 10
1226 10 ▶ $show_hosts = lc $2 if $2;
Branch: 1 branch
BranchTrueFalseTotal
if $2 0 10 10
1227 10 $dname = lc $3;
1228 }
1229 else {
1230 0 return _fail_schema2( q|Line: 8, Column: 21, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":names}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":name}' is expected.| );
1231 }
1232  
1233 10 ▶ unless ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname) 0 10 10
1234 0 return _fail_schema2( q|Line: 8, Column: 34, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| );
1235 }
1236  
1237 10 ▶ unless ( $dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/) 1 9 10
1238 1 return _fail_answ_with_reason( $cltrid, '2005', 'Parameter value syntax error', 'Domain name contains an invalid DNS character' );
1239 }
1240  
1241 9 my ( $tld ) = $dname =~ /\.([0-9a-z\-]+)$/;
1242  
1243 9 ▶ if ( $tld ne lc( $subProduct ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld ne lc $subProduct) 1 8 9
1244 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value syntax error', 'Incorrect NameStore Extension' );
1245 }
1246  
1247 8 my $srv_url = $obj->{sock};
1248 8 my $s = new IO::EPP::Test::Server( $srv_url );
1249  
1250 8 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 1 7 8
1251 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1252 }
1253  
1254 7 _check_dom_dates( $s, $dname );
1255  
1256 7 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 0 7 7
1257 0 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1258 }
1259  
1260  
1261 7 my $dm = $s->data->{doms}{$dname};
1262  
1263 7 ▶ if ( $dm->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dm->{"owner"} ne $obj->{"user"}) 0 7 7
1264 0 return _fail_answ_with_reason( $cltrid, '2201', 'Authorization error', 'Subordinate host info not available with partial info' );
1265 }
1266  
1267 7 my $answ = '<domain:infData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">';
1268 7 $answ .= "<domain:name>" . uc( $dname ) . "</domain:name>";
1269 7 $answ .= '<domain:roid>'.$dm->{roid}.'</domain:roid>';
1270 7 $answ .= qq|<domain:status s="$_"/>| for ( sort keys %{$dm->{statuses}} );
1271 7 ▶ if ( scalar( keys %{$dm->{nss}} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %{$$dm{"nss"};}) 7 0 7
1272 7 $answ .= '<domain:ns>';
1273  
1274 7 foreach my $ns ( sort keys %{$dm->{nss}} ) {
1275 14 $answ .= "<domain:hostObj>$ns</domain:hostObj>";
1276 }
1277  
1278 7 $answ .= '</domain:ns>';
1279 }
1280 7 ▶ if ( !$show_hosts or $show_hosts ne 'none' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $show_hosts or $show_hosts ne "none") 7 0 7
Condition33%1/3
not $show_hosts or $show_hosts ne "none"
l!l&&r!l&&!r
700
MC/DC0%0/2
not $show_hosts or $show_hosts ne "none"
not $show_hosts $show_hosts ne "none"
Truth table33%1/3
not(A) or B
A= not $show_hostsB= $show_hosts ne "none"
ABresult
1X1
011
000
1281 7 foreach my $host ( sort keys %{$dm->{hosts}} ) {
1282 3 $answ .= "<domain:host>$host</domain:host>";
1283 }
1284 }
1285 7 $answ .= "<domain:clID>$$dm{owner}</domain:clID>";
1286 7 $answ .= "<domain:crID>$$dm{creater}</domain:crID>";
1287 7 $answ .= "<domain:crDate>$$dm{cre_date}</domain:crDate>";
1288 7 $answ .= "<domain:upID>$$dm{updater}</domain:upID>";
1289 7 $answ .= "<domain:upDate>$$dm{upd_date}</domain:upDate>";
1290 7 $answ .= "<domain:exDate>$$dm{exp_date}</domain:exDate>";
1291 7 ▶ $answ .= "<domain:trDate>$$dm{tr_date}</domain:trDate>" if $dm->{tr_date};
Branch: 1 branch
BranchTrueFalseTotal
if $dm->{"tr_date"} 0 7 7
1292 7 $answ .= "<domain:authInfo><domain:pw>$$dm{authInfo}</domain:pw></domain:authInfo>";
1293 7 $answ .= '</domain:infData>';
1294  
1295 7 my $rgp = '';
1296 7 my $now = get_date();
1297  
1298 7 my $c5d = add_5d( $$dm{cre_date} );
1299 7 ▶ if ( $now lt $c5d ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now lt $c5d) 7 0 7
1300 7 $rgp .= '<rgp:rgpStatus s="addPeriod">endDate=' . $c5d . '</rgp:rgpStatus>';
1301 }
1302  
1303 7 ▶ my $r5d = $$dm{ren_date} ? add_5d( $$dm{ren_date} ) : '';
Branch: 1 branch
BranchTrueFalseTotal
$dm->{'ren_date'} ? : 5 2 7
1304 7 ▶ if ( $r5d and $now lt $r5d ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r5d and $now lt $r5d) 5 2 7
Condition66%2/3
$r5d and $now lt $r5d
!ll&&!rl&&r
205
MC/DC50%1/2
$r5d and $now lt $r5d
$r5d $now lt $r5d
Truth table66%2/3
A and B
A= $r5dB= $now lt $r5d
ABresult
0X0
100
111
1305 5 $rgp .= '<rgp:rgpStatus s="renewPeriod">endDate=' . $r5d . '</rgp:rgpStatus>';
1306 }
1307  
1308 7 ▶ my $t5d = $$dm{tr_date} ? add_5d( $$dm{tr_date} ) : '';
Branch: 1 branch
BranchTrueFalseTotal
$dm->{'tr_date'} ? : 0 7 7
1309 7 ▶ if ( $t5d and $now lt $t5d ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t5d and $now lt $t5d) 0 7 7
Condition33%1/3
$t5d and $now lt $t5d
!ll&&!rl&&r
700
MC/DC0%0/2
$t5d and $now lt $t5d
$t5d $now lt $t5d
Truth table33%1/3
A and B
A= $t5dB= $now lt $t5d
ABresult
0X0
100
111
1310 0 $rgp .= '<rgp:rgpStatus s="transferPeriod">endDate=' . $t5d . '</rgp:rgpStatus>';
1311 }
1312  
1313 7 ▶ if ( $now gt $dm->{exp_date} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now gt $dm->{"exp_date"}) 0 7 7
1314 0 my $ar5d = add_5d( $dm->{exp_date} );
1315 0 $rgp .= '<rgp:rgpStatus s="autoRenewPeriod">endDate=' . $ar5d . '</rgp:rgpStatus>';
1316 }
1317  
1318 7 ▶ if ( $dm->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dm->{"statuses"}{"pendingDelete"}) 2 5 7
1319 2 my $d5d = add_5d( $dm->{del_date} );
1320  
1321 2 ▶ if ( $now lt $d5d ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now lt $d5d) { } 2 0 2
1322 2 $rgp .= '<rgp:rgpStatus s="redemptionPeriod">endDate=' . $d5d . '</rgp:rgpStatus>';
1323 }
1324 else {
1325 # after redemption
1326 0 $d5d = add_5d( $d5d );
1327  
1328 0 $rgp .= '<rgp:rgpStatus s="pendingDelete">endDate=' . $d5d . '</rgp:rgpStatus>';
1329 }
1330 }
1331  
1332 7 ▶ if ( $rgp ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rgp) 7 0 7
1333 7 $rgp = qq|<rgp:infData xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">$rgp</rgp:infData>|;
1334 }
1335  
1336 7 return _ok_answ( $cltrid, $answ, $rgp );
1337 }
1338  
1339  
1340  
1341 sub domain_renew {
1342 6 ▶ my ( $obj, $body ) = @_;
Subroutine domain_renew: called CC=28 SCAR=39.0
Pod undocumented
1343  
1344 6 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
1345  
1346 6 my @chb = _check_body( \$body );
1347  
1348 6 my $cltrid;
1349  
1350 6 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 6 6
1351 0 return @chb;
1352 }
1353 else {
1354 6 $cltrid = $chb[1];
1355 }
1356  
1357 6 my $dname;
1358 6 ▶ if ( $body =~ m|<domain:name>([^<>]*)</domain:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:name>([^<>]*)</domain:name>]) { } 6 0 6
1359 6 $dname = lc $1;
1360 }
1361 else {
1362 0 return _fail_schema2( q|Line: 8, Column: 21, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":names}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":name}' is expected.| );
1363 }
1364  
1365 6 ▶ unless ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname) 0 6 6
1366 0 return _fail_schema2( q|Line: 8, Column: 34, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| );
1367 }
1368  
1369 6 ▶ unless ( $dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/) 1 5 6
1370 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1371 }
1372  
1373 5 my ( $tld ) = $dname =~ /\.([0-9a-z\-]+)$/;
1374  
1375 5 ▶ if ( $tld ne lc( $subProduct ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld ne lc $subProduct) 0 5 5
1376 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value syntax error', 'Incorrect NameStore Extension' );
1377 }
1378  
1379 5 my $user_edt;
1380 5 ▶ if ( $body =~ m|<domain:curExpDate>(.+)</domain:curExpDate>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:curExpDate>(.+)</domain:curExpDate>]) { } 5 0 5
1381 5 $user_edt = $1;
1382 }
1383 else {
1384 0 return _fail_schema2( q|Line: 9, Column: 31, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":period}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":curExpDate}' is expected.| );
1385 }
1386  
1387 5 my ( $yy, $mm, $dd );
1388 5 ▶ if ( $user_edt =~ /(\d{4})-(\d{2})-(\d{2})/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($user_edt =~ /(\d{4})-(\d{2})-(\d{2})/) 5 0 5
1389 5 ( $yy, $mm, $dd ) = ( $1, $2, $3 );
1390 }
1391  
1392 5 ▶ unless ( $yy && $yy >= 1000 && $yy <= 9999 and $mm && $mm <= 13 and $dd && $dd <= 31 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($yy and $yy >= 1000 and $yy <= 9999 and ($mm and $mm <= 13) and ($dd and $dd <= 31)) 1 4 5
Condition50%9/18
$yy and $yy >= 1000 and $yy <= 9999 and ($mm and $mm <= 13) and ($dd and $dd <= 31)
!ll&&!rl&&r
104
$yy and $yy >= 1000 and $yy <= 9999 and ($mm and $mm <= 13)
!ll&&!rl&&r
014
$yy and $yy >= 1000 and $yy <= 9999
!ll&&!rl&&r
005
$yy and $yy >= 1000
!ll&&!rl&&r
005
$mm and $mm <= 13
!ll&&!rl&&r
014
$dd and $dd <= 31
!ll&&!rl&&r
004
MC/DC14%1/7
$yy and $yy >= 1000 and $yy <= 9999 and ($mm and $mm <= 13) and ($dd and $dd <= 31)
$yy $yy >= 1000 $yy <= 9999 $mm $mm <= 13 $dd $dd <= 31
Truth table25%2/8
A and B and C and D and E and F and G
A= $yyB= $yy >= 1000C= $yy <= 9999D= $mmE= $mm <= 13F= $ddG= $dd <= 31
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
1393 1 return _fail_schema2( qq|Line: 7, Column: 54, Message: cvc-datatype-valid.1.2.1: '$user_edt' is not a valid value for 'date'.| );
1394 }
1395  
1396 4 my $period;
1397 4 ▶ if ( $body =~ m|<domain:period unit="y">(\d+)</domain:period>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:period unit="y">(\d+)</domain:period>]) { } 4 0 4
1398 4 $period = $1;
1399 }
1400 else {
1401 0 $period = 1;
1402 }
1403  
1404 4 ▶ if ( $period < 1 || $period > 10 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($period < 1 or $period > 10) 1 3 4
Condition66%2/3
$period < 1 or $period > 10
l!l&&r!l&&!r
013
MC/DC50%1/2
$period < 1 or $period > 10
$period < 1 $period > 10
Truth table66%2/3
A or B
A= $period < 1B= $period > 10
ABresult
1X1
011
000
1405 1 return _fail_answ( $cltrid, '2306', 'Parameter value policy error' );
1406 }
1407  
1408 3 my $srv_url = $obj->{sock};
1409 3 my $s = new IO::EPP::Test::Server( $srv_url );
1410  
1411 3 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 0 3 3
1412 0 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1413 }
1414  
1415 3 _check_dom_dates( $s, $dname );
1416  
1417 3 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 0 3 3
1418 0 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1419 }
1420  
1421 3 my $dm = $s->data->{doms}{$dname};
1422  
1423 3 ▶ if ( $dm->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dm->{"owner"} ne $obj->{"user"}) 0 3 3
1424 0 return _fail_answ( $cltrid, '2201', 'Authorization error' );
1425 }
1426  
1427 3 ▶ if ( $dm->{statuses}{serverRenewProhibited} or $dm->{statuses}{clientRenewProhibited} or $dm->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dm->{"statuses"}{"serverRenewProhibited"} or $dm->{"statuses"}{"clientRenewProhibited"} or $dm->{"statuses"}{"pendingDelete"}) 0 3 3
Condition33%2/6
$dm->{"statuses"}{"serverRenewProhibited"} or $dm->{"statuses"}{"clientRenewProhibited"} or $dm->{"statuses"}{"pendingDelete"}
l!l&&r!l&&!r
003
$dm->{"statuses"}{"serverRenewProhibited"} or $dm->{"statuses"}{"clientRenewProhibited"}
l!l&&r!l&&!r
003
MC/DC0%0/3
$dm->{"statuses"}{"serverRenewProhibited"} or $dm->{"statuses"}{"clientRenewProhibited"} or $dm->{"statuses"}{"pendingDelete"}
$dm->{"statuses"}{"serverRenewProhibited"} $dm->{"statuses"}{"clientRenewProhibited"} $dm->{"statuses"}{"pendingDelete"}
Truth table25%1/4
A or B or C
A= $dm->{"statuses"}{"serverRenewProhibited"}B= $dm->{"statuses"}{"clientRenewProhibited"}C= $dm->{"statuses"}{"pendingDelete"}
ABCresult
1XX1
01X1
0011
0000
1428 0 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1429 }
1430  
1431 3 ▶ if ( $$dm{ren_date} and add_5d( $$dm{ren_date} ) gt get_date() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dm->{"ren_date"} and add_5d($dm->{"ren_date"}) gt get_date()) 1 2 3
Condition66%2/3
$dm->{"ren_date"} and add_5d($dm->{"ren_date"}) gt get_date()
!ll&&!rl&&r
201
MC/DC50%1/2
$dm->{"ren_date"} and add_5d($dm->{"ren_date"}) gt get_date()
$dm->{"ren_date"} add_5d($dm->{"ren_date"}) gt get_date()
Truth table66%2/3
A and B
A= $dm->{"ren_date"}B= add_5d($dm->{"ren_date"}) gt get_date()
ABresult
0X0
100
111
1432 1 return _fail_answ( $cltrid, '2004', 'Domain in renewPeriod' );
1433 }
1434  
1435 2 my ( $edt ) = $dm->{exp_date} =~ /^(\d{4}-\d{2}-\d{2})/;
1436  
1437 2 ▶ if ( $user_edt ne $edt ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($user_edt ne $edt) 1 1 2
1438 1 return _fail_answ( $cltrid, '2004', 'Wrong curExpDate provided' );
1439 }
1440  
1441 1 my $now = get_date();
1442  
1443 1 my ( $y0 ) = $now =~ /^(\d{4})/;
1444 1 my ( $y1 ) = $dm->{exp_date} =~ /^(\d{4})/;
1445  
1446 1 ▶ if ( $y1 - $y0 + $period > 10 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y1 - $y0 + $period > 10) 0 1 1
1447 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', 'Max RegistrationPeriod exceeded' );
1448 }
1449  
1450 1 $dm->{ren_date} = $now;
1451 1 $dm->{exp_date} = add_y( $dm->{exp_date}, $period );
1452  
1453 1 my $answ = qq| <domain:renData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
1454 |;
1455 1 $answ .= " <domain:name>" . uc( $dname ) . "</domain:name>\n";
1456 1 $answ .= " <domain:exDate>" . $dm->{exp_date} . "</domain:exDate>\n";
1457 1 $answ .= " </domain:renData>\n";
1458  
1459 1 return _ok_answ2( $cltrid, $answ );
1460 }
1461  
1462  
1463 sub domain_update {
1464 19 ▶ my ( $obj, $body ) = @_;
Subroutine domain_update: called CC=76 SCAR=47.5
Pod undocumented
1465  
1466 19 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
1467  
1468 19 my $rgp = '';
1469 19 ▶ if ( $body =~ m|<rgp:update[^>]+>\s*(.+)\s*</rgp:update>|s ) { $rgp = $1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<rgp:update[^>]+>\s*(.+)\s*</rgp:update>]s) 2 17 19
1470  
1471 19 my @chb = _check_body( \$body );
1472  
1473 19 my $cltrid;
1474  
1475 19 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 19 19
1476 0 return @chb;
1477 }
1478 else {
1479 19 $cltrid = $chb[1];
1480 }
1481  
1482 19 my $dname;
1483 19 ▶ if ( $body =~ m|<domain:name>([^<>]*)</domain:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:name>([^<>]*)</domain:name>]) { } 19 0 19
1484 19 $dname = lc $1;
1485 }
1486 else {
1487 0 return _fail_schema2( q|Line: 8, Column: 21, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":names}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":name}' is expected.| );
1488 }
1489  
1490 19 ▶ unless ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname) 0 19 19
1491 0 return _fail_schema2( q|Line: 8, Column: 34, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| );
1492 }
1493  
1494 19 ▶ unless ( $dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/) 1 18 19
1495 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1496 }
1497  
1498 18 my ( $tld ) = $dname =~ /\.([0-9a-z\-]+)$/;
1499  
1500 18 ▶ if ( $tld ne lc( $subProduct ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld ne lc $subProduct) 1 17 18
1501 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value syntax error', 'Domainname is invalid' );
1502 }
1503  
1504 17 my %add;
1505 my %rem;
1506 17 my %chg;
1507  
1508 17 ▶ if ( $body =~ m|<domain:add>\s*(.+)\s*</domain:add>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:add>\s*(.+)\s*</domain:add>]s) 7 10 17
1509 7 my $add = $1;
1510  
1511 7 ▶ if ( $add =~ /domain:contact/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($add =~ /domain:contact/) 0 7 7
1512 0 return _fail_answ_with_reason( $cltrid, '2102', 'Unimplemented option', "Subproduct dot".$subProduct." does NOT support contacts." );
1513 }
1514  
1515 7 my @sts = $add =~ m|(<domain:status s="[^"]+"/>)|s;
1516  
1517 7 for my $row ( @sts ) {
1518 1 my ( $st, $reason );
1519  
1520 1 ▶ if ( $row =~ m|<domain:status s="([^"]+)"/>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row =~ m[<domain:status s="([^"]+)"/>]) 1 0 1
1521 1 $st = $1;
1522 1 $reason = '+';
1523 }
1524  
1525 1 ▶ unless ( $statuses{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($IO::EPP::Test::VerisignCore::statuses{$st}) 0 1 1
1526 0 return _fail_schema2( qq|Line: 8, Column: 52, Message: cvc-enumeration-valid: Value '$st' is not facet-valid with respect to enumeration '[clientDeleteProhibited, clientHold, clientRenewProhibited, clientTransferProhibited, clientUpdateProhibited, inactive, ok, pendingCreate, pendingDelete, pendingRenew, pendingTransfer, pendingUpdate, serverDeleteProhibited, serverHold, serverRenewProhibited, serverTransferProhibited, serverUpdateProhibited]'. It must be a value from the enumeration.| );
1527 }
1528  
1529 1 $add{statuses}{$st} = $reason;
1530 }
1531  
1532 7 undef @sts;
1533  
1534 7 @sts = $add =~ m|(<domain:status s="[^"]+">[^<>]*</domain:status>)|s;
1535  
1536 7 for my $row ( @sts ) {
1537 2 my ( $st, $reason );
1538  
1539 2 ▶ if ( $row =~ m|<domain:status s="([^"]+)">([^<>]*)</domain:status>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row =~ m[<domain:status s="([^"]+)">([^<>]*)</domain:status>]) 2 0 2
1540 2 $st = $1;
1541 2 ▶ $reason = $2 || '+';
Condition50%1/2
$2 || '+'
l!l
20
MC/DC0%0/1
$2 || '+'
$2
Truth table50%1/2
A
A= $2
Aresult
11
00
1542 }
1543  
1544 2 ▶ unless ( $statuses{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($IO::EPP::Test::VerisignCore::statuses{$st}) 1 1 2
1545 1 return _fail_schema2( qq|Line: 8, Column: 52, Message: cvc-enumeration-valid: Value '$st' is not facet-valid with respect to enumeration '[clientDeleteProhibited, clientHold, clientRenewProhibited, clientTransferProhibited, clientUpdateProhibited, inactive, ok, pendingCreate, pendingDelete, pendingRenew, pendingTransfer, pendingUpdate, serverDeleteProhibited, serverHold, serverRenewProhibited, serverTransferProhibited, serverUpdateProhibited]'. It must be a value from the enumeration.| );
1546 }
1547  
1548 1 $add{statuses}{$st} = $reason;
1549 }
1550  
1551 6 ▶ if ( $add =~ m|<domain:ns>(.+)</domain:ns>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($add =~ m[<domain:ns>(.+)</domain:ns>]s) 4 2 6
1552 4 my $nss = $1;
1553  
1554 4 my @nss = $nss =~ m|(<domain:hostObj>[^<>]*</domain:hostObj>)|s;
1555  
1556 4 my @hosts;
1557 4 for my $row ( @nss ) {
1558 4 ▶ if ( $row =~ m|<domain:hostObj>([^<>]+)</domain:hostObj>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row =~ m[<domain:hostObj>([^<>]+)</domain:hostObj>]) { } 4 0 4
1559 4 push @hosts, lc $1;
1560 }
1561 else {
1562 0 return _fail_schema2( q|Line: 9, Column: 40, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| )
1563 }
1564 }
1565  
1566 4 for my $ns ( @hosts ) {
1567 4 ▶ if ( $ns =~ /^[0-9a-z.\-]+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ns =~ /^[0-9a-z.\-]+$/) { } 4 0 4
1568 4 $add{nss}{$ns} = '+';
1569 }
1570 else {
1571 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1572 }
1573 }
1574 }
1575 }
1576  
1577 16 ▶ if ( $body =~ m|<domain:rem>\s*(.+)\s*</domain:rem>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:rem>\s*(.+)\s*</domain:rem>]s) 4 12 16
1578 4 my $rem = $1;
1579  
1580 4 ▶ if ( $rem =~ /domain:contact/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rem =~ /domain:contact/) 0 4 4
1581 0 return _fail_answ_with_reason( $cltrid, '2102', 'Unimplemented option', "Subproduct dot".$subProduct." does NOT support contacts." );
1582 }
1583  
1584 4 my @sts = $rem =~ m|(<domain:status s="[^"]+"[^>]*>)|s;
1585  
1586 4 for my $row ( @sts ) {
1587 1 my $st;
1588  
1589 1 ▶ if ( $row =~ m|<domain:status s="([^"]+)"/?>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row =~ m[<domain:status s="([^"]+)"/?>]) 1 0 1
1590 1 $st = $1;
1591 }
1592  
1593 1 ▶ unless ( $statuses{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($IO::EPP::Test::VerisignCore::statuses{$st}) 0 1 1
1594 0 return _fail_schema2( qq|Line: 9, Column: 52, Message: cvc-enumeration-valid: Value '$st' is not facet-valid with respect to enumeration '[clientDeleteProhibited, clientHold, clientRenewProhibited, clientTransferProhibited, clientUpdateProhibited, inactive, ok, pendingCreate, pendingDelete, pendingRenew, pendingTransfer, pendingUpdate, serverDeleteProhibited, serverHold, serverRenewProhibited, serverTransferProhibited, serverUpdateProhibited]'. It must be a value from the enumeration.| );
1595 }
1596  
1597 1 $rem{statuses}{$st} = '+';
1598 }
1599  
1600 4 ▶ if ( $rem =~ m|<domain:ns>(.+)</domain:ns>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rem =~ m[<domain:ns>(.+)</domain:ns>]s) 3 1 4
1601 3 my $nss = $1;
1602  
1603 3 my @nss = $nss =~ m|(<domain:hostObj>[^<>]*</domain:hostObj>)|s;
1604  
1605 3 my @hosts;
1606 3 for my $row ( @nss ) {
1607 3 ▶ if ( $row =~ m|<domain:hostObj>([^<>]+)</domain:hostObj>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row =~ m[<domain:hostObj>([^<>]+)</domain:hostObj>]) { } 3 0 3
1608 3 push @hosts, lc $1;
1609 }
1610 else {
1611 0 return _fail_schema2( q|Line: 9, Column: 40, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| )
1612 }
1613 }
1614  
1615 3 for my $ns ( @hosts ) {
1616 3 ▶ if ( $ns =~ /^[0-9a-z.\-]+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ns =~ /^[0-9a-z.\-]+$/) { } 3 0 3
1617 3 $rem{nss}{$ns} = '+';
1618 }
1619 else {
1620 0 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1621 }
1622 }
1623 }
1624 }
1625  
1626 16 ▶ if ( $body =~ m|<domain:chg>\s*(.+)\s*</domain:chg>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:chg>\s*(.+)\s*</domain:chg>]s) 4 12 16
1627 4 my $chg = $1;
1628  
1629 4 ▶ if ( $chg =~ /domain:registrant/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chg =~ /domain:registrant/) 1 3 4
1630 1 return _fail_answ_with_reason( $cltrid, '2102', 'Unimplemented option', "Subproduct dot".$subProduct." does NOT support contacts." );
1631 }
1632  
1633 3 ▶ if ( $chg =~ m|<domain:pw>([^<>]*)</domain:pw>|s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chg =~ m[<domain:pw>([^<>]*)</domain:pw>]s) 3 0 3
1634 3 my $key = $1;
1635  
1636 3 ▶ unless ( $key and length( $key ) >= 16 and length( $key ) <= 48 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($key and length $key >= 16 and length $key <= 48) 1 2 3
Condition66%4/6
$key and length $key >= 16 and length $key <= 48
!ll&&!rl&&r
102
$key and length $key >= 16
!ll&&!rl&&r
012
MC/DC33%1/3
$key and length $key >= 16 and length $key <= 48
$key length $key >= 16 length $key <= 48
Truth table50%2/4
A and B and C
A= $keyB= length $key >= 16C= length $key <= 48
ABCresult
0XX0
10X0
1100
1111
1637 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', 'Invalid Auth Info' );
1638 }
1639  
1640 2 ▶ unless ( $key =~ /[a-z]/ and $key =~ /[A-Z]/ and $key =~ /[0-9]/ and $key =~ /["'.,\-\[\]\\|\/!?\$\%\@*()+=_{}:;]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($key =~ /[a-z]/ and $key =~ /[A-Z]/ and $key =~ /[0-9]/ and $key =~ m(["'.,\-\[\]\\|/!?\$\%\@*()+=_{}:;])) 0 1 1
Condition66%6/9
$key =~ /[a-z]/ and $key =~ /[A-Z]/ and $key =~ /[0-9]/ and $key =~ m(["'.,\-\[\]\\|/!?\$\%\@*()+=_{}:;])
!ll&&!rl&&r
101
$key =~ /[a-z]/ and $key =~ /[A-Z]/ and $key =~ /[0-9]/
!ll&&!rl&&r
101
$key =~ /[a-z]/ and $key =~ /[A-Z]/
!ll&&!rl&&r
101
MC/DC25%1/4
$key =~ /[a-z]/ and $key =~ /[A-Z]/ and $key =~ /[0-9]/ and $key =~ m(["'.,\-\[\]\\|/!?\$\%\@*()+=_{}:;])
$key =~ /[a-z]/ $key =~ /[A-Z]/ $key =~ /[0-9]/ $key =~ m(["'.,\-\[\]\\|/!?\$\%\@*()+=_{}:;])
Truth table40%2/5
A and B and C and D
A= $key =~ /[a-z]/B= $key =~ /[A-Z]/C= $key =~ /[0-9]/D= $key =~ m(["'.,\-\[\]\\|/!?\$\%\@*()+=_{}:;])
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1641 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', 'Invalid Auth Info' );
1642 }
1643  
1644 1 $chg{authInfo} = $key;
1645 }
1646 }
1647  
1648 13 ▶ unless ( scalar( keys %add ) + scalar( keys %rem ) + scalar( keys %chg ) or $rgp ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar(keys %add) + scalar(keys %rem) + scalar(keys %chg) or $rgp) 1 12 13
Condition100%3/3
scalar(keys %add) + scalar(keys %rem) + scalar(keys %chg) or $rgp
l!l&&r!l&&!r
1021
MC/DC100%2/2
scalar(keys %add) + scalar(keys %rem) + scalar(keys %chg) or $rgp
scalar(keys %add) + scalar(keys %rem) + scalar(keys %chg) $rgp
Truth table100%3/3
A or B
A= scalar(keys %add) + scalar(keys %rem) + scalar(keys %chg)B= $rgp
ABresult
1X1
011
000
1649 1 return _fail_answ_with_reason( $cltrid, '2003', 'Required parameter missing', 'empty non-extended update is not allowed' );
1650 }
1651  
1652 12 my $s = new IO::EPP::Test::Server( $obj->{sock} );
1653  
1654 12 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 1 11 12
1655 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1656 }
1657  
1658 11 _check_dom_dates( $s, $dname );
1659  
1660 11 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 0 11 11
1661 0 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1662 }
1663  
1664 11 my $dom = $s->data->{doms}{$dname};
1665 11 my $nss = $s->data->{nss};
1666  
1667 11 ▶ if ( $dom->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"owner"} ne $obj->{"user"}) 0 11 11
1668 0 return _fail_answ( $cltrid, '2201', 'Authorization error' );
1669 }
1670  
1671 11 ▶ if ( $rgp ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rgp) 2 9 11
1672 2 ▶ unless ( $rgp =~ /restore op="[a-z]+"/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($rgp =~ /restore op="[a-z]+"/) 0 2 2
1673 0 return _fail_schema2( q|Line: 17, Column: 33, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:rgp-1.0":xxxxxx}'. One of '{"urn:ietf:params:xml:ns:rgp-1.0":restore}' is expected.| );
1674 }
1675  
1676 2 ▶ if ( $rgp =~ /restore op="request"/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rgp =~ /restore op="request"/) 1 1 2
1677 1 ▶ unless ( $dom->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dom->{"statuses"}{"pendingDelete"}) 0 1 1
1678 0 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1679 }
1680  
1681 1 my $now = get_date();
1682 1 my $last_redem_date = add_5d( $dom->{del_date} );
1683  
1684 1 ▶ if ( $now gt $last_redem_date ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now gt $last_redem_date) 0 1 1
1685 0 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1686 }
1687  
1688 1 $dom->{statuses}{pendingRestore} = '+';
1689 1 $dom->{upd_date} = get_date();
1690  
1691 1 return _min_answ( $cltrid );
1692 }
1693  
1694 1 ▶ if ( $rgp =~ /restore op="report"/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rgp =~ /restore op="report"/) 1 0 1
1695 1 ▶ unless ( $dom->{statuses}{pendingRestore} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dom->{"statuses"}{"pendingRestore"}) 0 1 1
1696 0 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1697 }
1698  
1699 1 delete $dom->{statuses}{pendingDelete};
1700 1 delete $dom->{statuses}{pendingRestore};
1701  
1702 1 for my $ns ( keys %{$dom->{nss}} ) {
1703 2 ▶ if ( $nss->{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$ns}) { } 2 0 2
1704 2 $nss->{$ns}{statuses}{linked}++;
1705 }
1706 else {
1707 0 delete $dom->{nss}{$ns};
1708 }
1709 }
1710  
1711 1 return _min_answ( $cltrid );
1712 }
1713  
1714 0 return _fail_schema2( q|Line: 17, Column: 33, Message: cvc-enumeration-valid: Value 'xxxxxx' is not facet-valid with respect to enumeration '[request, report]'. It must be a value from the enumeration.| );
1715 }
1716  
1717 9 ▶ if ( $dom->{statuses}{serverUpdateProhibited} or $dom->{statuses}{clientUpdateProhibited} and not $rem{statuses}{clientUpdateProhibited} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} and not $rem{"statuses"}{"clientUpdateProhibited"}) 1 8 9
Condition83%5/6
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} and not $rem{"statuses"}{"clientUpdateProhibited"}
l!l&&r!l&&!r
054
$dom->{"statuses"}{"clientUpdateProhibited"} and not $rem{"statuses"}{"clientUpdateProhibited"}
!ll&&!rl&&r
711
MC/DC33%1/3
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} and not $rem{"statuses"}{"clientUpdateProhibited"}
$dom->{"statuses"}{"serverUpdateProhibited"} $dom->{"statuses"}{"clientUpdateProhibited"} not $rem{"statuses"}{"clientUpdateProhibited"}
Truth table50%2/4
A or B and not(C)
A= $dom->{"statuses"}{"serverUpdateProhibited"}B= $dom->{"statuses"}{"clientUpdateProhibited"}C= not $rem{"statuses"}{"clientUpdateProhibited"}
ABCresult
1XX1
0111
00X0
0100
1718 1 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1719 }
1720  
1721 8 foreach my $st ( keys %{$add{statuses}} ) {
1722 1 ▶ if ( $dom->{statuses}{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{$st}) 0 1 1
1723 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$st status is already associated" );
1724 }
1725 }
1726  
1727 8 foreach my $st ( keys %{$rem{statuses}} ) {
1728 1 ▶ unless ( $dom->{statuses}{$st} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dom->{"statuses"}{$st}) 0 1 1
1729 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$st status not found" );
1730 }
1731 }
1732  
1733 8 foreach my $ns ( keys %{$add{nss}} ) {
1734 3 ▶ unless ( $nss->{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nss->{$ns}) 1 2 3
1735 1 return _fail_answ_with_reason( $cltrid, '2303', 'Object does not exist', "host $ns not found." );
1736 }
1737  
1738 2 ▶ if ( $dom->{nss}{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"nss"}{$ns}) 0 2 2
1739 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$ns ns is already linked" );
1740 }
1741 }
1742  
1743 7 foreach my $ns ( keys %{$rem{nss}} ) {
1744 3 ▶ unless ( $dom->{nss}{$ns} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dom->{"nss"}{$ns}) 1 2 3
1745 1 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value policy error', "$ns ns not found" );
1746 }
1747 }
1748  
1749 # order not change!
1750 6 $dom->{statuses}{$_} = $add{statuses}{$_} foreach keys %{$add{statuses}};
1751  
1752 6 delete $dom->{statuses}{$_} foreach keys %{$rem{statuses}};
1753  
1754 6 ▶ if ( $dom->{statuses}{ok} and scalar( keys %{$dom->{statuses}} ) > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{"ok"} and scalar keys %{$$dom{"statuses"};} > 1) 1 5 6
Condition100%3/3
$dom->{"statuses"}{"ok"} and scalar keys %{$$dom{"statuses"};} > 1
!ll&&!rl&&r
141
MC/DC100%2/2
$dom->{"statuses"}{"ok"} and scalar keys %{$$dom{"statuses"};} > 1
$dom->{"statuses"}{"ok"} scalar keys %{$$dom{"statuses"};} > 1
Truth table100%3/3
A and B
A= $dom->{"statuses"}{"ok"}B= scalar keys %{$$dom{"statuses"};} > 1
ABresult
0X0
100
111
1755 1 delete $dom->{statuses}{ok};
1756 }
1757  
1758 6 ▶ unless ( scalar( keys %{$dom->{statuses}} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %{$$dom{"statuses"};}) 1 5 6
1759 1 $dom->{statuses}{ok} = '+';
1760 }
1761  
1762 6 foreach my $ns ( keys %{$add{nss}} ) {
1763 2 $dom->{nss}{$ns} = '+';
1764  
1765 2 $nss->{$ns}{statuses}{linked}++;
1766 }
1767  
1768 6 foreach my $ns ( keys %{$rem{nss}} ) {
1769 2 delete $dom->{nss}{$ns};
1770  
1771 2 $nss->{$ns}{statuses}{linked}--;
1772  
1773 2 ▶ delete $nss->{$ns}{statuses}{linked} if $nss->{$ns}{statuses}{linked} == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $nss->{$ns}{"statuses"}{"linked"} == 0 2 0 2
1774 }
1775  
1776 6 ▶ $dom->{authInfo} = $chg{authInfo} if $chg{authInfo};
Branch: 1 branch
BranchTrueFalseTotal
if $chg{"authInfo"} 1 5 6
1777  
1778 6 $dom->{upd_date} = get_date();
1779 6 $dom->{updater} = $obj->{user};
1780  
1781 6 return _min_answ( $cltrid );
1782 }
1783  
1784  
1785 sub domain_delete {
1786 6 ▶ my ( $obj, $body ) = @_;
Subroutine domain_delete: called CC=20 SCAR=33.9
Pod undocumented
1787  
1788 6 my ( $subProduct ) = $body =~ m|<namestoreExt:subProduct>dot([A-Z]+)</namestoreExt:subProduct>|;
1789  
1790 6 my @chb = _check_body( \$body );
1791  
1792 6 my $cltrid;
1793  
1794 6 ▶ if ( $chb[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chb[0]) { } 0 6 6
1795 0 return @chb;
1796 }
1797 else {
1798 6 $cltrid = $chb[1];
1799 }
1800  
1801 6 my $dname;
1802 6 ▶ if ( $body =~ m|<domain:name>([^<>]*)</domain:name>| ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ m[<domain:name>([^<>]*)</domain:name>]) { } 6 0 6
1803 6 $dname = lc $1;
1804 }
1805 else {
1806 0 return _fail_schema2( q|Line: 8, Column: 21, Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:ietf:params:xml:ns:domain-1.0":names}'. One of '{"urn:ietf:params:xml:ns:domain-1.0":name}' is expected.| );
1807 }
1808  
1809 6 ▶ unless ( $dname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname) 0 6 6
1810 0 return _fail_schema2( q|Line: 8, Column: 34, Message: cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'labelType'.| );
1811 }
1812  
1813 6 ▶ unless ( $dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dname =~ /^[0-9a-z][0-9a-z\-]*[0-9a-z]\.[0-9a-z][0-9a-z\-]+[0-9a-z]$/) 1 5 6
1814 1 return _fail_answ( $cltrid, '2005', 'Parameter value syntax error' );
1815 }
1816  
1817 5 my ( $tld ) = $dname =~ /\.([0-9a-z\-]+)$/;
1818  
1819 5 ▶ if ( $tld ne lc( $subProduct ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tld ne lc $subProduct) 0 5 5
1820 0 return _fail_answ_with_reason( $cltrid, '2306', 'Parameter value syntax error', 'Domainname is invalid' );
1821 }
1822  
1823 5 my $s = new IO::EPP::Test::Server( $obj->{sock} );
1824  
1825 5 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 1 4 5
1826 1 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1827 }
1828  
1829 4 _check_dom_dates( $s, $dname );
1830  
1831 4 ▶ unless ( $s->data->{doms}{$dname} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->data->{"doms"}{$dname}) 0 4 4
1832 0 return _fail_answ( $cltrid, '2303', 'Object does not exist' );
1833 }
1834  
1835 4 my $dom = $s->data->{doms}{$dname};
1836 4 my $nss = $s->data->{nss};
1837  
1838 4 ▶ if ( $dom->{owner} ne $obj->{user} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"owner"} ne $obj->{"user"}) 1 3 4
1839 1 return _fail_answ( $cltrid, '2201', 'Authorization error' );
1840 }
1841  
1842 3 ▶ if ( $dom->{hosts} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"hosts"}) 3 0 3
1843  
1844 3 for my $h ( keys %{$dom->{hosts}} ) {
1845  
1846 3 ▶ if ( $nss->{$h}{statuses}{linked} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$h}{"statuses"}{"linked"}) 1 2 3
1847 1 return _fail_answ_with_reason( $cltrid, '2305', 'Object association prohibits operation', 'domain has an active child host' );
1848 }
1849 }
1850 }
1851  
1852 2 ▶ if ( $dom->{statuses}{serverUpdateProhibited} or $dom->{statuses}{clientUpdateProhibited} or $dom->{statuses}{serverDeleteProhibited} or $dom->{statuses}{clientDeleteProhibited} or $dom->{statuses}{pendingDelete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} or $dom->{"statuses"}{"serverDeleteProhibited"} or $dom->{"statuses"}{"clientDeleteProhibited"} or $dom->{"statuses"}{"pendingDelete"}) 1 1 2
Condition41%5/12
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} or $dom->{"statuses"}{"serverDeleteProhibited"} or $dom->{"statuses"}{"clientDeleteProhibited"} or $dom->{"statuses"}{"pendingDelete"}
l!l&&r!l&&!r
011
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} or $dom->{"statuses"}{"serverDeleteProhibited"} or $dom->{"statuses"}{"clientDeleteProhibited"}
l!l&&r!l&&!r
002
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} or $dom->{"statuses"}{"serverDeleteProhibited"}
l!l&&r!l&&!r
002
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"}
l!l&&r!l&&!r
002
MC/DC20%1/5
$dom->{"statuses"}{"serverUpdateProhibited"} or $dom->{"statuses"}{"clientUpdateProhibited"} or $dom->{"statuses"}{"serverDeleteProhibited"} or $dom->{"statuses"}{"clientDeleteProhibited"} or $dom->{"statuses"}{"pendingDelete"}
$dom->{"statuses"}{"serverUpdateProhibited"} $dom->{"statuses"}{"clientUpdateProhibited"} $dom->{"statuses"}{"serverDeleteProhibited"} $dom->{"statuses"}{"clientDeleteProhibited"} $dom->{"statuses"}{"pendingDelete"}
Truth table33%2/6
A or B or C or D or E
A= $dom->{"statuses"}{"serverUpdateProhibited"}B= $dom->{"statuses"}{"clientUpdateProhibited"}C= $dom->{"statuses"}{"serverDeleteProhibited"}D= $dom->{"statuses"}{"clientDeleteProhibited"}E= $dom->{"statuses"}{"pendingDelete"}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
1853 1 return _fail_answ( $cltrid, '2304', 'Object status prohibits operation' );
1854 }
1855  
1856 1 for my $ns ( keys %{$dom->{hosts}} ) {
1857 1 ▶ if ( $nss->{$ns}{statuses}{linked} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$ns}{"statuses"}{"linked"}) 0 1 1
1858 0 $nss->{$ns}{statuses}{linked}--;
1859  
1860 0 ▶ if ( $nss->{$ns}{statuses}{linked} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nss->{$ns}{"statuses"}{"linked"} == 0) 0 0 0
1861 0 delete $nss->{$ns}{statuses}{linked};
1862 }
1863 }
1864 }
1865  
1866 1 $dom->{statuses}{pendingDelete} = '+';
1867 1 $dom->{del_date} = $dom->{upd_date} = get_date();
1868 1 $dom->{updater} = $obj->{user};
1869  
1870 1 return _min_answ( $cltrid );
1871 }
1872  
1873  
1874 sub logout {
1875 28 ▶ my ( $body ) = @_;
Subroutine logout: called CC=8 SCAR=25.9
Pod undocumented
1876  
1877 28 ▶ unless ( $body =~ s|^<\?xml version="1.0" encoding="UTF-8"\?>\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>\s+//s) 0 28 28
1878 0 return _fail_schema( q|Line....: 1
1879 Column..: 2
1880 Message.: : The markup in the document preceding the root element must be well-formed.| );
1881 }
1882  
1883 28 ▶ unless ( $body =~ s|^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/^<epp xmlns="[^"]+" xmlns:xsi="[^"]+" xsi:schemaLocation="[^"]+">\s+//s) 0 28 28
1884 0 return _fail_schema( q|Line....: 2
1885 Column..: 173
1886 Message.: : cvc-complex-type.3.2.2: Attribute 'xxx' is not allowed to appear in element 'epp'.| );
1887 }
1888  
1889 28 ▶ unless ( $body =~ s|\s*</epp>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[\s*</epp>\s*][]s) 0 28 28
1890 0 return _fail_schema( q|Line....: 11111
1891 Column..: 6
1892 Message.: : The end-tag for element type "epp" must end with a '&gt;' delimiter.| );
1893 }
1894  
1895 28 ▶ unless ( $body =~ s|<command>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s/<command>\s*//s) 0 28 28
1896 0 return _fail_schema( q|Line....: 3
1897 Column..: 12
1898 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":greeting, "urn:ietf:params:xml:ns:epp-1.0":hello, "urn:ietf:params:xml:ns:epp-1.0":command, "urn:ietf:params:xml:ns:epp-1.0":response, "urn:ietf:params:xml:ns:epp-1.0":extension}' is expected.| );
1899 }
1900  
1901 28 ▶ unless ( $body =~ s|\s*</command>||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[\s*</command>][]s) 0 28 28
1902 0 return _fail_schema( q|Line....: 22222
1903 Column..: 11
1904 Message.: : The end-tag for element type "command" must end with a '&gt;' delimiter.| );
1905 }
1906  
1907 28 my ( $cltrid ) = $body =~ m|<clTRID>([0-9A-Za-z\-]+)</clTRID>|;
1908  
1909 28 ▶ unless ( $cltrid ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cltrid) 0 28 28
1910 0 return _fail_schema( q|Line....: 11111
1911 Column..: 22222
1912 Message.: : cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '3' for type 'trIDStringType'.| );
1913 }
1914  
1915 28 ▶ unless ( $body =~ s|<logout/>\s*||s ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($body =~ s[<logout/>\s*][]s) 0 28 28
1916 0 return _fail_schema( q|Line....: 4
1917 Column..: 13
1918 Message.: : cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxxx'. One of '{"urn:ietf:params:xml:ns:epp-1.0":check, "urn:ietf:params:xml:ns:epp-1.0":create, "urn:ietf:params:xml:ns:epp-1.0":delete, "urn:ietf:params:xml:ns:epp-1.0":info, "urn:ietf:params:xml:ns:epp-1.0":login, "urn:ietf:params:xml:ns:epp-1.0":logout, "urn:ietf:params:xml:ns:epp-1.0":poll, "urn:ietf:params:xml:ns:epp-1.0":renew, "urn:ietf:params:xml:ns:epp-1.0":transfer, "urn:ietf:params:xml:ns:epp-1.0":update}' is expected.| );
1919 }
1920  
1921 28 my $svtrid = get_svtrid();
1922  
1923 28 return qq|<?xml version="1.0" encoding="UTF-8"?><epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns="urn:ietf:params:xml:ns:epp-1.0"><response><result code="1500"><msg>Command completed successfully; ending session</msg></result><trID><clTRID>$cltrid</clTRID><svTRID>$svtrid</svTRID></trID></response></epp>|;
1924 }
1925  
1926 1 1;
« EPP/RRPProxy.pm ↑ Summary EPP/CoreNic.pm »