DRI/DRD/CentralNic.pm

filter: Statementstmt 60.7% 34 / 56 Branchbran 20.0% 2 / 10 Conditioncond 6.6% 1 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 61.1% 11 / 18 Podpod 33.3% 4 / 12 totaltotal 43.7% 52 / 119 CC 11 SCAR 23.6
CC
11
Cov
46%
verify_duration_renew
30.0
transport_protocol_init
20.4
transport_protocol_default
2.3
CRAP 10.6
« DRI/Protocol/EPP/Connection.pm ↑ Summary DRI/Transport/SMTP.pm »
1 ## Domain Registry Interface, CentralNic Registry Driver
2 ##
3 ## Copyright (c) 2008-2011,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::CentralNic;
16  
17 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 4 ▶use base qw/Net::DRI::DRD/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 4 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 4 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 4 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 =pod
28  
29 =head1 NAME
30  
31 Net::DRI::DRD::CentralNic - CentralNic (.LA .EU.COM .UK.COM etc.) Registry driver for Net::DRI
32  
33 =head1 DESCRIPTION
34  
35 Please see the README file for details.
36  
37 =head1 SUPPORT
38  
39 For now, support questions should be sent to:
40  
41 E<lt>netdri@dotandco.comE<gt>
42  
43 Please also see the SUPPORT file in the distribution.
44  
45 =head1 SEE ALSO
46  
47 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
48  
49 =head1 AUTHOR
50  
51 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
52  
53 =head1 COPYRIGHT
54  
55 Copyright (c) 2008-2011,2013 Patrick Mevzek <netdri@dotandco.com>.
56 All rights reserved.
57  
58 This program is free software; you can redistribute it and/or modify
59 it under the terms of the GNU General Public License as published by
60 the Free Software Foundation; either version 2 of the License, or
61 (at your option) any later version.
62  
63 See the LICENSE file that comes with this distribution for more details.
64  
65 =cut
66  
67 ####################################################################################################
68  
69 sub new
70 3 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
71 3 my $class=shift;
72 3 my $self=$class->SUPER::new(@_);
73 3 $self->{info}->{host_as_attr}=0;
74 3 $self->{info}->{contact_i18n}=2; ## INT only
75 3 return $self;
76 }
77  
78 0 ▶sub periods { return map { DateTime::Duration->new(years => $_) } (2..10); }
Subroutine periods: not called CC=1 SCAR=6.9
Pod documented
79 3 ▶sub name { return 'CentralNic'; }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
80 3 ▶sub tlds { return (qw/la pw com.de/,
Subroutine tlds: called CC=1 SCAR=0.0
Pod documented
81 6 (map { $_.'.org' } qw/us ae/),
82 15 (map { $_.'.net' } qw/uk se gb jp hu/),
83 3 (map { $_.'.com' } qw/eu uk us cn de jpn kr no za br ar ru sa se hu gb qc uy gr/)
84 ); } ## see https://www.centralnic.com/portfolio/domains/registration
85  
86 0 ▶sub object_types { return ('domain','ns','contact'); }
Subroutine object_types: not called CC=1 SCAR=6.9
Pod documented
87 0 ▶sub profile_types { return qw/epp/; }
Subroutine profile_types: not called CC=1 SCAR=6.9
Pod undocumented
88  
89 sub transport_protocol_default
90 3 ▶{
Subroutine transport_protocol_default: called CC=2 SCAR=8.1
Pod undocumented
91 3 my ($self,$type)=@_;
92  
93 3 ▶ return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::CentralNic',{}) if $type eq 'epp';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "epp" 3 0 3
94 0 return;
95 }
96  
97 ## From http://centralnicstatus.com/2011/07/01/mandatory-use-of-epp-client-ssl-certificates-2011-07-25/
98 ## certificates are now mandatory
99 ## (stolen from DRD/DotCooperation, see comment in it)
100 sub transport_protocol_init
101 3 ▶{
Subroutine transport_protocol_init: called CC=6 SCAR=30.2
Pod undocumented
102 3 my ($self,$type,$tc,$tp,$pc,$pp,$test)=@_;
103  
104 3 ▶ if ($type eq 'epp' && !$test)
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "epp" and not $test) 0 3 3
Condition33%1/3
$type eq "epp" and not $test
!ll&&!rl&&r
030
MC/DC0%0/2
$type eq "epp" and not $test
$type eq "epp" not $test
Truth table33%1/3
A and not(B)
A= $type eq "epp"B= not $test
ABresult
0X0
100
111
105 {
106 0 ▶ my @n=grep { ! exists($tp->{$_}) || ! defined($tp->{$_}) || ! $tp->{$_}} qw/ssl_key_file ssl_cert_file ssl_ca_file/;
Condition0%0/6
exists $tp->{$_} && defined $tp->{$_} && $tp->{$_}
!ll&&!rl&&r
000
exists $tp->{$_} and defined $tp->{$_}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $tp->{$_} && defined $tp->{$_} && $tp->{$_}
exists $tp->{$_} defined $tp->{$_} $tp->{$_}
Truth table0%0/4
A and B && C
A= exists $tp->{$_}B= defined $tp->{$_}C= $tp->{$_}
ABCresult
0XX0
10X0
1100
1111
107 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('These transport parameters must be defined: '.join(' ',@n)) if @n;
Branch: 1 branch
BranchTrueFalseTotal
if @n 0 0 0
108 }
109  
110 3 return;
111 }
112  
113  
114 ####################################################################################################
115  
116 sub verify_name_domain
117 0 ▶{
Subroutine verify_name_domain: not called CC=1 SCAR=6.9
Pod undocumented
118 0 my ($self,$ndr,$domain,$op)=@_;
119 0 return $self->_verify_name_rules($domain,$op,{check_name => 1,
120 my_tld => 1,
121 min_length => 3,
122 });
123 }
124  
125 sub verify_duration_transfer
126 0 ▶{
Subroutine verify_duration_transfer: not called CC=1 SCAR=6.9
Pod undocumented
127 0 my ($self,$ndr,$duration,$domain,$op)=@_;
128  
129 0 return $self->_verify_duration_transfer_15days($ndr,$duration,$domain,$op);
130 }
131  
132 sub verify_duration_renew
133 0 ▶{
Subroutine verify_duration_renew: not called CC=5 SCAR=34.0
Pod undocumented
134 0 my ($self,$ndr,$duration,$domain,$curexp)=@_;
135  
136 0 ▶ return 0 unless (defined $duration && defined $curexp && Net::DRI::Util::is_class($curexp,'DateTime'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $duration and defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime") 0 0 0
Condition0%0/6
defined $duration and defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
!ll&&!rl&&r
000
defined $duration and defined $curexp
!ll&&!rl&&r
000
MC/DC0%0/3
defined $duration and defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
defined $duration defined $curexp Net::DRI::Util::is_class($curexp, "DateTime")
Truth table0%0/4
A and B and C
A= defined $durationB= defined $curexpC= Net::DRI::Util::is_class($curexp, "DateTime")
ABCresult
0XX0
10X0
1100
1111
137 0 my $newexp=$curexp+$duration; ## New expiration
138 0 my $max=DateTime->new(year => 2037, month => 1, day => 1, time_zone => $curexp->time_zone()->name());
139 0 my $cmp=DateTime->compare($newexp,$max);
140 0 ▶ return 2 unless ($cmp == -1); ## we must have curexp+duration < 2037
Branch: 1 branch
BranchTrueFalseTotal
unless $cmp == -1 0 0 0
141 0 return 0; ## everything ok
142 }
143  
144 ####################################################################################################
145  
146 sub domain_release
147 0 ▶{
Subroutine domain_release: not called CC=1 SCAR=6.9
Pod undocumented
148 0 my ($self,$ndr,$domain,$rd)=@_;
149 0 $self->enforce_domain_name_constraints($ndr,$domain,'release');
150  
151 0 return $ndr->process('domain','release',[$domain,$rd]);
152 }
153  
154 ####################################################################################################
155 4 1;
« DRI/Protocol/EPP/Connection.pm ↑ Summary DRI/Transport/SMTP.pm »