DRI/Protocol/EPP/Extensions/SecDNS.pm

filter: Statementstmt 7.3% 13 / 177 Branchbran 0.0% 0 / 128 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 26 Subroutinesub 23.5% 4 / 17 Podpod 0.0% 0 / 13 totaltotal 4.1% 17 / 412 CC 86 SCAR 57.3
CC
86
Cov
4%
update
812.0
add_interfaces
272.0
format_dsdata
182.0
CRAP 308.0
« DRI/Protocol/EPP/Extensions/AU/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/CZ/Domain.pm »
1 ## Domain Registry Interface, EPP DNS Security Extensions (RFC4310 & RFC5910)
2 ##
3 ## Copyright (c) 2005-2010,2012-2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::SecDNS;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::SecDNS - EPP DNS Security Extensions (version 1.0 in RFC4310 & version 1.1 in RFC5910) for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2005-2010,2012-2013,2018 Patrick Mevzek <netdri@dotandco.com>.
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ####################################################################################################
64  
65 sub register_commands
66 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my %s=(
69 'connect' => [ undef, \&parse_greeting ],
70 noop => [ undef, \&parse_greeting ],
71 );
72 0 my %d=(
73 info => [ undef, \&info_parse ],
74 create => [ \&create, undef ],
75 update => [ \&update, undef ],
76 );
77  
78 0 return { 'domain' => \%d, 'session' => \%s };
79 }
80  
81 0 ▶sub capabilities_add { return (['domain_update','secdns',['add','del','set']],['domain_update','secdns_urgent',['set']]); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
82  
83 sub setup
84 {
85 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
86 0 $po->ns({ 'secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.0' }); ## this will get bumped to secDNS-1.1 after login if server supports it, until all registry servers have been upgraded to 1.1
87 0 return;
88 }
89  
90 ####################################################################################################
91  
92 sub format_dsdata
93 {
94 0 ▶ my ($e,$nomsl)=@_;
Subroutine format_dsdata: not called CC=13 SCAR=52.0
Pod undocumented
95  
96 0 my @mk=grep { ! Net::DRI::Util::has_key($e,$_) } qw/keyTag alg digestType digest/;
97 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Attributes missing: '.join(' ',@mk)) if @mk;
Branch: 1 branch
BranchTrueFalseTotal
if @mk 0 0 0
98 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('keyTag must be 16-bit unsigned integer: '.$e->{keyTag}) unless Net::DRI::Util::verify_ushort($e->{keyTag});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ushort($e->{"keyTag"}) 0 0 0
99 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('alg must be an unsigned byte: '.$e->{alg}) unless Net::DRI::Util::verify_ubyte($e->{alg});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ubyte($e->{"alg"}) 0 0 0
100 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('digestType must be an unsigned byte: '.$e->{digestType}) unless Net::DRI::Util::verify_ubyte($e->{digestType});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ubyte($e->{"digestType"}) 0 0 0
101 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('digest must be hexadecimal: '.$e->{digest}) unless Net::DRI::Util::verify_hex($e->{digest});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_hex($e->{"digest"}) 0 0 0
102  
103 0 my @c;
104 0 push @c,['secDNS:keyTag',$e->{keyTag}];
105 0 push @c,['secDNS:alg',$e->{alg}];
106 0 push @c,['secDNS:digestType',$e->{digestType}];
107 0 push @c,['secDNS:digest',$e->{digest}];
108  
109 0 ▶ if (exists $e->{maxSigLife} && ! $nomsl)
Branch: 1 branch
BranchTrueFalseTotal
if (exists $e->{"maxSigLife"} and not $nomsl) 0 0 0
Condition0%0/3
exists $e->{"maxSigLife"} and not $nomsl
!ll&&!rl&&r
000
MC/DC0%0/2
exists $e->{"maxSigLife"} and not $nomsl
exists $e->{"maxSigLife"} not $nomsl
Truth table0%0/3
A and not(B)
A= exists $e->{"maxSigLife"}B= not $nomsl
ABresult
0X0
100
111
110 {
111 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('maxSigLife must be a positive integer: '.$e->{maxSigLife}) unless Net::DRI::Util::verify_int($e->{maxSigLife},1);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_int($e->{"maxSigLife"}, 1) 0 0 0
112 0 push @c,['secDNS:maxSigLife',$e->{maxSigLife}];
113 }
114  
115 ## If one key attribute is provided, all of them should be (this is verified in format_keydata)
116 0 ▶ if (exists $e->{key_flags} || exists $e->{key_protocol} || exists $e->{key_alg} || exists $e->{key_pubKey})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $e->{"key_flags"} or exists $e->{"key_protocol"} or exists $e->{"key_alg"} or exists $e->{"key_pubKey"}) 0 0 0
Condition0%0/9
exists $e->{"key_flags"} or exists $e->{"key_protocol"} or exists $e->{"key_alg"} or exists $e->{"key_pubKey"}
l!l&&r!l&&!r
000
exists $e->{"key_flags"} or exists $e->{"key_protocol"} or exists $e->{"key_alg"}
l!l&&r!l&&!r
000
exists $e->{"key_flags"} or exists $e->{"key_protocol"}
l!l&&r!l&&!r
000
MC/DC0%0/4
exists $e->{"key_flags"} or exists $e->{"key_protocol"} or exists $e->{"key_alg"} or exists $e->{"key_pubKey"}
exists $e->{"key_flags"} exists $e->{"key_protocol"} exists $e->{"key_alg"} exists $e->{"key_pubKey"}
Truth table0%0/5
A or B or C or D
A= exists $e->{"key_flags"}B= exists $e->{"key_protocol"}C= exists $e->{"key_alg"}D= exists $e->{"key_pubKey"}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
117 {
118 0 push @c,['secDNS:keyData',format_keydata($e)];
119 }
120  
121 0 return @c;
122 }
123  
124 sub format_keydata
125 {
126 0 ▶ my ($e)=@_;
Subroutine format_keydata: not called CC=6 SCAR=37.4
Pod undocumented
127  
128 0 my @mk=grep { ! Net::DRI::Util::has_key($e,$_) } qw/key_flags key_protocol key_alg key_pubKey/;
129 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Attributes missing: '.join(' ',@mk)) if @mk;
Branch: 1 branch
BranchTrueFalseTotal
if @mk 0 0 0
130  
131 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('key_flags mut be a 16-bit unsigned integer: '.$e->{key_flags}) unless Net::DRI::Util::verify_ushort($e->{key_flags});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ushort($e->{"key_flags"}) 0 0 0
132 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('key_protocol must be an unsigned byte: '.$e->{key_protocol}) unless Net::DRI::Util::verify_ubyte($e->{key_protocol});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ubyte($e->{"key_protocol"}) 0 0 0
133 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('key_alg must be an unsigned byte: '.$e->{key_alg}) unless Net::DRI::Util::verify_ubyte($e->{key_alg});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ubyte($e->{"key_alg"}) 0 0 0
134 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('key_pubKey must be a non empty base64 string: '.$e->{key_pubKey}) unless Net::DRI::Util::verify_base64($e->{key_pubKey},1);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_base64($e->{"key_pubKey"}, 1) 0 0 0
135  
136 0 return (['secDNS:flags',$e->{key_flags}],['secDNS:protocol',$e->{key_protocol}],['secDNS:alg',$e->{key_alg}],['secDNS:pubKey',$e->{key_pubKey}]);
137 }
138  
139 sub parse_greeting
140 {
141 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine parse_greeting: not called CC=6 SCAR=37.4
Pod undocumented
142 0 my $mes=$po->message();
143  
144 0 ▶ return unless defined $mes->node_greeting(); ## only work here for true greeting reply handling, not for all polling responses !
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mes->node_greeting 0 0 0
145  
146 0 my $rs=$po->default_parameters()->{server};
147 0 my @v=grep { m/^urn:ietf:params:xml:ns:secDNS-\S+$/ } @{$rs->{extensions_selected}};
148 ##Net::DRI::Exception::err_invalid_parameters('Net::DRI::Protocol::EPP::Extensions::SecDNS was loaded but server does not support the secDNS extension!') unless @v;
149 0 ▶ return unless @v;
Branch: 1 branch
BranchTrueFalseTotal
unless @v 0 0 0
150 0 ▶ Net::DRI::Exception::err_invalid_parameters('Net::DRI::Protocol::EPP::Extensions::SecDNS supports only versions 1.0 or 1.1, but the server announced: '.join(' ',@v)) if grep { ! /^urn:ietf:params:xml:ns:secDNS-1\.[01]$/ } @v;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not /^urn:ietf:params:xml:ns:secDNS-1\.[01]$/;} @v 0 0 0
151  
152 ## If server supports secDNS-1.1 we switch to it completely
153 0 ▶ if (grep { m/1\.1/ } @v)
Branch: 1 branch
BranchTrueFalseTotal
if (grep {/1\.1/;} @v) { } 0 0 0
154 {
155 0 $po->ns({ 'secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1' });
156 0 ▶ $rs->{extensions_selected}=[ grep { ! m/^urn:ietf:params:xml:ns:secDNS-1.0$/ } @{$rs->{extensions_selected}} ] if grep { m/1\.0/ } @v;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/1\.0/;} @v 0 0 0
157 } else
158 {
159 0 $po->ns({ 'secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.0' });
160 }
161 0 return;
162 }
163  
164 ####################################################################################################
165 ########### Query commands
166  
167 sub parse_dsdata
168 {
169 0 ▶ my ($node)=@_;
Subroutine parse_dsdata: not called CC=4 SCAR=30.0
Pod undocumented
170  
171 0 my %n;
172 0 foreach my $sel (Net::DRI::Util::xml_list_children($node))
173 {
174 0 my ($name,$c)=@$sel;
175 0 ▶ if ($name=~m/^(keyTag|alg|digestType|digest|maxSigLife)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /^(keyTag|alg|digestType|digest|maxSigLife)$/) { } 0 0 0
elsif ($name eq 'keyData') { } 0 0 0
176 {
177 0 $n{$1}=$c->textContent();
178 } elsif ($name eq 'keyData')
179 {
180 0 parse_keydata($c,\%n);
181 }
182 }
183 0 return \%n;
184 }
185  
186 sub parse_keydata
187 {
188 0 ▶ my ($node,$rn)=@_;
Subroutine parse_keydata: not called CC=3 SCAR=24.8
Pod undocumented
189  
190 0 foreach my $el (Net::DRI::Util::xml_list_children($node))
191 {
192 0 my ($name,$c)=@$el;
193 0 ▶ if ($name=~m/^(flags|protocol|alg|pubKey)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(flags|protocol|alg|pubKey)$/) 0 0 0
194 {
195 0 $rn->{'key_'.$1}=$c->textContent();
196 }
197 }
198 0 return;
199 }
200  
201 sub info_parse
202 {
203 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=10 SCAR=47.0
Pod undocumented
204 0 my $mes=$po->message();
205 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
206  
207 0 my $infdata=$mes->get_extension('secDNS','infData');
208 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
209  
210 0 my @d;
211 0 my $ns=$mes->ns('secDNS');
212 0 ▶ if ($ns=~m/1\.0/)
Branch: 1 branch
BranchTrueFalseTotal
if ($ns =~ /1\.0/) { } 0 0 0
213 {
214 0 @d=map { parse_dsdata($_) } ($infdata->getChildrenByTagNameNS($ns,'dsData'));
215 } else ## secDNS-1.1
216 {
217 0 my $msl;
218 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
219 {
220 0 my ($name,$c)=@$el;
221 0 ▶ if ($name eq 'maxSigLife')
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'maxSigLife') { } 0 0 0
elsif ($name eq 'dsData') { } 0 0 0
elsif ($name eq 'keyData') { } 0 0 0
222 {
223 0 $msl=0+$c->textContent();
224 } elsif ($name eq 'dsData')
225 {
226 0 my $rn=parse_dsdata($c);
227 0 ▶ $rn->{maxSigLife}=$msl if defined $msl;
Branch: 1 branch
BranchTrueFalseTotal
if defined $msl 0 0 0
228 0 push @d,$rn;
229 } elsif ($name eq 'keyData')
230 {
231 0 my %n;
232 0 parse_keydata($c,\%n);
233 0 ▶ $n{maxSigLife}=$msl if defined $msl;
Branch: 1 branch
BranchTrueFalseTotal
if defined $msl 0 0 0
234 0 push @d,\%n;
235 }
236 }
237 }
238  
239 0 $rinfo->{domain}->{$oname}->{secdns}=\@d;
240 0 return;
241 }
242  
243 ############ Transform commands
244  
245 sub create
246 {
247 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=5 SCAR=34.0
Pod undocumented
248 0 my $mes=$epp->message();
249  
250 0 ▶ return unless Net::DRI::Util::has_key($rd,'secdns');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "secdns") 0 0 0
251 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('secdns value must be an array reference with key data') unless ref $rd->{secdns} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $rd->{"secdns"} eq "ARRAY" 0 0 0
252 0 ▶ return unless @{$rd->{secdns}};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$rd->{"secdns"};} 0 0 0
253  
254 0 my $eid=$mes->command_extension_register('secDNS','create');
255 0 my @n;
256 0 ▶ if ($mes->ns('secDNS')=~m/1\.0/)
Branch: 1 branch
BranchTrueFalseTotal
if ($mes->ns('secDNS') =~ /1\.0/) { } 0 0 0
257 {
258 0 @n=map { ['secDNS:dsData',format_dsdata($_,0)] } (@{$rd->{secdns}});
259 } else ## secDNS-1.1
260 {
261 0 push @n,add_maxsiglife($rd->{secdns});
262 0 push @n,add_interfaces($rd->{secdns});
263 }
264 0 $mes->command_extension($eid,\@n);
265 0 return;
266 }
267  
268 sub add_maxsiglife
269 {
270 0 ▶ my ($ra)=@_;
Subroutine add_maxsiglife: not called CC=4 SCAR=30.0
Pod undocumented
271  
272 0 my %msl=map { 0+$_->{maxSigLife} => 1 } grep { exists $_->{maxSigLife} } @$ra;
273 0 ▶ return unless %msl;
Branch: 1 branch
BranchTrueFalseTotal
unless %msl 0 0 0
274  
275 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Multiple distinct maxSigLife provided') if keys(%msl) > 1;
Branch: 1 branch
BranchTrueFalseTotal
if keys %msl > 1 0 0 0
276 0 my $msl=(keys(%msl))[0];
277 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('maxSigLife must be a positive integer: '.$msl) unless Net::DRI::Util::verify_int($msl,1);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_int($msl, 1) 0 0 0
278 0 return ['secDNS:maxSigLife',$msl];
279 }
280  
281 sub add_interfaces
282 {
283 0 ▶ my ($ra)=@_;
Subroutine add_interfaces: not called CC=16 SCAR=56.1
Pod undocumented
284  
285 0 ▶ my $cd=grep { exists $_->{keyTag} || exists $_->{alg} || exists $_->{digestType} || exists $_->{digest} } @$ra;
Branch: 1 branch
BranchTrueFalseTotal
exists $_->{"keyTag"} or exists $_->{"alg"} or exists $_->{"digestType"} or exists $_->{"digest"} 0 0 0
Condition0%0/6
exists $_->{"keyTag"} or exists $_->{"alg"} or exists $_->{"digestType"}
l!l&&r!l&&!r
000
exists $_->{"keyTag"} or exists $_->{"alg"}
l!l&&r!l&&!r
000
MC/DC0%0/3
exists $_->{"keyTag"} or exists $_->{"alg"} or exists $_->{"digestType"}
exists $_->{"keyTag"} exists $_->{"alg"} exists $_->{"digestType"}
Truth table0%0/4
A or B or C
A= exists $_->{"keyTag"}B= exists $_->{"alg"}C= exists $_->{"digestType"}
ABCresult
1XX1
01X1
0011
0000
286 0 ▶ my $ck=grep { (exists $_->{key_flags} || exists $_->{key_protocol} || exists $_->{key_alg} || exists $_->{key_pubKey}) && ! exists $_->{keyTag} && ! exists $_->{alg} && ! exists $_->{digestType} && ! exists $_->{digest} } @$ra;
Branch: 1 branch
BranchTrueFalseTotal
exists $_->{"key_flags"} || exists $_->{"key_protocol"} || exists $_->{"key_alg"} || exists $_->{"key_pubKey"} and not exists $_->{"keyTag"} and not exists $_->{"alg"} and not exists $_->{"digestType"} and not exists $_->{"digest"} 0 0 0
Condition0%0/18
exists $_->{"key_flags"} || exists $_->{"key_protocol"} || exists $_->{"key_alg"} || exists $_->{"key_pubKey"} and not exists $_->{"keyTag"} and not exists $_->{"alg"} and not exists $_->{"digestType"}
!ll&&!rl&&r
000
exists $_->{"key_flags"} || exists $_->{"key_protocol"} || exists $_->{"key_alg"} || exists $_->{"key_pubKey"} and not exists $_->{"keyTag"} and not exists $_->{"alg"}
!ll&&!rl&&r
000
exists $_->{"key_flags"} || exists $_->{"key_protocol"} || exists $_->{"key_alg"} || exists $_->{"key_pubKey"} and not exists $_->{"keyTag"}
!ll&&!rl&&r
000
exists $_->{"key_flags"} or exists $_->{"key_protocol"} or exists $_->{"key_alg"} or exists $_->{"key_pubKey"}
l!l&&r!l&&!r
000
exists $_->{"key_flags"} or exists $_->{"key_protocol"} or exists $_->{"key_alg"}
l!l&&r!l&&!r
000
exists $_->{"key_flags"} or exists $_->{"key_protocol"}
l!l&&r!l&&!r
000
MC/DC0%0/7
exists $_->{"key_flags"} || exists $_->{"key_protocol"} || exists $_->{"key_alg"} || exists $_->{"key_pubKey"} and not exists $_->{"keyTag"} and not exists $_->{"alg"} and not exists $_->{"digestType"}
exists $_->{"key_flags"} exists $_->{"key_protocol"} exists $_->{"key_alg"} exists $_->{"key_pubKey"} not exists $_->{"keyTag"} not exists $_->{"alg"} not exists $_->{"digestType"}
Truth table0%0/17
A or B or C or D and not(E) and not(F) and not(G)
A= exists $_->{"key_flags"}B= exists $_->{"key_protocol"}C= exists $_->{"key_alg"}D= exists $_->{"key_pubKey"}E= not exists $_->{"keyTag"}F= not exists $_->{"alg"}G= not exists $_->{"digestType"}
ABCDEFGresult
0000XXX0
1XXX0XX0
01XX0XX0
001X0XX0
00010XX0
1XXX10X0
01XX10X0
001X10X0
000110X0
1XXX1100
01XX1100
001X1100
00011100
1XXX1111
01XX1111
001X1111
00011111
287 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Unknown secDNS data provided') unless $cd || $ck;
Branch: 1 branch
BranchTrueFalseTotal
unless $cd or $ck 0 0 0
Condition0%0/3
$cd or $ck
l!l&&r!l&&!r
000
MC/DC0%0/2
$cd or $ck
$cd $ck
Truth table0%0/3
A or B
A= $cdB= $ck
ABresult
1X1
011
000
288 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('In secDNS-1.1 you can not mix dsData and keyData blocks') if $cd && $ck;
Branch: 1 branch
BranchTrueFalseTotal
if $cd and $ck 0 0 0
Condition0%0/3
$cd and $ck
!ll&&!rl&&r
000
MC/DC0%0/2
$cd and $ck
$cd $ck
Truth table0%0/3
A and B
A= $cdB= $ck
ABresult
0X0
100
111
289 0 ▶ return $cd ? map { ['secDNS:dsData',format_dsdata($_,1)] } @$ra : map { ['secDNS:keyData',format_keydata($_)] } @$ra;
Branch: 1 branch
BranchTrueFalseTotal
$cd ? : 0 0 0
290 }
291  
292 sub update
293 {
294 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=28 SCAR=67.0
Pod undocumented
295 0 my $mes=$epp->message();
296  
297 0 my $toadd=$todo->add('secdns');
298 0 my $todel=$todo->del('secdns');
299 0 my $toset=$todo->set('secdns');
300 0 my $urgent=$todo->set('secdns_urgent');
301  
302 0 my @def=grep { defined } ($toadd,$todel,$toset);
303 0 ▶ return unless @def; ## no updates asked
Branch: 1 branch
BranchTrueFalseTotal
unless @def 0 0 0
304  
305 0 ▶ my $ver=(grep { /-1\.1$/ } $mes->ns('secDNS'))? '1.1' : '1.0';
Branch: 1 branch
BranchTrueFalseTotal
grep({/-1\.1$/;} $mes->ns('secDNS')) ? : 0 0 0
306 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('In SecDNS-1.0, only add or del or chg is possible, not more than one of them') if ($ver eq '1.0' && @def>1);
Branch: 1 branch
BranchTrueFalseTotal
if $ver eq "1.0" and @def > 1 0 0 0
Condition0%0/3
$ver eq "1.0" and @def > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$ver eq "1.0" and @def > 1
$ver eq "1.0" @def > 1
Truth table0%0/3
A and B
A= $ver eq "1.0"B= @def > 1
ABresult
0X0
100
111
307  
308 0 ▶ my $urg=(defined $urgent && $urgent)? 'urgent="1" ' : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $urgent && $urgent ? : 0 0 0
Condition0%0/3
defined $urgent and $urgent
!ll&&!rl&&r
000
MC/DC0%0/2
defined $urgent and $urgent
defined $urgent $urgent
Truth table0%0/3
A and B
A= defined $urgentB= $urgent
ABresult
0X0
100
111
309 0 ▶ my $eid=$mes->command_extension_register('secDNS','update',defined $urgent && $urgent ? { urgent => 1 } : {});
Branch: 1 branch
BranchTrueFalseTotal
defined $urgent && $urgent ? : 0 0 0
Condition0%0/3
defined $urgent and $urgent
!ll&&!rl&&r
000
MC/DC0%0/2
defined $urgent and $urgent
defined $urgent $urgent
Truth table0%0/3
A and B
A= defined $urgentB= $urgent
ABresult
0X0
100
111
310  
311 0 my @n;
312  
313 0 ▶ if ($ver eq '1.0')
Branch: 1 branch
BranchTrueFalseTotal
if ($ver eq '1.0') { } 0 0 0
314 {
315 0 ▶ if (defined $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $todel) 0 0 0
316 {
317 0 my @nn;
318 0 ▶ foreach my $e (ref $todel eq 'ARRAY' ? @$todel : ($todel))
Branch: 1 branch
BranchTrueFalseTotal
ref $todel eq 'ARRAY' ? : 0 0 0
319 {
320 0 ▶ $e=$e->{keyTag} if ref $e eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $e eq "HASH" 0 0 0
321 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('keyTag must be 16-bit unsigned integer: '.$e) unless Net::DRI::Util::verify_ushort($e);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_ushort($e) 0 0 0
322 0 push @nn,['secDNS:keyTag',$e];
323 }
324 0 push @n,['secDNS:rem',@nn];
325 }
326 0 ▶ push @n,['secDNS:add',map { ['secDNS:dsData',format_dsdata($_,0)] } (ref $toadd eq 'ARRAY')? @$toadd : ($toadd)] if defined $toadd;
Branch: 2 branches
BranchTrueFalseTotal
if defined $toadd 0 0 0
ref $toadd eq 'ARRAY' ? : 0 0 0
327 0 ▶ push @n,['secDNS:chg',map { ['secDNS:dsData',format_dsdata($_,0)] } (ref $toset eq 'ARRAY')? @$toset : ($toset)] if defined $toset;
Branch: 2 branches
BranchTrueFalseTotal
if defined $toset 0 0 0
ref $toset eq 'ARRAY' ? : 0 0 0
328 } else ## secDNS-1.1
329 {
330 0 ▶ if (defined $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $todel) 0 0 0
331 {
332 0 ▶ if (! ref $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $todel) { } 0 0 0
333 {
334 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('In delete, only string allowed is "all", not: '.$todel) unless $todel eq 'all';
Branch: 1 branch
BranchTrueFalseTotal
unless $todel eq "all" 0 0 0
335 0 push @n,['secDNS:rem',['secDNS:all','true']];
336 } else
337 {
338 0 ▶ push @n,['secDNS:rem',add_interfaces(ref $todel eq 'ARRAY' ? $todel : [ $todel ] )];
Branch: 1 branch
BranchTrueFalseTotal
ref $todel eq 'ARRAY' ? : 0 0 0
339 }
340 }
341 0 ▶ push @n,['secDNS:add',add_interfaces(ref $toadd eq 'ARRAY' ? $toadd : [ $toadd ] )] if defined $toadd;
Branch: 2 branches
BranchTrueFalseTotal
if defined $toadd 0 0 0
ref $toadd eq 'ARRAY' ? : 0 0 0
342 0 ▶ push @n,['secDNS:chg',add_maxsiglife(ref $toset eq 'ARRAY' ? $toset: (ref $toset eq 'HASH' ? [$toset] : [{ maxSigLife=>$toset }]))] if defined $toset;
Branch: 3 branches
BranchTrueFalseTotal
if defined $toset 0 0 0
ref $toset eq 'ARRAY' ? : 0 0 0
ref $toset eq 'HASH' ? : 0 0 0
343 }
344  
345 0 $mes->command_extension($eid,\@n);
346 0 return;
347 }
348  
349 ####################################################################################################
350 1 1;
« DRI/Protocol/EPP/Extensions/AU/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/CZ/Domain.pm »