DRI/Protocol/EPP/Extensions/SecDNS.pm

filter: Statementstmt 7.4% 13 / 174 Branchbran 0.0% 0 / 122 Conditioncond 0.0% 0 / 54 MC/DCmcdc 0.0% 0 / 26 Subroutinesub 23.5% 4 / 17 Podpod 0.0% 0 / 13 totaltotal 4.1% 17 / 406 CC 84 SCAR 56.0
CC
84
Cov
4%
update
702.0
add_interfaces
272.0
format_dsdata
182.0
CRAP 269.3
« DRI/Protocol/EPP/Extensions/PL/Domain.pm ↑ Summary DRI/Protocol/RRI/Contact.pm »
1 ## Domain Registry Interface, EPP DNS Security Extensions (RFC4310 & RFC5910)
2 ##
3 ## Copyright (c) 2005-2010,2012-2013,2018-2019 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-2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my ($class,$po,$version)=@_;
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 0 ▶{
Subroutine format_dsdata: not called CC=13 SCAR=52.0
Pod undocumented
94 0 my ($e,$nomsl)=@_;
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 0 ▶{
Subroutine format_keydata: not called CC=6 SCAR=37.4
Pod undocumented
126 0 my ($e)=@_;
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 0 ▶{
Subroutine parse_greeting: not called CC=6 SCAR=37.4
Pod undocumented
141 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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 0 ▶{
Subroutine parse_dsdata: not called CC=4 SCAR=30.0
Pod undocumented
169 0 my ($node)=@_;
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 0 ▶{
Subroutine parse_keydata: not called CC=3 SCAR=24.8
Pod undocumented
188 0 my ($node,$rn)=@_;
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 0 ▶{
Subroutine info_parse: not called CC=10 SCAR=47.0
Pod undocumented
203 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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 0 ▶{
Subroutine create: not called CC=5 SCAR=34.0
Pod undocumented
247 0 my ($epp,$domain,$rd)=@_;
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 @n;
255 0 ▶ if ($mes->ns('secDNS')=~m/1\.0/)
Branch: 1 branch
BranchTrueFalseTotal
if ($mes->ns('secDNS') =~ /1\.0/) { } 0 0 0
256 {
257 0 @n=map { ['secDNS:dsData',format_dsdata($_,0)] } (@{$rd->{secdns}});
258 } else ## secDNS-1.1
259 {
260 0 push @n,add_maxsiglife($rd->{secdns});
261 0 push @n,add_interfaces($rd->{secdns});
262 }
263 0 $mes->command_extension('secDNS', ['create', @n]);
264 0 return;
265 }
266  
267 sub add_maxsiglife
268 0 ▶{
Subroutine add_maxsiglife: not called CC=4 SCAR=30.0
Pod undocumented
269 0 my ($ra)=@_;
270  
271 0 my %msl=map { 0+$_->{maxSigLife} => 1 } grep { exists $_->{maxSigLife} } @$ra;
272 0 ▶ return unless %msl;
Branch: 1 branch
BranchTrueFalseTotal
unless %msl 0 0 0
273  
274 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
275 0 my $msl=(keys(%msl))[0];
276 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
277 0 return ['secDNS:maxSigLife',$msl];
278 }
279  
280 sub add_interfaces
281 0 ▶{
Subroutine add_interfaces: not called CC=16 SCAR=56.1
Pod undocumented
282 0 my ($ra)=@_;
283  
284 0 ▶ my $cd=grep { exists $_->{keyTag} || exists $_->{alg} || exists $_->{digestType} || exists $_->{digest} } @$ra;
Condition0%0/9
exists $_->{'keyTag'} || exists $_->{'alg'} || exists $_->{'digestType'} || exists $_->{'digest'}
l!l&&r!l&&!r
000
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/4
exists $_->{'keyTag'} || exists $_->{'alg'} || exists $_->{'digestType'} || exists $_->{'digest'}
exists $_->{"keyTag"} exists $_->{"alg"} exists $_->{"digestType"} exists $_->{'digest'}
Truth table0%0/5
A or B or C || D
A= exists $_->{"keyTag"}B= exists $_->{"alg"}C= exists $_->{"digestType"}D= exists $_->{'digest'}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
285 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;
Condition0%0/21
(exists $_->{'key_flags'} || exists $_->{'key_protocol'} || exists $_->{'key_alg'} || exists $_->{'key_pubKey'}) && !exists $_->{'keyTag'} && !exists $_->{'alg'} && !exists $_->{'digestType'} && !exists $_->{'digest'}
!ll&&!rl&&r
000
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/8
(exists $_->{'key_flags'} || exists $_->{'key_protocol'} || exists $_->{'key_alg'} || exists $_->{'key_pubKey'}) && !exists $_->{'keyTag'} && !exists $_->{'alg'} && !exists $_->{'digestType'} && !exists $_->{'digest'}
exists $_->{"key_flags"} exists $_->{"key_protocol"} exists $_->{"key_alg"} exists $_->{"key_pubKey"} not exists $_->{"keyTag"} not exists $_->{"alg"} not exists $_->{"digestType"} !exists $_->{'digest'}
Truth table0%0/21
A or B or C or D and not(E) and not(F) and not(G) && not(H)
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"}H= !exists $_->{'digest'}
ABCDEFGHresult
0000XXXX0
1XXX0XXX0
01XX0XXX0
001X0XXX0
00010XXX0
1XXX10XX0
01XX10XX0
001X10XX0
000110XX0
1XXX110X0
01XX110X0
001X110X0
0001110X0
1XXX11100
01XX11100
001X11100
000111100
1XXX11111
01XX11111
001X11111
000111111
286 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
287 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
288 0 ▶ return $cd ? map { ['secDNS:dsData',format_dsdata($_,1)] } @$ra : map { ['secDNS:keyData',format_keydata($_)] } @$ra;
Branch: 1 branch
BranchTrueFalseTotal
$cd ? : 0 0 0
289 }
290  
291 sub update
292 0 ▶{
Subroutine update: not called CC=26 SCAR=65.5
Pod undocumented
293 0 my ($epp,$domain,$todo)=@_;
294 0 my $mes=$epp->message();
295  
296 0 my $toadd=$todo->add('secdns');
297 0 my $todel=$todo->del('secdns');
298 0 my $toset=$todo->set('secdns');
299 0 my $urgent=$todo->set('secdns_urgent');
300  
301 0 my @def=grep { defined } ($toadd,$todel,$toset);
302 0 ▶ return unless @def; ## no updates asked
Branch: 1 branch
BranchTrueFalseTotal
unless @def 0 0 0
303  
304 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
305 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
306  
307 0 my @n;
308  
309 0 ▶ if ($ver eq '1.0')
Branch: 1 branch
BranchTrueFalseTotal
if ($ver eq '1.0') { } 0 0 0
310 {
311 0 ▶ if (defined $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $todel) 0 0 0
312 {
313 0 my @nn;
314 0 ▶ foreach my $e (ref $todel eq 'ARRAY' ? @$todel : ($todel))
Branch: 1 branch
BranchTrueFalseTotal
ref $todel eq 'ARRAY' ? : 0 0 0
315 {
316 0 ▶ $e=$e->{keyTag} if ref $e eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $e eq "HASH" 0 0 0
317 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
318 0 push @nn,['secDNS:keyTag',$e];
319 }
320 0 push @n,['secDNS:rem',@nn];
321 }
322 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
323 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
324 } else ## secDNS-1.1
325 {
326 0 ▶ if (defined $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $todel) 0 0 0
327 {
328 0 ▶ if (! ref $todel)
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $todel) { } 0 0 0
329 {
330 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
331 0 push @n,['secDNS:rem',['secDNS:all','true']];
332 } else
333 {
334 0 ▶ push @n,['secDNS:rem',add_interfaces(ref $todel eq 'ARRAY' ? $todel : [ $todel ] )];
Branch: 1 branch
BranchTrueFalseTotal
ref $todel eq 'ARRAY' ? : 0 0 0
335 }
336 }
337 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
338 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
339 }
340  
341 0 ▶ $mes->command_extension('secDNS', ['update', defined $urgent && $urgent ? { urgent => 1 } : {}, @n]);
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
342 0 return;
343 }
344  
345 ####################################################################################################
346 1 1;
« DRI/Protocol/EPP/Extensions/PL/Domain.pm ↑ Summary DRI/Protocol/RRI/Contact.pm »