DRI/DRD.pm

filter: Statementstmt 12.8% 103 / 802 Branchbran 7.3% 36 / 490 Conditioncond 9.7% 25 / 256 MC/DCmcdc 0.0% 0 / 150 Subroutinesub 14.7% 18 / 122 Podpod 0.0% 0 / 110 totaltotal 9.4% 182 / 1930 CC 354 SCAR 54.9
CC
354
Cov
11%
domain_create
1640.0
_verify_name_rules
357.8
host_check
342.0
CRAP 241.8
« DRI/Protocol/EPP/Extensions/VeriSign/JobsContact.pm ↑ Summary DRI/Protocol/IRIS/DCHK/Domain.pm »
1 ## Domain Registry Interface, virtual superclass for all DRD modules
2 ##
3 ## Copyright (c) 2005-2013 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::DRD;
16  
17 79 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 79 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 79 ▶use base qw/Net::DRI::BaseClass/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 79 __PACKAGE__->make_exception_if_not_implemented(qw/name tlds object_types periods profile_types transport_protocol_default/); ## methods that should be in subclasses
22  
23 79 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 79 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 79 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 79 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 79 ▶use Net::DRI::DRD::ICANN;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 79 ▶use Net::DRI::Data::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 79 ▶use Net::DRI::Protocol::ResultStatus;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 =pod
33  
34 =head1 NAME
35  
36 Net::DRI::DRD - Superclass of all Net::DRI Registry Drivers
37  
38 =head1 DESCRIPTION
39  
40 Please see the README file for details.
41  
42 =head1 SUBROUTINES/METHODS
43  
44 =head2 name()
45  
46 Name of this registry driver (this should not contain any dot at all)
47  
48 =head2 tlds()
49  
50 Array of tlds (lowercase, no starting or ending dot) handled by this registry
51  
52 =head2 object_types()
53  
54 Array of object types managed by this registry
55  
56 =head2 periods()
57  
58 Array of DateTime::Duration objects for valid domain name creation durations at registry
59  
60 =head1 SUPPORT
61  
62 For now, support questions should be sent to:
63  
64 E<lt>netdri@dotandco.comE<gt>
65  
66 Please also see the SUPPORT file in the distribution.
67  
68 =head1 SEE ALSO
69  
70 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
71  
72 =head1 AUTHOR
73  
74 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
75  
76 =head1 COPYRIGHT
77  
78 Copyright (c) 2005-2013 Patrick Mevzek <netdri@dotandco.com>.
79 All rights reserved.
80  
81 This program is free software; you can redistribute it and/or modify
82 it under the terms of the GNU General Public License as published by
83 the Free Software Foundation; either version 2 of the License, or
84 (at your option) any later version.
85  
86 See the LICENSE file that comes with this distribution for more details.
87  
88 =cut
89  
90 ####################################################################################################
91  
92 sub new
93 {
94 78 ▶ my ($class,@r)=@_;
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
95 78 ▶ my $self={ info => defined $r[0] ? $r[0] : {} };
Branch: 1 branch
BranchTrueFalseTotal
defined $r[0] ? : 2 76 78
96 78 bless $self,$class;
97 78 return $self;
98 }
99  
100 sub info
101 {
102 0 ▶ my ($self,$ndr,$key)=@_;
Subroutine info: not called CC=7 SCAR=40.3
Pod undocumented
103 0 ▶ $key=$ndr unless (defined $ndr && $ndr && (ref $ndr eq 'Net::DRI::Registry'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry" 0 0 0
Condition0%0/6
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
!ll&&!rl&&r
000
defined $ndr and $ndr
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
defined $ndr $ndr ref $ndr eq "Net::DRI::Registry"
Truth table0%0/4
A and B and C
A= defined $ndrB= $ndrC= ref $ndr eq "Net::DRI::Registry"
ABCresult
0XX0
10X0
1100
1111
104 0 ▶ return unless defined $self->{info};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"info"} 0 0 0
105 0 ▶ return unless defined $key && exists $self->{info}->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key and exists $self->{"info"}{$key} 0 0 0
Condition0%0/3
defined $key and exists $self->{"info"}{$key}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $key and exists $self->{"info"}{$key}
defined $key exists $self->{"info"}{$key}
Truth table0%0/3
A and B
A= defined $keyB= exists $self->{"info"}{$key}
ABresult
0X0
100
111
106 0 return $self->{info}->{$key};
107 }
108  
109 sub is_my_tld
110 {
111 1 ▶ my ($self,$ndr,$domain,$strict)=@_;
Subroutine is_my_tld: called CC=8 SCAR=24.2
Pod undocumented
112 1 ▶ ($domain,$strict)=($ndr,$domain) unless (defined($ndr) && $ndr && (ref($ndr) eq 'Net::DRI::Registry'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry" 1 0 1
Condition33%2/6
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
!ll&&!rl&&r
010
defined $ndr and $ndr
!ll&&!rl&&r
001
MC/DC0%0/3
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
defined $ndr $ndr ref $ndr eq "Net::DRI::Registry"
Truth table25%1/4
A and B and C
A= defined $ndrB= $ndrC= ref $ndr eq "Net::DRI::Registry"
ABCresult
0XX0
10X0
1100
1111
113 1 ▶ if (! defined($strict)) { $strict=1; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $strict) 1 0 1
114 1 ▶ if ($domain=~m/\.e164\.arpa$/) { $strict=0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($domain =~ /\.e164\.arpa$/) 0 1 1
115 1 my $tlds=join('|',map { quotemeta($_) } sort { length($b) <=> length($a) } $self->tlds());
116 1 ▶ my $r=$strict? qr/^[^.]+\.(?:$tlds)$/i : qr/\.(?:$tlds)$/i;
Branch: 1 branch
BranchTrueFalseTotal
$strict ? : 1 0 1
117 1 ▶ return ($domain=~$r)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$domain =~ /$r/ ? : 1 0 1
118 }
119  
120 sub _verify_name_rules
121 {
122 1 ▶ my ($self,$domain,$op,$rules)=@_;
Subroutine _verify_name_rules: called CC=39 SCAR=58.8
123  
124 1 ▶ if (exists $rules->{check_name} && $rules->{check_name})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"check_name"} and $rules->{"check_name"}) 1 0 1
Condition33%1/3
exists $rules->{"check_name"} and $rules->{"check_name"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $rules->{"check_name"} and $rules->{"check_name"}
exists $rules->{"check_name"} $rules->{"check_name"}
Truth table33%1/3
A and B
A= exists $rules->{"check_name"}B= $rules->{"check_name"}
ABresult
0X0
100
111
125 {
126 1 my $dots=$rules->{check_name_dots};
127 1 ▶ if (! defined $dots) { $dots=$self->dots(); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $dots) 1 0 1
128 1 ▶ my $r=$self->check_name($domain,$dots,exists $rules->{check_name_unicode} ? $rules->{check_name_unicode} : 0);
Branch: 1 branch
BranchTrueFalseTotal
exists $rules->{'check_name_unicode'} ? : 0 1 1
129 1 ▶ if (length $r) { return $r; }
Branch: 1 branch
BranchTrueFalseTotal
if (length $r) 0 1 1
130 }
131  
132 1 ▶ if (exists $rules->{check_name_no_dots} && $rules->{check_name_no_dots})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"check_name_no_dots"} and $rules->{"check_name_no_dots"}) 0 1 1
Condition33%1/3
exists $rules->{"check_name_no_dots"} and $rules->{"check_name_no_dots"}
!ll&&!rl&&r
100
MC/DC0%0/2
exists $rules->{"check_name_no_dots"} and $rules->{"check_name_no_dots"}
exists $rules->{"check_name_no_dots"} $rules->{"check_name_no_dots"}
Truth table33%1/3
A and B
A= exists $rules->{"check_name_no_dots"}B= $rules->{"check_name_no_dots"}
ABresult
0X0
100
111
133 {
134 0 my $r=$self->check_name($domain);
135 0 ▶ if (length $r) { return $r; }
Branch: 1 branch
BranchTrueFalseTotal
if (length $r) 0 0 0
136 }
137  
138 1 ▶ if (exists $rules->{my_tld} && $rules->{my_tld} && ! $self->is_my_tld($domain)) { return 'NAME_NOT_IN_TLD'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"my_tld"} and $rules->{"my_tld"} and not $self->is_my_tld($domain)) 0 1 1
Condition33%2/6
exists $rules->{"my_tld"} and $rules->{"my_tld"} and not $self->is_my_tld($domain)
!ll&&!rl&&r
010
exists $rules->{"my_tld"} and $rules->{"my_tld"}
!ll&&!rl&&r
001
MC/DC0%0/3
exists $rules->{"my_tld"} and $rules->{"my_tld"} and not $self->is_my_tld($domain)
exists $rules->{"my_tld"} $rules->{"my_tld"} not $self->is_my_tld($domain)
Truth table25%1/4
A and B and not(C)
A= exists $rules->{"my_tld"}B= $rules->{"my_tld"}C= not $self->is_my_tld($domain)
ABCresult
0XX0
10X0
1100
1111
139 1 ▶ if (exists $rules->{my_tld_not_strict} && $rules->{my_tld_not_strict} && ! $self->is_my_tld($domain,0)) { return 'NAME_NOT_IN_TLD'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"my_tld_not_strict"} and $rules->{"my_tld_not_strict"} and not $self->is_my_tld($domain, 0)) 0 1 1
Condition33%2/6
exists $rules->{"my_tld_not_strict"} and $rules->{"my_tld_not_strict"} and not $self->is_my_tld($domain, 0)
!ll&&!rl&&r
100
exists $rules->{"my_tld_not_strict"} and $rules->{"my_tld_not_strict"}
!ll&&!rl&&r
100
MC/DC0%0/3
exists $rules->{"my_tld_not_strict"} and $rules->{"my_tld_not_strict"} and not $self->is_my_tld($domain, 0)
exists $rules->{"my_tld_not_strict"} $rules->{"my_tld_not_strict"} not $self->is_my_tld($domain, 0)
Truth table25%1/4
A and B and not(C)
A= exists $rules->{"my_tld_not_strict"}B= $rules->{"my_tld_not_strict"}C= not $self->is_my_tld($domain, 0)
ABCresult
0XX0
10X0
1100
1111
140 1 ▶ if (exists $rules->{icann_reserved} && $rules->{icann_reserved})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"icann_reserved"} and $rules->{"icann_reserved"}) 0 1 1
Condition33%1/3
exists $rules->{"icann_reserved"} and $rules->{"icann_reserved"}
!ll&&!rl&&r
100
MC/DC0%0/2
exists $rules->{"icann_reserved"} and $rules->{"icann_reserved"}
exists $rules->{"icann_reserved"} $rules->{"icann_reserved"}
Truth table33%1/3
A and B
A= exists $rules->{"icann_reserved"}B= $rules->{"icann_reserved"}
ABresult
0X0
100
111
141 {
142 0 my $ri=Net::DRI::DRD::ICANN::is_reserved_name($domain,$op);
143 0 ▶ return $ri if length $ri;
Branch: 1 branch
BranchTrueFalseTotal
if length $ri 0 0 0
144 }
145  
146 1 my @d=split(/\./,$domain);
147 1 ▶ if (exists $rules->{min_length} && $rules->{min_length} && length($d[0]) < $rules->{min_length}) { return 'NAME_TOO_SHORT'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"min_length"} and $rules->{"min_length"} and length $d[0] < $rules->{"min_length"}) 0 1 1
Condition33%2/6
exists $rules->{"min_length"} and $rules->{"min_length"} and length $d[0] < $rules->{"min_length"}
!ll&&!rl&&r
010
exists $rules->{"min_length"} and $rules->{"min_length"}
!ll&&!rl&&r
001
MC/DC0%0/3
exists $rules->{"min_length"} and $rules->{"min_length"} and length $d[0] < $rules->{"min_length"}
exists $rules->{"min_length"} $rules->{"min_length"} length $d[0] < $rules->{"min_length"}
Truth table25%1/4
A and B and C
A= exists $rules->{"min_length"}B= $rules->{"min_length"}C= length $d[0] < $rules->{"min_length"}
ABCresult
0XX0
10X0
1100
1111
148 1 ▶ if (exists $rules->{no_double_hyphen} && $rules->{no_double_hyphen} && substr($d[0],2,2) eq '--') { return 'NAME_WITH_TWO_HYPHENS'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"no_double_hyphen"} and $rules->{"no_double_hyphen"} and substr($d[0], 2, 2) eq "--") 0 1 1
Condition33%2/6
exists $rules->{"no_double_hyphen"} and $rules->{"no_double_hyphen"} and substr($d[0], 2, 2) eq "--"
!ll&&!rl&&r
100
exists $rules->{"no_double_hyphen"} and $rules->{"no_double_hyphen"}
!ll&&!rl&&r
100
MC/DC0%0/3
exists $rules->{"no_double_hyphen"} and $rules->{"no_double_hyphen"} and substr($d[0], 2, 2) eq "--"
exists $rules->{"no_double_hyphen"} $rules->{"no_double_hyphen"} substr($d[0], 2, 2) eq "--"
Truth table25%1/4
A and B and C
A= exists $rules->{"no_double_hyphen"}B= $rules->{"no_double_hyphen"}C= substr($d[0], 2, 2) eq "--"
ABCresult
0XX0
10X0
1100
1111
149 1 ▶ if (exists $rules->{no_double_hyphen_except_idn} && $rules->{no_double_hyphen_except_idn} && substr($d[0],2,2) eq '--' && substr($d[0],0,2) ne 'xn') { return 'NAME_WITH_TWO_HYPHENS_NOT_IDN'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"no_double_hyphen_except_idn"} and $rules->{"no_double_hyphen_except_idn"} and substr($d[0], 2, 2) eq "--" and substr($d[0], 0, 2) ne "xn") 0 1 1
Condition33%3/9
exists $rules->{"no_double_hyphen_except_idn"} and $rules->{"no_double_hyphen_except_idn"} and substr($d[0], 2, 2) eq "--" and substr($d[0], 0, 2) ne "xn"
!ll&&!rl&&r
100
exists $rules->{"no_double_hyphen_except_idn"} and $rules->{"no_double_hyphen_except_idn"} and substr($d[0], 2, 2) eq "--"
!ll&&!rl&&r
100
exists $rules->{"no_double_hyphen_except_idn"} and $rules->{"no_double_hyphen_except_idn"}
!ll&&!rl&&r
100
MC/DC0%0/4
exists $rules->{"no_double_hyphen_except_idn"} and $rules->{"no_double_hyphen_except_idn"} and substr($d[0], 2, 2) eq "--" and substr($d[0], 0, 2) ne "xn"
exists $rules->{"no_double_hyphen_except_idn"} $rules->{"no_double_hyphen_except_idn"} substr($d[0], 2, 2) eq "--" substr($d[0], 0, 2) ne "xn"
Truth table20%1/5
A and B and C and D
A= exists $rules->{"no_double_hyphen_except_idn"}B= $rules->{"no_double_hyphen_except_idn"}C= substr($d[0], 2, 2) eq "--"D= substr($d[0], 0, 2) ne "xn"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
150 1 ▶ if (exists $rules->{no_country_code} && $rules->{no_country_code} && exists $Net::DRI::Util::CCA2{uc($d[0])}) { return 'NAME_WITH_COUNTRY_CODE'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"no_country_code"} and $rules->{"no_country_code"} and exists $Net::DRI::Util::CCA2{uc $d[0]}) 0 1 1
Condition33%2/6
exists $rules->{"no_country_code"} and $rules->{"no_country_code"} and exists $Net::DRI::Util::CCA2{uc $d[0]}
!ll&&!rl&&r
100
exists $rules->{"no_country_code"} and $rules->{"no_country_code"}
!ll&&!rl&&r
100
MC/DC0%0/3
exists $rules->{"no_country_code"} and $rules->{"no_country_code"} and exists $Net::DRI::Util::CCA2{uc $d[0]}
exists $rules->{"no_country_code"} $rules->{"no_country_code"} exists $Net::DRI::Util::CCA2{uc $d[0]}
Truth table25%1/4
A and B and C
A= exists $rules->{"no_country_code"}B= $rules->{"no_country_code"}C= exists $Net::DRI::Util::CCA2{uc $d[0]}
ABCresult
0XX0
10X0
1100
1111
151 1 ▶ if (exists $rules->{no_digits_only} && $rules->{no_digits_only} && $d[0]=~m/^\d+$/) { return 'NAME_WITH_ONLY_DIGITS'; }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"no_digits_only"} and $rules->{"no_digits_only"} and $d[0] =~ /^\d+$/) 0 1 1
Condition33%2/6
exists $rules->{"no_digits_only"} and $rules->{"no_digits_only"} and $d[0] =~ /^\d+$/
!ll&&!rl&&r
100
exists $rules->{"no_digits_only"} and $rules->{"no_digits_only"}
!ll&&!rl&&r
100
MC/DC0%0/3
exists $rules->{"no_digits_only"} and $rules->{"no_digits_only"} and $d[0] =~ /^\d+$/
exists $rules->{"no_digits_only"} $rules->{"no_digits_only"} $d[0] =~ /^\d+$/
Truth table25%1/4
A and B and C
A= exists $rules->{"no_digits_only"}B= $rules->{"no_digits_only"}C= $d[0] =~ /^\d+$/
ABCresult
0XX0
10X0
1100
1111
152  
153 1 ▶ if ($domain=~m/\.e164\.arpa$/ && $domain!~m/^(?:\d+\.)+e164\.arpa$/) { return 'NAME_INVALID_IN_E164'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($domain =~ /\.e164\.arpa$/ and not $domain =~ /^(?:\d+\.)+e164\.arpa$/) 0 1 1
Condition33%1/3
$domain =~ /\.e164\.arpa$/ and not $domain =~ /^(?:\d+\.)+e164\.arpa$/
!ll&&!rl&&r
100
MC/DC0%0/2
$domain =~ /\.e164\.arpa$/ and not $domain =~ /^(?:\d+\.)+e164\.arpa$/
$domain =~ /\.e164\.arpa$/ not $domain =~ /^(?:\d+\.)+e164\.arpa$/
Truth table33%1/3
A and not(B)
A= $domain =~ /\.e164\.arpa$/B= not $domain =~ /^(?:\d+\.)+e164\.arpa$/
ABresult
0X0
100
111
154  
155 1 ▶ if (exists $rules->{excluded_labels})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rules->{"excluded_labels"}) 0 1 1
156 {
157 0 ▶ my $n=join('|',ref $rules->{excluded_labels}? @{$rules->{excluded_labels}} : ($rules->{excluded_labels}));
Branch: 1 branch
BranchTrueFalseTotal
ref $rules->{'excluded_labels'} ? : 0 0 0
158 0 ▶ if (lc($d[0])=~m/^(?:$n)$/o) { return 'NAME_WITH_EXCLUDED_LABELS'; }
Branch: 1 branch
BranchTrueFalseTotal
if (lc($d[0]) =~ /^(?:$n)$/o) 0 0 0
159 }
160  
161 ## It seems all rules have passed successfully
162 1 return '';
163 }
164  
165 ## Compute the number of dots for each tld in tlds(), returns a ref array and store it for later quick access
166 sub dots
167 {
168 1 ▶ my ($self)=@_;
Subroutine dots: called CC=2 SCAR=6.9
Pod undocumented
169 1 ▶ if (! exists $self->{dots})
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"dots"}) 1 0 1
170 {
171 1 my %a=map { $_ => 1 } map { my $r=$_; my $c=($r=~tr/\././); 1+$c; } $self->tlds();
172 1 $self->{dots}=[ sort { $a <=> $b } keys(%a) ];
173 }
174 1 return $self->{dots};
175 }
176  
177 sub has_object
178 {
179 0 ▶ my ($self,$ndr,$type)=@_;
Subroutine has_object: not called CC=6 SCAR=37.4
Pod undocumented
180 0 ▶ $type=$ndr unless (defined($type) && ref($ndr));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type and ref $ndr 0 0 0
Condition0%0/3
defined $type and ref $ndr
!ll&&!rl&&r
000
MC/DC0%0/2
defined $type and ref $ndr
defined $type ref $ndr
Truth table0%0/3
A and B
A= defined $typeB= ref $ndr
ABresult
0X0
100
111
181 0 ▶ return 0 unless (defined($type) && $type);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type and $type 0 0 0
Condition0%0/3
defined $type and $type
!ll&&!rl&&r
000
MC/DC0%0/2
defined $type and $type
defined $type $type
Truth table0%0/3
A and B
A= defined $typeB= $type
ABresult
0X0
100
111
182 0 $type=lc($type);
183 0 ▶ return (grep { lc($_) eq $type } ($self->object_types()))? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({lc $_ eq $type;} $self->object_types) ? : 0 0 0
184 }
185  
186 ## TODO : use also protocol->has_action() ? (see end of domain_create)
187 sub registry_can
188 {
189 0 ▶ my ($self,$ndr,$what)=@_;
Subroutine registry_can: not called CC=3 SCAR=24.8
Pod undocumented
190 0 ▶ return (eval { $self->can($what); } && ! grep { $what eq $_ } $self->unavailable_operations())? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->can($what) } } && !grep({$what eq $_;} $self->unavailable_operations) ? : 0 0 0
Condition0%0/3
eval { and not grep({$what eq $_;} $self->unavailable_operations)
!ll&&!rl&&r
000
MC/DC0%0/2
eval { do { $self->can($what) } } and not grep({$what eq $_;} $self->unavailable_operations)
eval { do { $self->can($what) } } not grep({$what eq $_;} $self->unavailable_operations)
Truth table0%0/3
A and not(B)
A= eval { do { $self->can($what) } }B= not grep({$what eq $_;} $self->unavailable_operations)
ABresult
0X0
100
111
191 }
192  
193 ## It would be probably more useful to know the list of available ones !
194 ## An overhaul would be probably needed when more non domain names registries are added
195 0 ▶sub unavailable_operations { return (); } ## will be overruled by BaseClass, as needed
Subroutine unavailable_operations: not called CC=1 SCAR=6.9
Pod undocumented
196  
197 ####################################################################################################
198  
199 ## A common default, which should be fine for EPP & related ways of doing things
200 ## (should it be done in the Protocol class instead ?)
201 sub domain_operation_needs_is_mine
202 {
203 0 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine domain_operation_needs_is_mine: not called CC=4 SCAR=30.0
Pod undocumented
204 0 ▶ if (! defined $op) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $op) 0 0 0
205 0 ▶ if ($op=~m/^(?:renew|update|delete)$/) { return 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($op =~ /^(?:renew|update|delete)$/) 0 0 0
206 0 ▶ if ($op eq 'transfer') { return 0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq "transfer") 0 0 0
207 0 return;
208 }
209  
210 ## This is the default basic one, it should get subclassed as needed
211 sub verify_name_domain
212 {
213 0 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine verify_name_domain: not called CC=1 SCAR=6.9
Pod undocumented
214 0 return $self->_verify_name_rules($domain,$op,{check_name=>1,my_tld=>1});
215 }
216  
217 sub verify_name_host
218 {
219 0 ▶ my ($self,$ndr,$host,$checktld)=@_;
Subroutine verify_name_host: not called CC=6 SCAR=37.4
Pod undocumented
220 0 ▶ $host=$host->get_names(1) if ref $host;
Branch: 1 branch
BranchTrueFalseTotal
if ref $host 0 0 0
221 0 my $r=$self->check_name($host);
222 0 ▶ return $r if length $r;
Branch: 1 branch
BranchTrueFalseTotal
if length $r 0 0 0
223 0 ▶ return 'HOST_NAME_NOT_IN_CORRECT_TLD' if (defined $checktld && $checktld && !$self->is_my_tld($host,0));
Branch: 1 branch
BranchTrueFalseTotal
if defined $checktld and $checktld and not $self->is_my_tld($host, 0) 0 0 0
Condition0%0/6
defined $checktld and $checktld and not $self->is_my_tld($host, 0)
!ll&&!rl&&r
000
defined $checktld and $checktld
!ll&&!rl&&r
000
MC/DC0%0/3
defined $checktld and $checktld and not $self->is_my_tld($host, 0)
defined $checktld $checktld not $self->is_my_tld($host, 0)
Truth table0%0/4
A and B and not(C)
A= defined $checktldB= $checktldC= not $self->is_my_tld($host, 0)
ABCresult
0XX0
10X0
1100
1111
224 0 return '';
225 }
226  
227 sub check_name
228 {
229 1 ▶ my ($self,$ndr,$data,$dots,$unicode)=@_;
Subroutine check_name: called CC=12 SCAR=29.9
Pod undocumented
230 1 ▶ ($data,$dots,$unicode)=($ndr,$data,$dots) unless (defined($ndr) && $ndr && (ref($ndr) eq 'Net::DRI::Registry'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry" 1 0 1
Condition33%2/6
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
!ll&&!rl&&r
010
defined $ndr and $ndr
!ll&&!rl&&r
001
MC/DC0%0/3
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
defined $ndr $ndr ref $ndr eq "Net::DRI::Registry"
Truth table25%1/4
A and B and C
A= defined $ndrB= $ndrC= ref $ndr eq "Net::DRI::Registry"
ABCresult
0XX0
10X0
1100
1111
231  
232 1 ▶ return 'UNDEFINED_NAME' unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 1 1
233 1 ▶ return 'NON_SCALAR_NAME' unless !ref($data);
Branch: 1 branch
BranchTrueFalseTotal
if ref $data 0 1 1
234 1 ▶ return 'ZERO_LENGTH_NAME' unless length $data;
Branch: 1 branch
BranchTrueFalseTotal
unless length $data 0 1 1
235 1 ▶ return 'INVALID_HOSTNAME' unless Net::DRI::Util::is_hostname($data,$unicode);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_hostname($data, $unicode) 0 1 1
236 1 ▶ if (defined($dots) && $data!~m/\.e164\.arpa$/)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $dots and not $data =~ /\.e164\.arpa$/) 1 0 1
Condition33%1/3
defined $dots and not $data =~ /\.e164\.arpa$/
!ll&&!rl&&r
001
MC/DC0%0/2
defined $dots and not $data =~ /\.e164\.arpa$/
defined $dots not $data =~ /\.e164\.arpa$/
Truth table33%1/3
A and not(B)
A= defined $dotsB= not $data =~ /\.e164\.arpa$/
ABresult
0X0
100
111
237 {
238 1 my @d=split(/\./,$data);
239 1 ▶ my @ok=ref($dots)? @$dots : ($dots);
Branch: 1 branch
BranchTrueFalseTotal
ref $dots ? : 1 0 1
240 1 ▶ return 'INVALID_NUMBER_OF_DOTS_IN_NAME' unless grep { 1+$_== @d } @ok;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {1 + $_ == @d;} @ok 0 1 1
241 }
242  
243 1 return ''; #everything ok
244 }
245  
246 sub verify_duration_create
247 {
248 0 ▶ my ($self,$ndr,$duration,$domain)=@_;
Subroutine verify_duration_create: not called CC=4 SCAR=30.0
Pod undocumented
249  
250 0 my @d=$self->periods();
251 0 ▶ return 1 unless @d;
Branch: 1 branch
BranchTrueFalseTotal
unless @d 0 0 0
252 0 ▶ foreach my $d (@d) { return 0 if (0==Net::DRI::Util::compare_durations($d,$duration)) }
Branch: 1 branch
BranchTrueFalseTotal
if 0 == Net::DRI::Util::compare_durations($d, $duration) 0 0 0
253 0 return 2;
254 }
255  
256 sub verify_duration_renew
257 {
258 1 ▶ my ($self,$ndr,$duration,$domain,$curexp)=@_;
Subroutine verify_duration_renew: called CC=9 SCAR=39.6
Pod undocumented
259  
260 1 my @d=$self->periods();
261 1 ▶ if (defined($duration) && @d)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $duration and @d) 0 1 1
Condition33%1/3
defined $duration and @d
!ll&&!rl&&r
100
MC/DC0%0/2
defined $duration and @d
defined $duration @d
Truth table33%1/3
A and B
A= defined $durationB= @d
ABresult
0X0
100
111
262 {
263 0 my $ok=0;
264 0 foreach my $d (@d)
265 {
266 0 ▶ next unless (0==Net::DRI::Util::compare_durations($d,$duration));
Branch: 1 branch
BranchTrueFalseTotal
unless 0 == Net::DRI::Util::compare_durations($d, $duration) 0 0 0
267 0 $ok=1;
268 0 last;
269 }
270 0 ▶ return 1 unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
271  
272 0 ▶ if (defined $curexp && Net::DRI::Util::is_class($curexp,'DateTime'))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")) 0 0 0
Condition0%0/3
defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
defined $curexp Net::DRI::Util::is_class($curexp, "DateTime")
Truth table0%0/3
A and B
A= defined $curexpB= Net::DRI::Util::is_class($curexp, "DateTime")
ABresult
0X0
100
111
273 {
274 0 my $maxdelta=$d[-1];
275 0 my $newexp=$curexp+$duration; ## New expiration
276 0 my $now=DateTime->now(time_zone => $curexp->time_zone()->name());
277 0 my $cmp=DateTime->compare($newexp,$now+$maxdelta);
278 0 ▶ return 2 unless ($cmp == -1); ## we must have : curexp+duration < now + maxdelta
Branch: 1 branch
BranchTrueFalseTotal
unless $cmp == -1 0 0 0
279 }
280 }
281  
282 1 return 0; ## everything ok
283 }
284  
285 sub verify_duration_transfer
286 {
287 0 ▶ my ($self,$ndr,$duration,$domain,$op)=@_;
Subroutine verify_duration_transfer: not called CC=1 SCAR=6.9
Pod undocumented
288  
289 0 return 0; ## everything ok
290 }
291  
292 ## A common case; we can not start a transfer, if domain name has already been transfered less than 15 days ago.
293 sub _verify_duration_transfer_15days
294 {
295 0 ▶ my ($self,$ndr,$duration,$domain,$op)=@_;
Subroutine _verify_duration_transfer_15days: not called CC=6 SCAR=37.4
296  
297 0 ▶ return 0 unless ($op eq 'start'); ## we are not interested by other cases, they are always OK
Branch: 1 branch
BranchTrueFalseTotal
unless $op eq "start" 0 0 0
298 0 my $rc=$self->domain_info($ndr,$domain,{hosts=>'none'});
299 0 ▶ return 1 unless ($rc->is_success());
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
300 0 my $trdate=$ndr->get_info('trDate');
301 0 ▶ return 0 unless ($trdate && $trdate->isa('DateTime'));
Branch: 1 branch
BranchTrueFalseTotal
unless $trdate and $trdate->isa("DateTime") 0 0 0
Condition0%0/3
$trdate and $trdate->isa("DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
$trdate and $trdate->isa("DateTime")
$trdate $trdate->isa("DateTime")
Truth table0%0/3
A and B
A= $trdateB= $trdate->isa("DateTime")
ABresult
0X0
100
111
302  
303 0 my $now=DateTime->now(time_zone => $trdate->time_zone()->name());
304 0 my $cmp=DateTime->compare($now,$trdate+DateTime::Duration->new(days => 15));
305 0 ▶ return ($cmp == 1)? 0 : 1; ## we must have : now > transferdate + 15days
Branch: 1 branch
BranchTrueFalseTotal
$cmp == 1 ? : 0 0 0
306 ## we return 0 if OK, anything else if not
307 }
308  
309 ####################################################################################################
310  
311 sub enforce_domain_name_constraints
312 {
313 1 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine enforce_domain_name_constraints: called CC=4 SCAR=18.9
Pod undocumented
314 1 my $err=$self->verify_name_domain($ndr,$domain,$op);
315 1 ▶ Net::DRI::Exception->die(0,'DRD',1,'Invalid domain name (error '.$err.'): '.((defined($domain) && $domain)? $domain : '?')) if length $err;
Branch: 2 branches
BranchTrueFalseTotal
if length $err 0 1 1
defined $domain && $domain ? : 0 0 0
Condition0%0/3
defined $domain and $domain
!ll&&!rl&&r
000
MC/DC0%0/2
defined $domain and $domain
defined $domain $domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
ABresult
0X0
100
111
316 1 return;
317 }
318  
319 sub enforce_host_name_constraints
320 {
321 0 ▶ my ($self,$ndr,$dh,$checktld)=@_;
Subroutine enforce_host_name_constraints: not called CC=4 SCAR=30.0
Pod undocumented
322 0 my $err=$self->verify_name_host($ndr,$dh,$checktld);
323 0 ▶ Net::DRI::Exception->die(0,'DRD',2,'Invalid host name (error '.$err.'): '.((Net::DRI::Util::is_class($dh,'Net::DRI::Data::Hosts'))? $dh->get_names(1) : (defined $dh? $dh : '?'))) if length $err;
Branch: 3 branches
BranchTrueFalseTotal
if length $err 0 0 0
Net::DRI::Util::is_class($dh, 'Net::DRI::Data::Hosts') ? : 0 0 0
defined $dh ? : 0 0 0
324 0 return;
325 }
326  
327 sub err_invalid_contact
328 {
329 0 ▶ my ($self,$c)=@_;
Subroutine err_invalid_contact: not called CC=4 SCAR=30.0
Pod undocumented
330 0 ▶ Net::DRI::Exception->die(0,'DRD',6,'Invalid contact (should be a Contact object with a srid value): '.((defined $c && $c && eval { $c->can('srid'); } )? $c->srid() : '?'));
Branch: 1 branch
BranchTrueFalseTotal
defined $c && $c && eval { do { $c->can('srid') } } ? : 0 0 0
Condition0%0/6
defined $c and $c and eval {
!ll&&!rl&&r
000
defined $c and $c
!ll&&!rl&&r
000
MC/DC0%0/3
defined $c and $c and eval { do { $c->can("srid") } }
defined $c $c eval { do { $c->can("srid") } }
Truth table0%0/4
A and B and C
A= defined $cB= $cC= eval { do { $c->can("srid") } }
ABCresult
0XX0
10X0
1100
1111
331 0 return;
332 }
333  
334 ####################################################################################################
335 ## Operations on DOMAINS
336 ####################################################################################################
337  
338 sub domain_create
339 {
340 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_create: not called CC=40 SCAR=74.0
Pod undocumented
341 0 my @rs;
342  
343 0 $self->enforce_domain_name_constraints($ndr,$domain,'create');
344 0 $rd=Net::DRI::Util::create_params('domain_create',$rd);
345 0 ▶ my $pure=(Net::DRI::Util::has_key($rd,'pure_create') && $rd->{pure_create})? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::has_key($rd, 'pure_create') && $rd->{'pure_create'} ? : 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "pure_create") and $rd->{"pure_create"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "pure_create") and $rd->{"pure_create"}
Net::DRI::Util::has_key($rd, "pure_create") $rd->{"pure_create"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "pure_create")B= $rd->{"pure_create"}
ABresult
0X0
100
111
346 0 delete $rd->{pure_create};
347  
348 0 ▶ if (! $pure)
Branch: 1 branch
BranchTrueFalseTotal
unless ($pure) 0 0 0
349 {
350 0 my $rs=$self->domain_check($ndr,$domain,$rd);
351 0 push @rs,$rs;
352 0 ▶ return Net::DRI::Util::link_rs(@rs) unless ($rs->is_success() && defined $rs->local_get_data('domain',$domain,'exist') && $rs->local_get_data('domain',$domain,'exist')==0);
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success and defined $rs->local_get_data("domain", $domain, "exist") and $rs->local_get_data("domain", $domain, "exist") == 0 0 0 0
Condition0%0/6
$rs->is_success and defined $rs->local_get_data("domain", $domain, "exist") and $rs->local_get_data("domain", $domain, "exist") == 0
!ll&&!rl&&r
000
$rs->is_success and defined $rs->local_get_data("domain", $domain, "exist")
!ll&&!rl&&r
000
MC/DC0%0/3
$rs->is_success and defined $rs->local_get_data("domain", $domain, "exist") and $rs->local_get_data("domain", $domain, "exist") == 0
$rs->is_success defined $rs->local_get_data("domain", $domain, "exist") $rs->local_get_data("domain", $domain, "exist") == 0
Truth table0%0/4
A and B and C
A= $rs->is_successB= defined $rs->local_get_data("domain", $domain, "exist")C= $rs->local_get_data("domain", $domain, "exist") == 0
ABCresult
0XX0
10X0
1100
1111
353 }
354  
355 0 my $nsin=$ndr->local_object('hosts');
356 0 my $nsout=$ndr->local_object('hosts');
357 0 ▶ Net::DRI::Util::check_isa($rd->{ns},'Net::DRI::Data::Hosts') if Net::DRI::Util::has_key($rd,'ns'); ## test needed in both cases
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "ns") 0 0 0
358  
359 ## If not pure domain creation, separate nameservers (inside & outside of domain) and then create outside nameservers if needed
360 0 ▶ if (! $pure && exists $rd->{ns} && $self->has_object('ns'))
Branch: 1 branch
BranchTrueFalseTotal
if (not $pure and exists $rd->{"ns"} and $self->has_object("ns")) 0 0 0
Condition0%0/6
not $pure and exists $rd->{"ns"} and $self->has_object("ns")
!ll&&!rl&&r
000
not $pure and exists $rd->{"ns"}
!ll&&!rl&&r
000
MC/DC0%0/3
not $pure and exists $rd->{"ns"} and $self->has_object("ns")
not $pure exists $rd->{"ns"} $self->has_object("ns")
Truth table0%0/4
not(A) and B and C
A= not $pureB= exists $rd->{"ns"}C= $self->has_object("ns")
ABCresult
0XX0
10X0
1100
1111
361 {
362 0 foreach my $i (1..$rd->{ns}->count())
363 {
364 0 my @a=$rd->{ns}->get_details($i);
365 0 ▶ if ($a[0]=~m/^(.+\.)?${domain}$/i)
Branch: 1 branch
BranchTrueFalseTotal
if ($a[0] =~ /^(.+\.)?$domain$/i) { } 0 0 0
366 {
367 0 $nsin->add(@a);
368 } else
369 {
370 0 my $ns=$ndr->local_object('hosts')->set(\@a);
371 0 my $e=$self->host_exist($ndr,$ns);
372 0 ▶ unless (defined $e && $e==1)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $e and $e == 1) 0 0 0
Condition0%0/3
defined $e and $e == 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $e and $e == 1
defined $e $e == 1
Truth table0%0/3
A and B
A= defined $eB= $e == 1
ABresult
0X0
100
111
373 {
374 0 my $rs=$self->host_create($ndr,$ns);
375 0 push @rs,$rs;
376 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
377 }
378 0 $nsout->add(@a);
379 }
380 }
381 0 $rd->{ns}=$nsout;
382 }
383  
384 ## If not pure domain creation, and if contacts are used make sure they exist as objects in the registry if needed
385 0 ▶ if (! $pure && exists $rd->{contact} && Net::DRI::Util::isa_contactset($rd->{contact}) && $self->has_object('contact'))
Branch: 1 branch
BranchTrueFalseTotal
if (not $pure and exists $rd->{"contact"} and Net::DRI::Util::isa_contactset($rd->{"contact"}) and $self->has_object("contact")) 0 0 0
Condition0%0/9
not $pure and exists $rd->{"contact"} and Net::DRI::Util::isa_contactset($rd->{"contact"}) and $self->has_object("contact")
!ll&&!rl&&r
000
not $pure and exists $rd->{"contact"} and Net::DRI::Util::isa_contactset($rd->{"contact"})
!ll&&!rl&&r
000
not $pure and exists $rd->{"contact"}
!ll&&!rl&&r
000
MC/DC0%0/4
not $pure and exists $rd->{"contact"} and Net::DRI::Util::isa_contactset($rd->{"contact"}) and $self->has_object("contact")
not $pure exists $rd->{"contact"} Net::DRI::Util::isa_contactset($rd->{"contact"}) $self->has_object("contact")
Truth table0%0/5
not(A) and B and C and D
A= not $pureB= exists $rd->{"contact"}C= Net::DRI::Util::isa_contactset($rd->{"contact"})D= $self->has_object("contact")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
386 {
387 0 my %cd;
388 0 foreach my $t ($rd->{contact}->types())
389 {
390 0 foreach my $co ($rd->{contact}->get($t))
391 {
392 0 ▶ next if exists $cd{$co->srid()};
Branch: 1 branch
BranchTrueFalseTotal
if exists $cd{$co->srid} 0 0 0
393 0 my $e=$self->contact_exist($ndr,$co);
394 0 ▶ unless (defined $e && $e==1)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $e and $e == 1) 0 0 0
Condition0%0/3
defined $e and $e == 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $e and $e == 1
defined $e $e == 1
Truth table0%0/3
A and B
A= defined $eB= $e == 1
ABresult
0X0
100
111
395 {
396 0 my $rs=$self->contact_create($ndr,$co);
397 0 push @rs,$rs;
398 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
399 }
400 0 $cd{$co->srid()}=1;
401 }
402 }
403 }
404  
405 0 ▶ Net::DRI::Exception->die(0,'DRD',3,'Invalid duration') if (Net::DRI::Util::has_key($rd,'duration') && ((ref $rd->{duration} ne 'DateTime::Duration') || $self->verify_duration_create($ndr,$rd->{duration},$domain)));
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "duration") and ref $rd->{"duration"} ne "DateTime::Duration" || $self->verify_duration_create($ndr, $rd->{"duration"}, $domain) 0 0 0
Condition0%0/6
Net::DRI::Util::has_key($rd, "duration") and ref $rd->{"duration"} ne "DateTime::Duration" || $self->verify_duration_create($ndr, $rd->{"duration"}, $domain)
!ll&&!rl&&r
000
ref $rd->{"duration"} ne "DateTime::Duration" or $self->verify_duration_create($ndr, $rd->{"duration"}, $domain)
l!l&&r!l&&!r
000
MC/DC0%0/3
Net::DRI::Util::has_key($rd, "duration") and ref $rd->{"duration"} ne "DateTime::Duration" || $self->verify_duration_create($ndr, $rd->{"duration"}, $domain)
Net::DRI::Util::has_key($rd, "duration") ref $rd->{"duration"} ne "DateTime::Duration" $self->verify_duration_create($ndr, $rd->{"duration"}, $domain)
Truth table0%0/4
A and B or C
A= Net::DRI::Util::has_key($rd, "duration")B= ref $rd->{"duration"} ne "DateTime::Duration"C= $self->verify_duration_create($ndr, $rd->{"duration"}, $domain)
ABCresult
0XX0
1000
11X1
1011
406 0 my $rs=$ndr->process('domain','create',[$domain,$rd]);
407 0 ▶ return $rs if $pure; ## pure domain creation we do not bother with other stuff and we stop here
Branch: 1 branch
BranchTrueFalseTotal
if $pure 0 0 0
408 ## From now on, we are sure $rs is defined
409 0 push @rs,$rs;
410 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
411  
412 ## Create inside nameservers and add them to the domain
413 0 ▶ unless ($nsin->is_empty())
Branch: 1 branch
BranchTrueFalseTotal
unless ($nsin->is_empty) 0 0 0
414 {
415 0 foreach my $i (1..$nsin->count())
416 {
417 0 my @a=$nsin->get_details($i);
418 0 my $ns=$ndr->local_object('hosts')->set(\@a);
419 0 my $rs=$self->host_create($ndr,$ns);
420 0 push @rs,$rs;
421 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
422 }
423  
424 0 ▶ my $rs=$ndr->protocol_capable('domain_update','ns','add')? $self->domain_update_ns_add($ndr,$domain,$nsin) : $self->domain_update_ns_set($ndr,$domain,$nsin);
Branch: 1 branch
BranchTrueFalseTotal
$ndr->protocol_capable('domain_update', 'ns', 'add') ? : 0 0 0
425 0 push @rs,$rs;
426 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
427 }
428  
429 ## Add status to domain, if provided
430 0 ▶ if (Net::DRI::Util::has_key($rd,'status'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($rd, "status")) 0 0 0
431 {
432 0 ▶ my $rs=$ndr->protocol_capable('domain_update','status','add')? $self->domain_update_status_add($ndr,$domain,$rd->{status}) : $self->domain_update_status_set($ndr,$domain,$rd->{status});
Branch: 1 branch
BranchTrueFalseTotal
$ndr->protocol_capable('domain_update', 'status', 'add') ? : 0 0 0
433 0 push @rs,$rs;
434 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
435 }
436  
437 ## Do a final info to populate the local cache
438 0 ▶ if ($ndr->protocol()->has_action('domain','info'))
Branch: 1 branch
BranchTrueFalseTotal
if ($ndr->protocol->has_action("domain", "info")) 0 0 0
439 {
440 0 my $rs=$self->domain_info($ndr,$domain);
441 0 push @rs,$rs;
442 }
443  
444 0 return Net::DRI::Util::link_rs(@rs);
445 }
446  
447 sub domain_delete
448 {
449 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_delete: not called CC=17 SCAR=57.2
Pod undocumented
450 0 $self->enforce_domain_name_constraints($ndr,$domain,'delete');
451 0 $rd=Net::DRI::Util::create_params('domain_delete',$rd);
452 0 ▶ my $pure=(Net::DRI::Util::has_key($rd,'pure_delete') && $rd->{pure_delete})? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::has_key($rd, 'pure_delete') && $rd->{'pure_delete'} ? : 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "pure_delete") and $rd->{"pure_delete"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "pure_delete") and $rd->{"pure_delete"}
Net::DRI::Util::has_key($rd, "pure_delete") $rd->{"pure_delete"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "pure_delete")B= $rd->{"pure_delete"}
ABresult
0X0
100
111
453 0 delete $rd->{pure_delete};
454  
455 0 my (@rs,$rs);
456  
457 ## This will make sure we get rid of in-bailiwick nameservers in some way, otherwise in their presence the domain delete would fail
458 0 ▶ if (! $pure)
Branch: 1 branch
BranchTrueFalseTotal
unless ($pure) 0 0 0
459 {
460 0 $rs=$self->domain_info($ndr,$domain);
461 0 push @rs,$rs;
462 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
463  
464 ## First remove all nameservers attached to domain name in case some of them are subordinates of the domain itself
465 0 my $ns=$ndr->get_info('ns');
466 0 ▶ if (defined $ns && !$ns->is_empty())
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ns and not $ns->is_empty) 0 0 0
Condition0%0/3
defined $ns and not $ns->is_empty
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ns and not $ns->is_empty
defined $ns not $ns->is_empty
Truth table0%0/3
A and not(B)
A= defined $nsB= not $ns->is_empty
ABresult
0X0
100
111
467 {
468 0 $rs=$self->domain_update_ns_del($ndr,$domain,$ns);
469 0 push @rs,$rs;
470 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
471 }
472  
473 ## Now try to delete all subordinate hosts, or else (deletion will fail if hosts are used as nameservers for other domain names at registry) rename them somewhere if possible
474 0 $ns=$ndr->get_info('subordinate_hosts');
475 0 ▶ if (defined $ns && !$ns->is_empty() && $self->has_object('ns'))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ns and not $ns->is_empty and $self->has_object("ns")) 0 0 0
Condition0%0/6
defined $ns and not $ns->is_empty and $self->has_object("ns")
!ll&&!rl&&r
000
defined $ns and not $ns->is_empty
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ns and not $ns->is_empty and $self->has_object("ns")
defined $ns not $ns->is_empty $self->has_object("ns")
Truth table0%0/4
A and not(B) and C
A= defined $nsB= not $ns->is_emptyC= $self->has_object("ns")
ABCresult
0XX0
10X0
1100
1111
476 {
477 0 my $base=$rd->{subordinate_rename};
478 0 foreach my $nsname ($ns->get_names())
479 {
480 0 $rs=$self->host_delete($ndr,$nsname);
481 0 push @rs,$rs;
482 0 ▶ return Net::DRI::Util::link_rs(@rs) unless ($rs->is_success() || ($rs->is('OBJECT_ASSOCIATION_PROHIBITS_OPERATION') && defined $base));
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success or $rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION") and defined $base 0 0 0
Condition0%0/6
$rs->is_success or $rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION") and defined $base
l!l&&r!l&&!r
000
$rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION") and defined $base
!ll&&!rl&&r
000
MC/DC0%0/3
$rs->is_success or $rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION") and defined $base
$rs->is_success $rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION") defined $base
Truth table0%0/4
A or B and C
A= $rs->is_successB= $rs->is("OBJECT_ASSOCIATION_PROHIBITS_OPERATION")C= defined $base
ABCresult
1XX1
0111
00X0
0100
483 0 ▶ if (! $rs->is_success())
Branch: 1 branch
BranchTrueFalseTotal
unless ($rs->is_success) 0 0 0
484 {
485 0 $rs=$self->host_update_name_set($ndr,$nsname.'.'.$base);
486 0 push @rs,$rs;
487 0 ▶ return Net::DRI::Util::link_rs(@rs) unless $rs->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rs->is_success 0 0 0
488 }
489 }
490 }
491 }
492  
493 0 $rs=$ndr->process('domain','delete',[$domain,$rd]);
494 0 push @rs,$rs;
495 0 return Net::DRI::Util::link_rs(@rs);
496 }
497  
498 sub domain_info
499 {
500 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_info: not called CC=2 SCAR=17.9
Pod undocumented
501 0 $self->enforce_domain_name_constraints($ndr,$domain,'info');
502 0 my $rc=$ndr->try_restore_from_cache('domain',$domain,'info');
503 0 ▶ if (! defined $rc)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
504 {
505 0 $rd=Net::DRI::Util::create_params('domain_info',$rd);
506 0 $rc=$ndr->process('domain','info',[$domain,$rd]);
507 }
508 0 return $rc;
509 }
510  
511 sub domain_check
512 {
513 0 ▶ my ($self,$ndr,@p)=@_;
Subroutine domain_check: not called CC=16 SCAR=56.1
Pod undocumented
514 0 my (@names,$rd);
515 0 foreach my $p (@p)
516 {
517 0 ▶ if (defined $p && ref $p eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p and ref $p eq "HASH") 0 0 0
Condition0%0/3
defined $p and ref $p eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $p and ref $p eq "HASH"
defined $p ref $p eq "HASH"
Truth table0%0/3
A and B
A= defined $pB= ref $p eq "HASH"
ABresult
0X0
100
111
518 {
519 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Only one optional ref hash with extra parameters is allowed in domain_check') if defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
if defined $rd 0 0 0
520 0 $rd=Net::DRI::Util::create_params('domain_check',$p);
521 0 next;
522 }
523 0 $self->enforce_domain_name_constraints($ndr,$p,'check');
524 0 push @names,$p;
525 }
526 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('domain_check needs at least one domain name to check') unless @names;
Branch: 1 branch
BranchTrueFalseTotal
unless @names 0 0 0
527 0 ▶ $rd={} unless defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rd 0 0 0
528  
529 0 my (@rs,@todo);
530 0 my (%seendom,%seenrc);
531 0 foreach my $domain (@names)
532 {
533 0 ▶ next if exists $seendom{$domain};
Branch: 1 branch
BranchTrueFalseTotal
if exists $seendom{$domain} 0 0 0
534 0 $seendom{$domain}=1;
535 0 my $rs=$ndr->try_restore_from_cache('domain',$domain,'check');
536 0 ▶ if (! defined $rs)
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $rs) { } 0 0 0
537 {
538 0 push @todo,$domain;
539 } else
540 {
541 0 ▶ push @rs,$rs unless exists $seenrc{''.$rs}; ## Some ResultStatus may relate to multiple domain names (this is why we are doing this anyway !), so make sure not to use the same ResultStatus multiple times
Branch: 1 branch
BranchTrueFalseTotal
unless exists $seenrc{'' . $rs} 0 0 0
542 0 $seenrc{''.$rs}=1;
543 }
544 }
545  
546 0 ▶ return Net::DRI::Util::link_rs(@rs) unless @todo;
Branch: 1 branch
BranchTrueFalseTotal
unless @todo 0 0 0
547  
548 0 ▶ if (@todo > 1 && $ndr->protocol()->has_action('domain','check_multi'))
Branch: 1 branch
BranchTrueFalseTotal
if (@todo > 1 and $ndr->protocol->has_action('domain', 'check_multi')) { } 0 0 0
Condition0%0/3
@todo > 1 and $ndr->protocol->has_action("domain", "check_multi")
!ll&&!rl&&r
000
MC/DC0%0/2
@todo > 1 and $ndr->protocol->has_action("domain", "check_multi")
@todo > 1 $ndr->protocol->has_action("domain", "check_multi")
Truth table0%0/3
A and B
A= @todo > 1B= $ndr->protocol->has_action("domain", "check_multi")
ABresult
0X0
100
111
549 {
550 0 my $l=$self->info('check_limit');
551 0 ▶ if (! defined $l)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $l) 0 0 0
552 {
553 0 $ndr->log_output('notice','core','No check_limit specified in driver, assuming 10 for domain_check action. Please report if you know the correct value');
554 0 $l=10;
555 }
556 0 ▶ while (@todo)
Branch: 1 branch
BranchTrueFalseTotal
if (@todo) 0 0 0
557 {
558 0 my @lt=splice(@todo,0,$l);
559 0 push @rs,$ndr->process('domain','check_multi',[\@lt,$rd]);
560 }
561 } else ## either one domain only, or more than one but no check_multi available at protocol level
562 {
563 0 push @rs,map { $ndr->process('domain','check',[$_,$rd]); } @todo;
564 }
565  
566 0 return Net::DRI::Util::link_rs(@rs);
567 }
568  
569 sub domain_exist ## 1/0/undef
570 {
571 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_exist: not called CC=3 SCAR=24.8
Pod undocumented
572  
573 0 ▶ my $rc=$ndr->domain_check($domain,defined $rd ? $rd : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $rd ? : 0 0 0
574 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
575 0 return $ndr->get_info('exist');
576 }
577  
578 sub domain_update
579 {
580 0 ▶ my ($self,$ndr,$domain,$tochange,$rd)=@_;
Subroutine domain_update: not called CC=14 SCAR=53.5
Pod undocumented
581 0 $self->enforce_domain_name_constraints($ndr,$domain,'update');
582 0 $rd=Net::DRI::Util::create_params('domain_update',$rd);
583 0 Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
584 0 ▶ Net::DRI::Exception->new(0,'DRD',4,'Registry does not handle contacts') if ($tochange->all_defined('contact') && ! $self->has_object('contact'));
Branch: 1 branch
BranchTrueFalseTotal
if $tochange->all_defined("contact") and not $self->has_object("contact") 0 0 0
Condition0%0/3
$tochange->all_defined("contact") and not $self->has_object("contact")
!ll&&!rl&&r
000
MC/DC0%0/2
$tochange->all_defined("contact") and not $self->has_object("contact")
$tochange->all_defined("contact") not $self->has_object("contact")
Truth table0%0/3
A and not(B)
A= $tochange->all_defined("contact")B= not $self->has_object("contact")
ABresult
0X0
100
111
585  
586 0 my $fp=$ndr->protocol->nameversion();
587 0 foreach my $t ($tochange->types())
588 {
589 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of domain_update/'.$t) unless $ndr->protocol_capable('domain_update',$t);
Branch: 1 branch
BranchTrueFalseTotal
unless $ndr->protocol_capable("domain_update", $t) 0 0 0
590  
591 0 my $add=$tochange->add($t);
592 0 my $del=$tochange->del($t);
593 0 my $set=$tochange->set($t);
594  
595 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of domain_update/'.$t.' (add)') if (defined($add) && ! $ndr->protocol_capable('domain_update',$t,'add'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $add and not $ndr->protocol_capable("domain_update", $t, "add") 0 0 0
Condition0%0/3
defined $add and not $ndr->protocol_capable("domain_update", $t, "add")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $add and not $ndr->protocol_capable("domain_update", $t, "add")
defined $add not $ndr->protocol_capable("domain_update", $t, "add")
Truth table0%0/3
A and not(B)
A= defined $addB= not $ndr->protocol_capable("domain_update", $t, "add")
ABresult
0X0
100
111
596 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of domain_update/'.$t.' (del)') if (defined($del) && ! $ndr->protocol_capable('domain_update',$t,'del'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $del and not $ndr->protocol_capable("domain_update", $t, "del") 0 0 0
Condition0%0/3
defined $del and not $ndr->protocol_capable("domain_update", $t, "del")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $del and not $ndr->protocol_capable("domain_update", $t, "del")
defined $del not $ndr->protocol_capable("domain_update", $t, "del")
Truth table0%0/3
A and not(B)
A= defined $delB= not $ndr->protocol_capable("domain_update", $t, "del")
ABresult
0X0
100
111
597 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of domain_update/'.$t.' (set)') if (defined($set) && ! $ndr->protocol_capable('domain_update',$t,'set'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $set and not $ndr->protocol_capable("domain_update", $t, "set") 0 0 0
Condition0%0/3
defined $set and not $ndr->protocol_capable("domain_update", $t, "set")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $set and not $ndr->protocol_capable("domain_update", $t, "set")
defined $set not $ndr->protocol_capable("domain_update", $t, "set")
Truth table0%0/3
A and not(B)
A= defined $setB= not $ndr->protocol_capable("domain_update", $t, "set")
ABresult
0X0
100
111
598 }
599  
600 0 foreach ($tochange->all_defined('ns')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::Hosts'); }
601 0 foreach ($tochange->all_defined('status')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::StatusList'); }
602 0 foreach ($tochange->all_defined('contact')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::ContactSet'); }
603  
604 0 my $rc=$ndr->process('domain','update',[$domain,$tochange,$rd]);
605 0 return $rc;
606 }
607  
608 0 ▶sub domain_update_ns_add { my ($self,$ndr,$domain,$ns,$rd)=@_; return $self->domain_update_ns($ndr,$domain,$ns,$ndr->local_object('hosts'),$rd); }
Subroutine domain_update_ns_add: not called CC=1 SCAR=6.9
Pod undocumented
609 0 ▶sub domain_update_ns_del { my ($self,$ndr,$domain,$ns,$rd)=@_; return $self->domain_update_ns($ndr,$domain,$ndr->local_object('hosts'),$ns,$rd); }
Subroutine domain_update_ns_del: not called CC=1 SCAR=6.9
Pod undocumented
610 0 ▶sub domain_update_ns_set { my ($self,$ndr,$domain,$ns,$rd)=@_; return $self->domain_update_ns($ndr,$domain,$ns,undef,$rd); }
Subroutine domain_update_ns_set: not called CC=1 SCAR=6.9
Pod undocumented
611  
612 sub domain_update_ns
613 {
614 0 ▶ my ($self,$ndr,$domain,$nsadd,$nsdel,$rd)=@_;
Subroutine domain_update_ns: not called CC=4 SCAR=30.0
Pod undocumented
615 0 Net::DRI::Util::check_isa($nsadd,'Net::DRI::Data::Hosts');
616 0 ▶ if (defined($nsdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nsdel) { } 0 0 0
617 {
618 0 Net::DRI::Util::check_isa($nsdel,'Net::DRI::Data::Hosts');
619 0 my $c=$ndr->local_object('changes');
620 0 ▶ $c->add('ns',$nsadd) unless ($nsadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $nsadd->is_empty 0 0 0
621 0 ▶ $c->del('ns',$nsdel) unless ($nsdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $nsdel->is_empty 0 0 0
622 0 return $self->domain_update($ndr,$domain,$c,$rd);
623 } else
624 {
625 0 return $self->domain_update($ndr,$domain,$ndr->local_object('changes')->set('ns',$nsadd),$rd);
626 }
627 }
628  
629 0 ▶sub domain_update_status_add { my ($self,$ndr,$domain,$s,$rd)=@_; return $self->domain_update_status($ndr,$domain,$s,$ndr->local_object('status'),$rd); }
Subroutine domain_update_status_add: not called CC=1 SCAR=6.9
Pod undocumented
630 0 ▶sub domain_update_status_del { my ($self,$ndr,$domain,$s,$rd)=@_; return $self->domain_update_status($ndr,$domain,$ndr->local_object('status'),$s,$rd); }
Subroutine domain_update_status_del: not called CC=1 SCAR=6.9
Pod undocumented
631 0 ▶sub domain_update_status_set { my ($self,$ndr,$domain,$s,$rd)=@_; return $self->domain_update_status($ndr,$domain,$s,undef,$rd); }
Subroutine domain_update_status_set: not called CC=1 SCAR=6.9
Pod undocumented
632  
633 sub domain_update_status
634 {
635 0 ▶ my ($self,$ndr,$domain,$sadd,$sdel,$rd)=@_;
Subroutine domain_update_status: not called CC=4 SCAR=30.0
Pod undocumented
636 0 Net::DRI::Util::check_isa($sadd,'Net::DRI::Data::StatusList');
637 0 ▶ if (defined($sdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sdel) { } 0 0 0
638 {
639 0 Net::DRI::Util::check_isa($sdel,'Net::DRI::Data::StatusList');
640 0 my $c=$ndr->local_object('changes');
641 0 ▶ $c->add('status',$sadd) unless ($sadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sadd->is_empty 0 0 0
642 0 ▶ $c->del('status',$sdel) unless ($sdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sdel->is_empty 0 0 0
643 0 return $self->domain_update($ndr,$domain,$c,$rd);
644 } else
645 {
646 0 return $self->domain_update($ndr,$domain,$ndr->local_object('changes')->set('status',$sadd),$rd);
647 }
648 }
649  
650 0 ▶sub domain_update_contact_add { my ($self,$ndr,$domain,$c,$rd)=@_; return $self->domain_update_contact($ndr,$domain,$c,$ndr->local_object('contactset'),$rd); }
Subroutine domain_update_contact_add: not called CC=1 SCAR=6.9
Pod undocumented
651 0 ▶sub domain_update_contact_del { my ($self,$ndr,$domain,$c,$rd)=@_; return $self->domain_update_contact($ndr,$domain,$ndr->local_object('contactset'),$c,$rd); }
Subroutine domain_update_contact_del: not called CC=1 SCAR=6.9
Pod undocumented
652 0 ▶sub domain_update_contact_set { my ($self,$ndr,$domain,$c,$rd)=@_; return $self->domain_update_contact($ndr,$domain,$c,undef,$rd); }
Subroutine domain_update_contact_set: not called CC=1 SCAR=6.9
Pod undocumented
653  
654 sub domain_update_contact
655 {
656 0 ▶ my ($self,$ndr,$domain,$cadd,$cdel,$rd)=@_;
Subroutine domain_update_contact: not called CC=4 SCAR=30.0
Pod undocumented
657 0 Net::DRI::Util::check_isa($cadd,'Net::DRI::Data::ContactSet');
658 0 ▶ if (defined($cdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cdel) { } 0 0 0
659 {
660 0 Net::DRI::Util::check_isa($cdel,'Net::DRI::Data::ContactSet');
661 0 my $c=$ndr->local_object('changes');
662 0 ▶ $c->add('contact',$cadd) unless ($cadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $cadd->is_empty 0 0 0
663 0 ▶ $c->del('contact',$cdel) unless ($cdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $cdel->is_empty 0 0 0
664 0 return $self->domain_update($ndr,$domain,$c,$rd);
665 } else
666 {
667 0 return $self->domain_update($ndr,$domain,$ndr->local_object('changes')->set('contact',$cadd),$rd);
668 }
669 }
670  
671 sub domain_renew
672 {
673 1 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_renew: called CC=4 SCAR=14.3
Pod undocumented
674  
675 1 $self->enforce_domain_name_constraints($ndr,$domain,'renew');
676 1 $rd=Net::DRI::Util::create_params('domain_renew',$rd);
677 1 ▶ Net::DRI::Util::check_isa($rd->{duration},'DateTime::Duration') if Net::DRI::Util::has_key($rd,'duration');
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "duration") 0 1 1
678 1 ▶ Net::DRI::Util::check_isa($rd->{current_expiration},'DateTime') if Net::DRI::Util::has_key($rd,'current_expiration');
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "current_expiration") 1 0 1
679 1 ▶ Net::DRI::Exception->die(0,'DRD',3,'Invalid duration') if $self->verify_duration_renew($ndr,$rd->{duration},$domain,$rd->{current_expiration});
Branch: 1 branch
BranchTrueFalseTotal
if $self->verify_duration_renew($ndr, $rd->{"duration"}, $domain, $rd->{"current_expiration"}) 0 1 1
680  
681 1 return $ndr->process('domain','renew',[$domain,$rd]);
682 }
683  
684 sub domain_transfer
685 {
686 0 ▶ my ($self,$ndr,$domain,$op,$rd)=@_;
Subroutine domain_transfer: not called CC=8 SCAR=42.8
Pod undocumented
687  
688 0 $self->enforce_domain_name_constraints($ndr,$domain,'transfer');
689 0 $rd=Net::DRI::Util::create_params('domain_transfer',$rd);
690 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Transfer operation must be start,stop,accept,refuse or query') unless ($op=~m/^(?:start|stop|query|accept|refuse)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /^(?:start|stop|query|accept|refuse)$/ 0 0 0
691 0 ▶ Net::DRI::Exception->die(0,'DRD',3,'Invalid duration') if Net::DRI::Util::has_key($rd,'duration') && $self->verify_duration_transfer($ndr,$rd->{duration},$domain,$op);
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "duration") and $self->verify_duration_transfer($ndr, $rd->{"duration"}, $domain, $op) 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "duration") and $self->verify_duration_transfer($ndr, $rd->{"duration"}, $domain, $op)
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "duration") and $self->verify_duration_transfer($ndr, $rd->{"duration"}, $domain, $op)
Net::DRI::Util::has_key($rd, "duration") $self->verify_duration_transfer($ndr, $rd->{"duration"}, $domain, $op)
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "duration")B= $self->verify_duration_transfer($ndr, $rd->{"duration"}, $domain, $op)
ABresult
0X0
100
111
692  
693 0 my $rc;
694 0 ▶ if ($op eq 'start')
Branch: 3 branches
BranchTrueFalseTotal
if ($op eq 'start') { } 0 0 0
elsif ($op eq 'stop') { } 0 0 0
elsif ($op eq 'query') { } 0 0 0
695 {
696 0 $rc=$ndr->process('domain','transfer_request',[$domain,$rd]);
697 } elsif ($op eq 'stop')
698 {
699 0 $rc=$ndr->process('domain','transfer_cancel',[$domain,$rd]);
700 } elsif ($op eq 'query')
701 {
702 0 $rc=$ndr->process('domain','transfer_query',[$domain,$rd]);
703 } else ## accept/refuse
704 {
705 0 ▶ $rd->{approve}=($op eq 'accept')? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$op eq 'accept' ? : 0 0 0
706 0 $rc=$ndr->process('domain','transfer_answer',[$domain,$rd]);
707 }
708  
709 0 return $rc;
710 }
711  
712 0 ▶sub domain_transfer_start { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer($ndr,$domain,'start',$rd); }
Subroutine domain_transfer_start: not called CC=1 SCAR=6.9
Pod undocumented
713 0 ▶sub domain_transfer_stop { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer($ndr,$domain,'stop',$rd); }
Subroutine domain_transfer_stop: not called CC=1 SCAR=6.9
Pod undocumented
714 0 ▶sub domain_transfer_query { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer($ndr,$domain,'query',$rd); }
Subroutine domain_transfer_query: not called CC=1 SCAR=6.9
Pod undocumented
715 0 ▶sub domain_transfer_accept { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer($ndr,$domain,'accept',$rd); }
Subroutine domain_transfer_accept: not called CC=1 SCAR=6.9
Pod undocumented
716 0 ▶sub domain_transfer_refuse { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer($ndr,$domain,'refuse',$rd); }
Subroutine domain_transfer_refuse: not called CC=1 SCAR=6.9
Pod undocumented
717  
718  
719 sub domain_can
720 {
721 0 ▶ my ($self,$ndr,$domain,$what,$rd)=@_;
Subroutine domain_can: not called CC=5 SCAR=34.0
Pod undocumented
722  
723 0 my $sok=$self->domain_status_allows($ndr,$domain,$what,$rd);
724 0 ▶ return 0 unless ($sok);
Branch: 1 branch
BranchTrueFalseTotal
unless $sok 0 0 0
725  
726 0 my $ismine=$self->domain_is_mine($ndr,$domain,$rd);
727 0 my $n=$self->domain_operation_needs_is_mine($ndr,$domain,$what);
728 0 ▶ return unless (defined($n));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 0 0
729 0 ▶ return ($ismine xor $n)? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$ismine ^^ $n ? : 0 0 0
Condition0%0/4
$ismine xor $n
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/2
$ismine xor $n
$ismine $n
Truth table0%0/4
A xor B
A= $ismineB= $n
ABresult
110
101
011
000
730 }
731  
732 0 ▶sub domain_status_allows_delete { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_status_allows($ndr,$domain,'delete',$rd); }
Subroutine domain_status_allows_delete: not called CC=1 SCAR=6.9
Pod undocumented
733 0 ▶sub domain_status_allows_update { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_status_allows($ndr,$domain,'update',$rd); }
Subroutine domain_status_allows_update: not called CC=1 SCAR=6.9
Pod undocumented
734 0 ▶sub domain_status_allows_transfer { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_status_allows($ndr,$domain,'transfer',$rd); }
Subroutine domain_status_allows_transfer: not called CC=1 SCAR=6.9
Pod undocumented
735 0 ▶sub domain_status_allows_renew { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_status_allows($ndr,$domain,'renew',$rd); }
Subroutine domain_status_allows_renew: not called CC=1 SCAR=6.9
Pod undocumented
736  
737 sub domain_status_allows
738 {
739 0 ▶ my ($self,$ndr,$domain,$what,$rd)=@_;
Subroutine domain_status_allows: not called CC=7 SCAR=40.3
Pod undocumented
740  
741 0 ▶ return 0 unless ($what=~m/^(?:delete|update|transfer|renew)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $what =~ /^(?:delete|update|transfer|renew)$/ 0 0 0
742 0 my $s=$self->domain_current_status($ndr,$domain,$rd);
743 0 ▶ return 0 unless defined $s;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $s 0 0 0
744  
745 0 ▶ return $s->can_delete() if ($what eq 'delete');
Branch: 1 branch
BranchTrueFalseTotal
if $what eq "delete" 0 0 0
746 0 ▶ return $s->can_update() if ($what eq 'update');
Branch: 1 branch
BranchTrueFalseTotal
if $what eq "update" 0 0 0
747 0 ▶ return $s->can_transfer() if ($what eq 'transfer');
Branch: 1 branch
BranchTrueFalseTotal
if $what eq "transfer" 0 0 0
748 0 ▶ return $s->can_renew() if ($what eq 'renew');
Branch: 1 branch
BranchTrueFalseTotal
if $what eq "renew" 0 0 0
749 0 return 0; ## failsafe
750 }
751  
752 sub domain_current_status
753 {
754 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_current_status: not called CC=3 SCAR=24.8
Pod undocumented
755 0 my $rc=$self->domain_info($ndr,$domain,$rd);
756 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
757 0 my $s=$ndr->get_info('status');
758 0 ▶ return unless Net::DRI::Util::isa_statuslist($s);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_statuslist($s) 0 0 0
759 0 return $s;
760 }
761  
762 sub domain_is_mine
763 {
764 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_is_mine: not called CC=5 SCAR=34.0
Pod undocumented
765 0 my $clid=$self->info('client_id');
766 0 ▶ return unless defined $clid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $clid 0 0 0
767 0 my $rc=$self->domain_info($ndr,$domain,$rd);
768 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
769 0 my $id=$ndr->get_info('clID');
770 0 ▶ return unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
771 0 ▶ return ($clid=~m/^${id}$/)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$clid =~ /^$id$/ ? : 0 0 0
772 }
773  
774 ####################################################################################################
775 ## Operations on HOSTS
776 ####################################################################################################
777  
778 sub host_create
779 {
780 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_create: not called CC=2 SCAR=17.9
Pod undocumented
781 0 $rh=Net::DRI::Util::create_params('host_create',$rh);
782 0 ▶ my $name=Net::DRI::Util::isa_hosts('$dh')? $dh->get_details(1) : $dh;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_hosts('$dh') ? : 0 0 0
783 0 $self->enforce_host_name_constraints($ndr,$name,0);
784  
785 0 my $rc=$ndr->process('host','create',[$dh,$rh]);
786 0 return $rc;
787 }
788  
789 sub host_delete
790 {
791 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_delete: not called CC=2 SCAR=17.9
Pod undocumented
792 0 $rh=Net::DRI::Util::create_params('host_delete',$rh);
793 0 ▶ my $name=Net::DRI::Util::isa_hosts('$dh')? $dh->get_details(1) : $dh;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_hosts('$dh') ? : 0 0 0
794 0 $self->enforce_host_name_constraints($ndr,$name);
795  
796 0 my $rc=$ndr->process('host','delete',[$dh,$rh]);
797 0 return $rc;
798 }
799  
800 sub host_info
801 {
802 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_info: not called CC=5 SCAR=34.0
Pod undocumented
803 0 $rh=Net::DRI::Util::create_params('host_info',$rh);
804 0 ▶ my $name=Net::DRI::Util::isa_hosts('$dh')? $dh->get_details(1) : $dh;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_hosts('$dh') ? : 0 0 0
805 0 $self->enforce_host_name_constraints($ndr,$name);
806  
807 0 my $rc=$ndr->try_restore_from_cache('host',$name,'info');
808 0 ▶ if (! defined $rc) { $rc=$ndr->process('host','info',[$dh,$rh]); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
809  
810 0 ▶ return $rc unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
811 0 ▶ return (wantarray())? ($rc,$ndr->get_info('self')) : $rc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
812 }
813  
814 sub host_check
815 {
816 0 ▶ my ($self,$ndr,@p)=@_;
Subroutine host_check: not called CC=18 SCAR=58.3
Pod undocumented
817 0 my (@names,$rd);
818 0 ▶ foreach my $p (map { defined && Net::DRI::Util::isa_hosts($_,1) ? $_->get_names() : $_ } @p)
Branch: 1 branch
BranchTrueFalseTotal
defined $_ && Net::DRI::Util::isa_hosts($_, 1) ? : 0 0 0
Condition0%0/3
defined $_ and Net::DRI::Util::isa_hosts($_, 1)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ and Net::DRI::Util::isa_hosts($_, 1)
defined $_ Net::DRI::Util::isa_hosts($_, 1)
Truth table0%0/3
A and B
A= defined $_B= Net::DRI::Util::isa_hosts($_, 1)
ABresult
0X0
100
111
819 {
820 0 ▶ if (defined $p && ref $p eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p and ref $p eq "HASH") 0 0 0
Condition0%0/3
defined $p and ref $p eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $p and ref $p eq "HASH"
defined $p ref $p eq "HASH"
Truth table0%0/3
A and B
A= defined $pB= ref $p eq "HASH"
ABresult
0X0
100
111
821 {
822 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Only one optional ref hash with extra parameters is allowed in host_check') if defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
if defined $rd 0 0 0
823 0 $rd=Net::DRI::Util::create_params('host_check',$p);
824 0 next;
825 }
826 0 $self->enforce_host_name_constraints($ndr,$p);
827 0 push @names,$p;
828 }
829 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('host_check needs at least one domain name to check') unless @names;
Branch: 1 branch
BranchTrueFalseTotal
unless @names 0 0 0
830 0 ▶ $rd={} unless defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rd 0 0 0
831  
832 0 my (@rs,@todo);
833 0 my (%seenhost,%seenrc);
834 0 foreach my $host (@names)
835 {
836 0 ▶ next if exists $seenhost{$host};
Branch: 1 branch
BranchTrueFalseTotal
if exists $seenhost{$host} 0 0 0
837 0 $seenhost{$host}=1;
838 0 my $rs=$ndr->try_restore_from_cache('host',$host,'check');
839 0 ▶ if (! defined $rs)
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $rs) { } 0 0 0
840 {
841 0 push @todo,$host;
842 } else
843 {
844 0 ▶ push @rs,$rs unless exists $seenrc{''.$rs}; ## Some ResultStatus may relate to multiple host names (this is why we are doing this anyway !), so make sure not to use the same ResultStatus multiple times
Branch: 1 branch
BranchTrueFalseTotal
unless exists $seenrc{'' . $rs} 0 0 0
845 0 $seenrc{''.$rs}=1;
846 }
847 }
848  
849 0 ▶ return Net::DRI::Util::link_rs(@rs) unless @todo;
Branch: 1 branch
BranchTrueFalseTotal
unless @todo 0 0 0
850  
851 0 ▶ if (@todo > 1 && $ndr->protocol()->has_action('host','check_multi'))
Branch: 1 branch
BranchTrueFalseTotal
if (@todo > 1 and $ndr->protocol->has_action('host', 'check_multi')) { } 0 0 0
Condition0%0/3
@todo > 1 and $ndr->protocol->has_action("host", "check_multi")
!ll&&!rl&&r
000
MC/DC0%0/2
@todo > 1 and $ndr->protocol->has_action("host", "check_multi")
@todo > 1 $ndr->protocol->has_action("host", "check_multi")
Truth table0%0/3
A and B
A= @todo > 1B= $ndr->protocol->has_action("host", "check_multi")
ABresult
0X0
100
111
852 {
853 0 my $l=$self->info('check_limit');
854 0 ▶ if (! defined $l)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $l) 0 0 0
855 {
856 0 $ndr->log_output('notice','core','No check_limit specified in driver, assuming 10 for host_check action. Please report if you know the correct value');
857 0 $l=10;
858 }
859 0 ▶ while (@todo)
Branch: 1 branch
BranchTrueFalseTotal
if (@todo) 0 0 0
860 {
861 0 my @lt=splice(@todo,0,$l);
862 0 push @rs,$ndr->process('host','check_multi',[\@lt,$rd]);
863 }
864 } else ## either one domain only, or more than one but no check_multi available at protocol level
865 {
866 0 push @rs,map { $ndr->process('host','check',[$_,$rd]); } @todo;
867 }
868  
869 0 return Net::DRI::Util::link_rs(@rs);
870 }
871  
872 sub host_exist ## 1/0/undef
873 {
874 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_exist: not called CC=3 SCAR=24.8
Pod undocumented
875  
876 0 ▶ my $rc=$ndr->host_check($dh,defined $rh ? $rh : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $rh ? : 0 0 0
877 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
878 0 return $ndr->get_info('exist');
879 }
880  
881 sub host_update
882 {
883 0 ▶ my ($self,$ndr,$dh,$tochange,$rh)=@_;
Subroutine host_update: not called CC=13 SCAR=52.0
Pod undocumented
884 0 $rh=Net::DRI::Util::create_params('host_update',$rh);
885 0 ▶ my $name=Net::DRI::Util::isa_hosts('$dh')? $dh->get_details(1) : $dh;
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_hosts('$dh') ? : 0 0 0
886 0 $self->enforce_host_name_constraints($ndr,$name);
887 0 Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
888  
889 0 my $fp=$ndr->protocol->nameversion();
890 0 foreach my $t ($tochange->types())
891 {
892 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of host_update/'.$t) unless $ndr->protocol_capable('host_update',$t);
Branch: 1 branch
BranchTrueFalseTotal
unless $ndr->protocol_capable("host_update", $t) 0 0 0
893  
894 0 my $add=$tochange->add($t);
895 0 my $del=$tochange->del($t);
896 0 my $set=$tochange->set($t);
897  
898 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of host_update/'.$t.' (add)') if (defined($add) && ! $ndr->protocol_capable('host_update',$t,'add'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $add and not $ndr->protocol_capable("host_update", $t, "add") 0 0 0
Condition0%0/3
defined $add and not $ndr->protocol_capable("host_update", $t, "add")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $add and not $ndr->protocol_capable("host_update", $t, "add")
defined $add not $ndr->protocol_capable("host_update", $t, "add")
Truth table0%0/3
A and not(B)
A= defined $addB= not $ndr->protocol_capable("host_update", $t, "add")
ABresult
0X0
100
111
899 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of host_update/'.$t.' (del)') if (defined($del) && ! $ndr->protocol_capable('host_update',$t,'del'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $del and not $ndr->protocol_capable("host_update", $t, "del") 0 0 0
Condition0%0/3
defined $del and not $ndr->protocol_capable("host_update", $t, "del")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $del and not $ndr->protocol_capable("host_update", $t, "del")
defined $del not $ndr->protocol_capable("host_update", $t, "del")
Truth table0%0/3
A and not(B)
A= defined $delB= not $ndr->protocol_capable("host_update", $t, "del")
ABresult
0X0
100
111
900 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of host_update/'.$t.' (set)') if (defined($set) && ! $ndr->protocol_capable('host_update',$t,'set'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $set and not $ndr->protocol_capable("host_update", $t, "set") 0 0 0
Condition0%0/3
defined $set and not $ndr->protocol_capable("host_update", $t, "set")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $set and not $ndr->protocol_capable("host_update", $t, "set")
defined $set not $ndr->protocol_capable("host_update", $t, "set")
Truth table0%0/3
A and not(B)
A= defined $setB= not $ndr->protocol_capable("host_update", $t, "set")
ABresult
0X0
100
111
901 }
902  
903 0 foreach ($tochange->all_defined('ip')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::Hosts'); }
904 0 foreach ($tochange->all_defined('status')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::StatusList'); }
905 0 foreach ($tochange->all_defined('name')) { $self->enforce_host_name_constraints($ndr,$_); }
906  
907 0 my $rc=$ndr->process('host','update',[$dh,$tochange,$rh]);
908 0 return $rc;
909 }
910  
911 0 ▶sub host_update_ip_add { my ($self,$ndr,$dh,$ip,$rh)=@_; return $self->host_update_ip($ndr,$dh,$ip,$ndr->local_object('hosts'),$rh); }
Subroutine host_update_ip_add: not called CC=1 SCAR=6.9
Pod undocumented
912 0 ▶sub host_update_ip_del { my ($self,$ndr,$dh,$ip,$rh)=@_; return $self->host_update_ip($ndr,$dh,$ndr->local_object('hosts'),$ip,$rh); }
Subroutine host_update_ip_del: not called CC=1 SCAR=6.9
Pod undocumented
913 0 ▶sub host_update_ip_set { my ($self,$ndr,$dh,$ip,$rh)=@_; return $self->host_update_ip($ndr,$dh,$ip,undef,$rh); }
Subroutine host_update_ip_set: not called CC=1 SCAR=6.9
Pod undocumented
914  
915 sub host_update_ip
916 {
917 0 ▶ my ($self,$ndr,$dh,$ipadd,$ipdel,$rh)=@_;
Subroutine host_update_ip: not called CC=4 SCAR=30.0
Pod undocumented
918 0 Net::DRI::Util::check_isa($ipadd,'Net::DRI::Data::Hosts');
919 0 ▶ if (defined($ipdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ipdel) { } 0 0 0
920 {
921 0 Net::DRI::Util::check_isa($ipdel,'Net::DRI::Data::Hosts');
922 0 my $c=$ndr->local_object('changes');
923 0 ▶ $c->add('ip',$ipadd) unless ($ipadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $ipadd->is_empty 0 0 0
924 0 ▶ $c->del('ip',$ipdel) unless ($ipdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $ipdel->is_empty 0 0 0
925 0 return $self->host_update($ndr,$dh,$c,$rh);
926 } else ## just set
927 {
928 0 return $self->host_update($ndr,$dh,$ndr->local_object('changes')->set('ip',$ipadd),$rh);
929 }
930 }
931  
932 0 ▶sub host_update_status_add { my ($self,$ndr,$dh,$s,$rh)=@_; return $self->host_update_status($ndr,$dh,$s,$ndr->local_object('status'),$rh); }
Subroutine host_update_status_add: not called CC=1 SCAR=6.9
Pod undocumented
933 0 ▶sub host_update_status_del { my ($self,$ndr,$dh,$s,$rh)=@_; return $self->host_update_status($ndr,$dh,$ndr->local_object('status'),$s,$rh); }
Subroutine host_update_status_del: not called CC=1 SCAR=6.9
Pod undocumented
934 0 ▶sub host_update_status_set { my ($self,$ndr,$dh,$s,$rh)=@_; return $self->host_update_status($ndr,$dh,$s,undef,$rh); }
Subroutine host_update_status_set: not called CC=1 SCAR=6.9
Pod undocumented
935  
936 sub host_update_status
937 {
938 0 ▶ my ($self,$ndr,$dh,$sadd,$sdel,$rh)=@_;
Subroutine host_update_status: not called CC=4 SCAR=30.0
Pod undocumented
939 0 Net::DRI::Util::check_isa($sadd,'Net::DRI::Data::StatusList');
940 0 ▶ if (defined($sdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sdel) { } 0 0 0
941 {
942 0 Net::DRI::Util::check_isa($sdel,'Net::DRI::Data::StatusList');
943 0 my $c=$ndr->local_object('changes');
944 0 ▶ $c->add('status',$sadd) unless ($sadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sadd->is_empty 0 0 0
945 0 ▶ $c->del('status',$sdel) unless ($sdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sdel->is_empty 0 0 0
946 0 return $self->host_update($ndr,$dh,$c,$rh);
947 } else ## just set
948 {
949 0 return $self->host_update($ndr,$dh,$ndr->local_object('changes')->set('status',$sadd),$rh);
950 }
951 }
952  
953 sub host_update_name_set
954 {
955 0 ▶ my ($self,$ndr,$dh,$newname,$rh)=@_;
Subroutine host_update_name_set: not called CC=3 SCAR=24.8
Pod undocumented
956 0 ▶ $newname=$newname->get_names(1) if ($newname && Net::DRI::Util::is_class($newname,'Net::DRI::Data::Hosts'));
Branch: 1 branch
BranchTrueFalseTotal
if $newname and Net::DRI::Util::is_class($newname, "Net::DRI::Data::Hosts") 0 0 0
Condition0%0/3
$newname and Net::DRI::Util::is_class($newname, "Net::DRI::Data::Hosts")
!ll&&!rl&&r
000
MC/DC0%0/2
$newname and Net::DRI::Util::is_class($newname, "Net::DRI::Data::Hosts")
$newname Net::DRI::Util::is_class($newname, "Net::DRI::Data::Hosts")
Truth table0%0/3
A and B
A= $newnameB= Net::DRI::Util::is_class($newname, "Net::DRI::Data::Hosts")
ABresult
0X0
100
111
957 0 $self->enforce_host_name_constraints($ndr,$newname);
958 0 return $self->host_update($ndr,$dh,$ndr->local_object('changes')->set('name',$newname),$rh);
959 }
960  
961 sub host_current_status
962 {
963 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_current_status: not called CC=3 SCAR=24.8
Pod undocumented
964 0 my $rc=$self->host_info($ndr,$dh,$rh);
965 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
966 0 my $s=$ndr->get_info('status');
967 0 ▶ return unless Net::DRI::Util::isa_statuslist($s);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_statuslist($s) 0 0 0
968 0 return $s;
969 }
970  
971 sub host_is_mine
972 {
973 0 ▶ my ($self,$ndr,$dh,$rh)=@_;
Subroutine host_is_mine: not called CC=5 SCAR=34.0
Pod undocumented
974 0 my $clid=$self->info('client_id');
975 0 ▶ return unless defined $clid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $clid 0 0 0
976 0 my $rc=$self->host_info($ndr,$dh,$rh);
977 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
978 0 my $id=$ndr->get_info('clID');
979 0 ▶ return unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
980 0 ▶ return ($clid=~m/^${id}$/)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$clid =~ /^$id$/ ? : 0 0 0
981 }
982  
983 ####################################################################################################
984 ## Operations on CONTACTS
985 ####################################################################################################
986  
987 sub contact_create
988 {
989 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_create: not called CC=3 SCAR=24.8
Pod undocumented
990 0 ▶ $self->err_invalid_contact($contact) unless Net::DRI::Util::isa_contact($contact);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) 0 0 0
991 0 $ep=Net::DRI::Util::create_params('contact_create',$ep);
992 0 ▶ $contact->init('create',$ndr) if $contact->can('init');
Branch: 1 branch
BranchTrueFalseTotal
if $contact->can("init") 0 0 0
993 0 $contact->validate(); ## will trigger an Exception if validation not ok
994 0 my $rc=$ndr->process('contact','create',[$contact,$ep]);
995 0 return $rc;
996 }
997  
998 sub contact_delete
999 {
1000 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_delete: not called CC=3 SCAR=24.8
Pod undocumented
1001 0 ▶ $self->err_invalid_contact($contact) unless (Net::DRI::Util::isa_contact($contact) && $contact->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) and $contact->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($contact) and $contact->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($contact) and $contact->srid
Net::DRI::Util::isa_contact($contact) $contact->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($contact)B= $contact->srid
ABresult
0X0
100
111
1002 0 $ep=Net::DRI::Util::create_params('contact_delete',$ep);
1003 0 my $rc=$ndr->process('contact','delete',[$contact,$ep]);
1004 0 return $rc;
1005 }
1006  
1007 sub contact_info
1008 {
1009 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_info: not called CC=4 SCAR=30.0
Pod undocumented
1010 0 ▶ $self->err_invalid_contact($contact) unless (Net::DRI::Util::isa_contact($contact) && $contact->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) and $contact->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($contact) and $contact->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($contact) and $contact->srid
Net::DRI::Util::isa_contact($contact) $contact->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($contact)B= $contact->srid
ABresult
0X0
100
111
1011 0 $ep=Net::DRI::Util::create_params('contact_info',$ep);
1012 0 my $rc=$ndr->try_restore_from_cache('contact',$contact->srid(),'info');
1013 0 ▶ if (! defined $rc) { $rc=$ndr->process('contact','info',[$contact,$ep]); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
1014 0 return $rc;
1015 }
1016  
1017 sub contact_check
1018 {
1019 0 ▶ my ($self,$ndr,@p)=@_;
Subroutine contact_check: not called CC=18 SCAR=58.3
Pod undocumented
1020 0 my (@names,$rd);
1021 0 foreach my $p (@p)
1022 {
1023 0 ▶ if (defined $p && ref $p eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p and ref $p eq "HASH") 0 0 0
Condition0%0/3
defined $p and ref $p eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $p and ref $p eq "HASH"
defined $p ref $p eq "HASH"
Truth table0%0/3
A and B
A= defined $pB= ref $p eq "HASH"
ABresult
0X0
100
111
1024 {
1025 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Only one optional ref hash with extra parameters is allowed in contact_check') if defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
if defined $rd 0 0 0
1026 0 $rd=Net::DRI::Util::create_params('contact_check',$p);
1027 0 next;
1028 }
1029 0 ▶ $self->err_invalid_contact($p) unless (Net::DRI::Util::isa_contact($p) && length $p->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($p) and length $p->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($p) and length $p->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($p) and length $p->srid
Net::DRI::Util::isa_contact($p) length $p->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($p)B= length $p->srid
ABresult
0X0
100
111
1030 0 push @names,$p;
1031 }
1032 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('contact_check needs at least one domain name to check') unless @names;
Branch: 1 branch
BranchTrueFalseTotal
unless @names 0 0 0
1033 0 ▶ $rd={} unless defined $rd;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rd 0 0 0
1034  
1035 0 my (@rs,@todo);
1036 0 my (%seencon,%seenrc);
1037 0 foreach my $contact (@names)
1038 {
1039 0 ▶ next if exists $seencon{$contact};
Branch: 1 branch
BranchTrueFalseTotal
if exists $seencon{$contact} 0 0 0
1040 0 $seencon{$contact}=1;
1041 0 my $rs=$ndr->try_restore_from_cache('contact',$contact->srid(),'check');
1042 0 ▶ if (! defined $rs)
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $rs) { } 0 0 0
1043 {
1044 0 push @todo,$contact;
1045 } else
1046 {
1047 0 ▶ push @rs,$rs unless exists $seenrc{''.$rs}; ## Some ResultStatus may relate to multiple contact names (this is why we are doing this anyway !), so make sure not to use the same ResultStatus multiple times
Branch: 1 branch
BranchTrueFalseTotal
unless exists $seenrc{'' . $rs} 0 0 0
1048 0 $seenrc{''.$rs}=1;
1049 }
1050 }
1051  
1052 0 ▶ return Net::DRI::Util::link_rs(@rs) unless @todo;
Branch: 1 branch
BranchTrueFalseTotal
unless @todo 0 0 0
1053  
1054 0 ▶ if (@todo > 1 && $ndr->protocol()->has_action('contact','check_multi'))
Branch: 1 branch
BranchTrueFalseTotal
if (@todo > 1 and $ndr->protocol->has_action('contact', 'check_multi')) { } 0 0 0
Condition0%0/3
@todo > 1 and $ndr->protocol->has_action("contact", "check_multi")
!ll&&!rl&&r
000
MC/DC0%0/2
@todo > 1 and $ndr->protocol->has_action("contact", "check_multi")
@todo > 1 $ndr->protocol->has_action("contact", "check_multi")
Truth table0%0/3
A and B
A= @todo > 1B= $ndr->protocol->has_action("contact", "check_multi")
ABresult
0X0
100
111
1055 {
1056 0 my $l=$self->info('check_limit');
1057 0 ▶ if (! defined $l)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $l) 0 0 0
1058 {
1059 0 $ndr->log_output('notice','core','No check_limit specified in driver, assuming 10 for contact_check action. Please report if you know the correct value');
1060 0 $l=10;
1061 }
1062 0 ▶ while (@todo)
Branch: 1 branch
BranchTrueFalseTotal
if (@todo) 0 0 0
1063 {
1064 0 my @lt=splice(@todo,0,$l);
1065 0 push @rs,$ndr->process('contact','check_multi',[\@lt,$rd]);
1066 }
1067 } else ## either one domain only, or more than one but no check_multi available at protocol level
1068 {
1069 0 push @rs,map { $ndr->process('contact','check',[$_,$rd]); } @todo;
1070 }
1071  
1072 0 return Net::DRI::Util::link_rs(@rs);
1073 }
1074  
1075 sub contact_exist ## 1/0/undef
1076 {
1077 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_exist: not called CC=5 SCAR=34.0
Pod undocumented
1078 0 ▶ $self->err_invalid_contact($contact) unless (Net::DRI::Util::isa_contact($contact) && $contact->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) and $contact->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($contact) and $contact->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($contact) and $contact->srid
Net::DRI::Util::isa_contact($contact) $contact->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($contact)B= $contact->srid
ABresult
0X0
100
111
1079  
1080 0 ▶ my $rc=$ndr->contact_check($contact,defined $ep ? $ep : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $ep ? : 0 0 0
1081 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
1082 0 return $ndr->get_info('exist');
1083 }
1084  
1085 sub contact_update
1086 {
1087 0 ▶ my ($self,$ndr,$contact,$tochange,$ep)=@_;
Subroutine contact_update: not called CC=12 SCAR=50.5
Pod undocumented
1088 0 ▶ $self->err_invalid_contact($contact) unless (Net::DRI::Util::isa_contact($contact) && $contact->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) and $contact->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($contact) and $contact->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($contact) and $contact->srid
Net::DRI::Util::isa_contact($contact) $contact->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($contact)B= $contact->srid
ABresult
0X0
100
111
1089 0 Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
1090 0 $ep=Net::DRI::Util::create_params('contact_update',$ep);
1091  
1092 0 my $fp=$ndr->protocol->nameversion();
1093 0 foreach my $t ($tochange->types())
1094 {
1095 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of contact_update/'.$t) unless $ndr->protocol_capable('contact_update',$t);
Branch: 1 branch
BranchTrueFalseTotal
unless $ndr->protocol_capable("contact_update", $t) 0 0 0
1096  
1097 0 my $add=$tochange->add($t);
1098 0 my $del=$tochange->del($t);
1099 0 my $set=$tochange->set($t);
1100  
1101 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of contact_update/'.$t.' (add)') if (defined($add) && ! $ndr->protocol_capable('contact_update',$t,'add'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $add and not $ndr->protocol_capable("contact_update", $t, "add") 0 0 0
Condition0%0/3
defined $add and not $ndr->protocol_capable("contact_update", $t, "add")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $add and not $ndr->protocol_capable("contact_update", $t, "add")
defined $add not $ndr->protocol_capable("contact_update", $t, "add")
Truth table0%0/3
A and not(B)
A= defined $addB= not $ndr->protocol_capable("contact_update", $t, "add")
ABresult
0X0
100
111
1102 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of contact_update/'.$t.' (del)') if (defined($del) && ! $ndr->protocol_capable('contact_update',$t,'del'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $del and not $ndr->protocol_capable("contact_update", $t, "del") 0 0 0
Condition0%0/3
defined $del and not $ndr->protocol_capable("contact_update", $t, "del")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $del and not $ndr->protocol_capable("contact_update", $t, "del")
defined $del not $ndr->protocol_capable("contact_update", $t, "del")
Truth table0%0/3
A and not(B)
A= defined $delB= not $ndr->protocol_capable("contact_update", $t, "del")
ABresult
0X0
100
111
1103 0 ▶ Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of contact_update/'.$t.' (set)') if (defined($set) && ! $ndr->protocol_capable('contact_update',$t,'set'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $set and not $ndr->protocol_capable("contact_update", $t, "set") 0 0 0
Condition0%0/3
defined $set and not $ndr->protocol_capable("contact_update", $t, "set")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $set and not $ndr->protocol_capable("contact_update", $t, "set")
defined $set not $ndr->protocol_capable("contact_update", $t, "set")
Truth table0%0/3
A and not(B)
A= defined $setB= not $ndr->protocol_capable("contact_update", $t, "set")
ABresult
0X0
100
111
1104 }
1105  
1106 0 foreach ($tochange->all_defined('status')) { Net::DRI::Util::check_isa($_,'Net::DRI::Data::StatusList'); }
1107  
1108 0 my $rc=$ndr->process('contact','update',[$contact,$tochange,$ep]);
1109 0 return $rc;
1110 }
1111  
1112 0 ▶sub contact_update_status_add { my ($self,$ndr,$contact,$s,$ep)=@_; return $self->contact_update_status($ndr,$contact,$s,$ndr->local_object('status'),$ep); }
Subroutine contact_update_status_add: not called CC=1 SCAR=6.9
Pod undocumented
1113 0 ▶sub contact_update_status_del { my ($self,$ndr,$contact,$s,$ep)=@_; return $self->contact_update_status($ndr,$contact,$ndr->local_object('status'),$s,$ep); }
Subroutine contact_update_status_del: not called CC=1 SCAR=6.9
Pod undocumented
1114 0 ▶sub contact_update_status_set { my ($self,$ndr,$contact,$s,$ep)=@_; return $self->contact_update_status($ndr,$contact,$s,undef,$ep); }
Subroutine contact_update_status_set: not called CC=1 SCAR=6.9
Pod undocumented
1115  
1116 sub contact_update_status
1117 {
1118 0 ▶ my ($self,$ndr,$contact,$sadd,$sdel,$ep)=@_;
Subroutine contact_update_status: not called CC=4 SCAR=30.0
Pod undocumented
1119 0 Net::DRI::Util::check_isa($sadd,'Net::DRI::Data::StatusList');
1120 0 ▶ if (defined($sdel)) ## add + del
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sdel) { } 0 0 0
1121 {
1122 0 Net::DRI::Util::check_isa($sdel,'Net::DRI::Data::StatusList');
1123 0 my $c=$ndr->local_object('changes');
1124 0 ▶ $c->add('status',$sadd) unless ($sadd->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sadd->is_empty 0 0 0
1125 0 ▶ $c->del('status',$sdel) unless ($sdel->is_empty());
Branch: 1 branch
BranchTrueFalseTotal
unless $sdel->is_empty 0 0 0
1126 0 return $self->contact_update($ndr,$contact,$c,$ep);
1127 } else
1128 {
1129 0 return $self->contact_update($ndr,$contact,$ndr->local_object('changes')->set('status',$sadd),$ep);
1130 }
1131 }
1132  
1133 sub contact_transfer
1134 {
1135 0 ▶ my ($self,$ndr,$contact,$op,$ep)=@_;
Subroutine contact_transfer: not called CC=8 SCAR=42.8
Pod undocumented
1136 0 ▶ $self->err_invalid_contact($contact) unless (Net::DRI::Util::isa_contact($contact) && $contact->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) and $contact->srid 0 0 0
Condition0%0/3
Net::DRI::Util::isa_contact($contact) and $contact->srid
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::isa_contact($contact) and $contact->srid
Net::DRI::Util::isa_contact($contact) $contact->srid
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($contact)B= $contact->srid
ABresult
0X0
100
111
1137 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Transfer operation must be start,stop,accept,refuse or query') unless ($op=~m/^(?:start|stop|query|accept|refuse)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /^(?:start|stop|query|accept|refuse)$/ 0 0 0
1138 0 $ep=Net::DRI::Util::create_params('contact_transfer',$ep);
1139  
1140 0 my $rc;
1141 0 ▶ if ($op eq 'start')
Branch: 3 branches
BranchTrueFalseTotal
if ($op eq 'start') { } 0 0 0
elsif ($op eq 'stop') { } 0 0 0
elsif ($op eq 'query') { } 0 0 0
1142 {
1143 0 $rc=$ndr->process('contact','transfer_request',[$contact,$ep]);
1144 } elsif ($op eq 'stop')
1145 {
1146 0 $rc=$ndr->process('contact','transfer_cancel',[$contact,$ep]);
1147 } elsif ($op eq 'query')
1148 {
1149 0 $rc=$ndr->process('contact','transfer_query',[$contact,$ep]);
1150 } else ## accept/refuse
1151 {
1152 0 ▶ $ep->{approve}=($op eq 'accept')? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$op eq 'accept' ? : 0 0 0
1153 0 $rc=$ndr->process('contact','transfer_answer',[$contact,$ep]);
1154 }
1155  
1156 0 return $rc;
1157 }
1158  
1159 0 ▶sub contact_transfer_start { my ($self,$ndr,$contact,$ep)=@_; return $self->contact_transfer($ndr,$contact,'start',$ep); }
Subroutine contact_transfer_start: not called CC=1 SCAR=6.9
Pod undocumented
1160 0 ▶sub contact_transfer_stop { my ($self,$ndr,$contact,$ep)=@_; return $self->contact_transfer($ndr,$contact,'stop',$ep); }
Subroutine contact_transfer_stop: not called CC=1 SCAR=6.9
Pod undocumented
1161 0 ▶sub contact_transfer_query { my ($self,$ndr,$contact,$ep)=@_; return $self->contact_transfer($ndr,$contact,'query',$ep); }
Subroutine contact_transfer_query: not called CC=1 SCAR=6.9
Pod undocumented
1162 0 ▶sub contact_transfer_accept { my ($self,$ndr,$contact,$ep)=@_; return $self->contact_transfer($ndr,$contact,'accept',$ep); }
Subroutine contact_transfer_accept: not called CC=1 SCAR=6.9
Pod undocumented
1163 0 ▶sub contact_transfer_refuse { my ($self,$ndr,$contact,$ep)=@_; return $self->contact_transfer($ndr,$contact,'refuse',$ep); }
Subroutine contact_transfer_refuse: not called CC=1 SCAR=6.9
Pod undocumented
1164  
1165 sub contact_current_status
1166 {
1167 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_current_status: not called CC=3 SCAR=24.8
Pod undocumented
1168 0 my $rc=$self->contact_info($ndr,$contact,$ep);
1169 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
1170 0 my $s=$ndr->get_info('status');
1171 0 ▶ return unless Net::DRI::Util::isa_statuslist($s);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_statuslist($s) 0 0 0
1172 0 return $s;
1173 }
1174  
1175 sub contact_is_mine
1176 {
1177 0 ▶ my ($self,$ndr,$contact,$ep)=@_;
Subroutine contact_is_mine: not called CC=5 SCAR=34.0
Pod undocumented
1178 0 my $clid=$self->info('client_id');
1179 0 ▶ return unless defined $clid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $clid 0 0 0
1180 0 my $rc=$self->contact_info($ndr,$contact,$ep);
1181 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
1182 0 my $id=$ndr->get_info('clID');
1183 0 ▶ return unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
1184 0 ▶ return ($clid=~m/^${id}$/)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$clid =~ /^$id$/ ? : 0 0 0
1185 }
1186  
1187 ####################################################################################################
1188 ## Message commands (like POLL in EPP)
1189 ####################################################################################################
1190  
1191 sub message_retrieve
1192 {
1193 0 ▶ my ($self,$ndr,$id)=@_;
Subroutine message_retrieve: not called CC=1 SCAR=6.9
Pod undocumented
1194 0 my $rc=$ndr->process('message','retrieve',[$id]);
1195 0 return $rc;
1196 }
1197  
1198 sub message_delete
1199 {
1200 0 ▶ my ($self,$ndr,$id)=@_;
Subroutine message_delete: not called CC=1 SCAR=6.9
Pod undocumented
1201 0 my $rc=$ndr->process('message','delete',[$id]);
1202 0 return $rc;
1203 }
1204  
1205 sub message_waiting
1206 {
1207 0 ▶ my ($self,$ndr)=@_;
Subroutine message_waiting: not called CC=3 SCAR=24.8
Pod undocumented
1208 0 my $c=$self->message_count($ndr);
1209 0 ▶ return (defined($c) && $c)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $c && $c ? : 0 0 0
Condition0%0/3
defined $c and $c
!ll&&!rl&&r
000
MC/DC0%0/2
defined $c and $c
defined $c $c
Truth table0%0/3
A and B
A= defined $cB= $c
ABresult
0X0
100
111
1210 }
1211  
1212 sub message_count
1213 {
1214 0 ▶ my ($self,$ndr)=@_;
Subroutine message_count: not called CC=5 SCAR=34.0
Pod undocumented
1215 0 my $count=$ndr->get_info('count','message','info');
1216 0 ▶ return $count if defined($count);
Branch: 1 branch
BranchTrueFalseTotal
if defined $count 0 0 0
1217 0 my $rc=$ndr->process('message','retrieve');
1218 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
1219 0 $count=$ndr->get_info('count','message','info');
1220 0 ▶ return (defined($count) && $count)? $count : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $count && $count ? : 0 0 0
Condition0%0/3
defined $count and $count
!ll&&!rl&&r
000
MC/DC0%0/2
defined $count and $count
defined $count $count
Truth table0%0/3
A and B
A= defined $countB= $count
ABresult
0X0
100
111
1221 }
1222  
1223 ####################################################################################################
1224 ## Extensions commands used by at least 2 DRDs so factorized here
1225 ## TODO: for now, this is kind of contradictory with make_exception_for_unavailable_operations()
1226 ## this whole part would need to be redefined, see TODO file
1227 ####################################################################################################
1228  
1229 ## For AFNIC ARNES (subclassed) BE EURid LU
1230 sub domain_trade_start
1231 {
1232 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_trade_start: not called CC=1 SCAR=6.9
Pod undocumented
1233 0 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
1234 0 return $ndr->process('domain','trade_request',[$domain,$rd]);
1235 }
1236  
1237 ## For AFNIC LU
1238 sub domain_trade_query
1239 {
1240 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_trade_query: not called CC=1 SCAR=6.9
Pod undocumented
1241 0 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
1242 0 return $ndr->process('domain','trade_query',[$domain,$rd]);
1243 }
1244  
1245 ## For AFNIC EURid LU
1246 sub domain_trade_stop
1247 {
1248 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_trade_stop: not called CC=1 SCAR=6.9
Pod undocumented
1249 0 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
1250 0 return $ndr->process('domain','trade_cancel',[$domain,$rd]);
1251 }
1252  
1253 ## Used by AT & NO but not with same EPP command name => impossible to factorize here
1254 ##sub domain_withdraw
1255 ##sub domain_transfer_execute
1256  
1257 ## For BE EURid SIDN (subclassed)
1258 sub domain_undelete
1259 {
1260 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_undelete: not called CC=1 SCAR=6.9
Pod undocumented
1261 0 $self->enforce_domain_name_constraints($ndr,$domain,'undelete');
1262 0 return $ndr->process('domain','undelete',[$domain,$rd]);
1263 }
1264  
1265 ## For BE EUrid
1266 sub domain_reactivate
1267 {
1268 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_reactivate: not called CC=1 SCAR=6.9
Pod undocumented
1269 0 $self->enforce_domain_name_constraints($ndr,$domain,'reactivate');
1270 0 return $ndr->process('domain','reactivate',[$domain,$rd]);
1271 }
1272  
1273 ## For BE EURid
1274 ## (no _stop in BE ?)
1275 sub domain_transfer_quarantine
1276 {
1277 0 ▶ my ($self,$ndr,$domain,$op,$rd)=@_;
Subroutine domain_transfer_quarantine: not called CC=4 SCAR=30.0
Pod undocumented
1278 0 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_quarantine');
1279 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Transfer from quarantine operation must be start or stop') unless ($op=~m/^(?:start|stop)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /^(?:start|stop)$/ 0 0 0
1280  
1281 0 my $rc;
1282 0 ▶ if ($op eq 'start')
Branch: 2 branches
BranchTrueFalseTotal
if ($op eq 'start') { } 0 0 0
elsif ($op eq 'stop') { } 0 0 0
1283 {
1284 0 $rc=$ndr->process('domain','transferq_request',[$domain,$rd]);
1285 } elsif ($op eq 'stop')
1286 {
1287 0 $rc=$ndr->process('domain','transferq_cancel',[$domain,$rd]);
1288 }
1289 0 return $rc;
1290 }
1291  
1292 0 ▶sub domain_transfer_quarantine_start { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer_quarantine($ndr,$domain,'start',$rd); }
Subroutine domain_transfer_quarantine_start: not called CC=1 SCAR=6.9
Pod undocumented
1293 0 ▶sub domain_transfer_quarantine_stop { my ($self,$ndr,$domain,$rd)=@_; return $self->domain_transfer_quarantine($ndr,$domain,'stop',$rd); }
Subroutine domain_transfer_quarantine_stop: not called CC=1 SCAR=6.9
Pod undocumented
1294  
1295 ## nsgroup_* + keygroup_*
1296 ## For BE EUrid
1297 sub nsgroup_create
1298 {
1299 0 ▶ my ($self,$ndr,$nsg)=@_;
Subroutine nsgroup_create: not called CC=2 SCAR=17.9
Pod undocumented
1300 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('nsgroup_create needs an hosts object') unless defined Net::DRI::Util::isa_nsgroup($nsg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined Net::DRI::Util::isa_nsgroup($nsg) 0 0 0
1301 0 return $ndr->process('nsgroup','create',[$nsg]);
1302 }
1303  
1304 sub nsgroup_delete
1305 {
1306 0 ▶ my ($self,$ndr,$nsg)=@_;
Subroutine nsgroup_delete: not called CC=2 SCAR=17.9
Pod undocumented
1307 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('nsgroup_delete needs an hosts object') unless defined Net::DRI::Util::isa_nsgroup($nsg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined Net::DRI::Util::isa_nsgroup($nsg) 0 0 0
1308 0 return $ndr->process('nsgroup','delete',[$nsg]);
1309 }
1310  
1311 sub nsgroup_check
1312 {
1313 0 ▶ my ($self,$ndr,@nsg)=@_;
Subroutine nsgroup_check: not called CC=2 SCAR=17.9
Pod undocumented
1314 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('nsgroup_check needs at least an hosts object') unless grep { defined Net::DRI::Util::isa_nsgroup($_) } @nsg;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {defined Net::DRI::Util::isa_nsgroup($_);} @nsg 0 0 0
1315 0 return $ndr->process('nsgroup','check',[@nsg]);
1316 }
1317  
1318 sub nsgroup_info
1319 {
1320 0 ▶ my ($self,$ndr,$nsg)=@_;
Subroutine nsgroup_info: not called CC=2 SCAR=17.9
Pod undocumented
1321 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('nsgroup_info needs an hosts object') unless defined Net::DRI::Util::isa_nsgroup($nsg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined Net::DRI::Util::isa_nsgroup($nsg) 0 0 0
1322 0 return $ndr->process('nsgroup','info',[$nsg]);
1323 }
1324  
1325 sub nsgroup_update
1326 {
1327 0 ▶ my ($self,$ndr,$nsg,$tochange)=@_;
Subroutine nsgroup_update: not called CC=2 SCAR=17.9
Pod undocumented
1328 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('nsgroup_update needs an hosts object') unless defined Net::DRI::Util::isa_nsgroup($nsg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined Net::DRI::Util::isa_nsgroup($nsg) 0 0 0
1329 0 Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
1330 0 return $ndr->process('nsgroup','update',[$nsg,$tochange]);
1331 }
1332  
1333 sub keygroup_create
1334 {
1335 0 ▶ my ($self,$ndr,$kg,$rd)=@_;
Subroutine keygroup_create: not called CC=2 SCAR=17.9
Pod undocumented
1336 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('keygroup_create needs a keygroup name') unless defined $kg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kg 0 0 0
1337 0 return $ndr->process('keygroup','create',[$kg,$rd]);
1338 }
1339  
1340 sub keygroup_delete
1341 {
1342 0 ▶ my ($self,$ndr,$kg,$rd)=@_;
Subroutine keygroup_delete: not called CC=2 SCAR=17.9
Pod undocumented
1343 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('keygroup_delete needs a keygroup name') unless defined $kg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kg 0 0 0
1344 0 return $ndr->process('keygroup','delete',[$kg,$rd]);
1345 }
1346  
1347 sub keygroup_check
1348 {
1349 0 ▶ my ($self,$ndr,@kgs)=@_;
Subroutine keygroup_check: not called CC=4 SCAR=30.0
Pod undocumented
1350 0 ▶ my $rd=(@kgs && ref $kgs[-1] eq 'HASH')? pop(@kgs) : {};
Branch: 1 branch
BranchTrueFalseTotal
@kgs && ref $kgs[-1] eq 'HASH' ? : 0 0 0
Condition0%0/3
@kgs and ref $kgs[-1] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@kgs and ref $kgs[-1] eq "HASH"
@kgs ref $kgs[-1] eq "HASH"
Truth table0%0/3
A and B
A= @kgsB= ref $kgs[-1] eq "HASH"
ABresult
0X0
100
111
1351 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('keygroup_check needs at least a keygroup name') unless grep { defined } @kgs;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {defined $_;} @kgs 0 0 0
1352 0 return $ndr->process('keygroup','check',[\@kgs,$rd]);
1353 }
1354  
1355 sub keygroup_info
1356 {
1357 0 ▶ my ($self,$ndr,$kg,$rd)=@_;
Subroutine keygroup_info: not called CC=2 SCAR=17.9
Pod undocumented
1358 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('keygroup_info needs a keygroup name') unless defined $kg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kg 0 0 0
1359 0 return $ndr->process('keygroup','info',[$kg,$rd]);
1360 }
1361  
1362 sub keygroup_update
1363 {
1364 0 ▶ my ($self,$ndr,$kg,$tochange,$rd)=@_;
Subroutine keygroup_update: not called CC=2 SCAR=17.9
Pod undocumented
1365 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('keygroup_update needs a keygroup name') unless defined $kg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kg 0 0 0
1366 0 Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
1367 0 return $ndr->process('keygroup','update',[$kg,$tochange,$rd]);
1368 }
1369  
1370 # For BookMyName Gandi OVH
1371  
1372 sub account_list_domains
1373 {
1374 0 ▶ my ($self,$ndr)=@_;
Subroutine account_list_domains: not called CC=2 SCAR=17.9
Pod undocumented
1375 0 my $rc=$ndr->try_restore_from_cache('account','domains','list');
1376 0 ▶ if (! defined $rc) { $rc=$ndr->process('account','list_domains'); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
1377 0 return $rc;
1378 }
1379  
1380 ####################################################################################################
1381 # Misc
1382 ####################################################################################################
1383  
1384 sub ping
1385 {
1386 0 ▶ my ($self,$ndr,$reconnect)=@_;
Subroutine ping: not called CC=1 SCAR=6.9
Pod undocumented
1387 0 my ($po,$to)=$ndr->protocol_transport();
1388  
1389 0 my $rc=$to->ping({protocol=>$po},$reconnect); ## this can die
1390 0 return $rc;
1391 }
1392  
1393 sub raw_command
1394 {
1395 0 ▶ my ($self,$ndr,$cmd)=@_;
Subroutine raw_command: not called CC=1 SCAR=6.9
Pod undocumented
1396  
1397 0 my ($po,$to)=$ndr->protocol_transport();
1398 0 my $trid=$ndr->generate_trid();
1399 0 my $ctx={trid => $trid, otype => 'raw', oaction => 'command', phase => 'active' };
1400 0 my $count=1;
1401  
1402 0 my $tosend=Net::DRI::Data::Raw->new_from_string($cmd);
1403 0 $to->send($ctx,$tosend,$count,[]);
1404 0 my $res=$to->receive($ctx,$count);
1405 0 return $res->as_string();
1406 }
1407  
1408 ####################################################################################################
1409 79 1;
« DRI/Protocol/EPP/Extensions/VeriSign/JobsContact.pm ↑ Summary DRI/Protocol/IRIS/DCHK/Domain.pm »