| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, CentralNic Registry Driver | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2008-2011,2013 Patrick Mevzek . 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 | 2 |  |  | 2 |  | 1209 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 47 |  | 
| 18 | 2 |  |  | 2 |  | 7 | use warnings; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 44 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 2 |  |  | 2 |  | 6 | use base qw/Net::DRI::DRD/; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 583 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 |  |  | 2 |  | 9 | use DateTime::Duration; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 30 |  | 
| 23 | 2 |  |  | 2 |  | 7 | use DateTime; | 
|  | 2 |  |  |  |  | 10 |  | 
|  | 2 |  |  |  |  | 30 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 2 |  |  | 2 |  | 6 | use Net::DRI::Util; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 934 |  | 
| 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 |  |  |  |  |  |  | Enetdri@dotandco.comE | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | Please also see the SUPPORT file in the distribution. | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | Ehttp://www.dotandco.com/services/software/Net-DRI/E | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 AUTHOR | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | Patrick Mevzek, Enetdri@dotandco.comE | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | Copyright (c) 2008-2011,2013 Patrick Mevzek . | 
| 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 |  |  |  |  |  |  | { | 
| 71 | 1 |  |  | 1 | 0 | 1 | my $class=shift; | 
| 72 | 1 |  |  |  |  | 7 | my $self=$class->SUPER::new(@_); | 
| 73 | 1 |  |  |  |  | 5 | $self->{info}->{host_as_attr}=0; | 
| 74 | 1 |  |  |  |  | 1 | $self->{info}->{contact_i18n}=2;       ## INT only | 
| 75 | 1 |  |  |  |  | 3 | return $self; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 0 |  |  | 0 | 1 | 0 | sub periods      { return map { DateTime::Duration->new(years => $_) } (2..10); } | 
|  | 0 |  |  |  |  | 0 |  | 
| 79 | 1 |  |  | 1 | 1 | 2 | sub name         { return 'CentralNic'; } | 
| 80 |  |  |  |  |  |  | sub tlds         { return (qw/la pw com.de/, | 
| 81 | 2 |  |  |  |  | 4 | (map { $_.'.org' } qw/us ae/), | 
| 82 | 5 |  |  |  |  | 5 | (map { $_.'.net' } qw/uk se gb jp hu/), | 
| 83 | 1 |  |  | 1 | 1 | 2 | (map { $_.'.com' } qw/eu uk us cn de jpn kr no za br ar ru sa se hu gb qc uy gr/) | 
|  | 19 |  |  |  |  | 17 |  | 
| 84 |  |  |  |  |  |  | ); } ## see https://www.centralnic.com/portfolio/domains/registration | 
| 85 |  |  |  |  |  |  |  | 
| 86 | 0 |  |  | 0 | 1 | 0 | sub object_types { return ('domain','ns','contact'); } | 
| 87 | 0 |  |  | 0 | 0 | 0 | sub profile_types { return qw/epp/; } | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | sub transport_protocol_default | 
| 90 |  |  |  |  |  |  | { | 
| 91 | 1 |  |  | 1 | 0 | 1 | my ($self,$type)=@_; | 
| 92 |  |  |  |  |  |  |  | 
| 93 | 1 | 50 |  |  |  | 3 | return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::CentralNic',{}) if $type eq 'epp'; | 
| 94 | 0 |  |  |  |  | 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/COOP, see comment in it) | 
| 100 |  |  |  |  |  |  | sub transport_protocol_init | 
| 101 |  |  |  |  |  |  | { | 
| 102 | 1 |  |  | 1 | 0 | 2 | my ($self,$type,$tc,$tp,$pc,$pp,$test)=@_; | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 1 | 50 | 33 |  |  | 4 | if ($type eq 'epp' && !$test) | 
| 105 |  |  |  |  |  |  | { | 
| 106 | 0 |  | 0 |  |  | 0 | my @n=grep { ! exists($tp->{$_}) || ! defined($tp->{$_}) || ! $tp->{$_}} qw/ssl_key_file ssl_cert_file ssl_ca_file/; | 
|  | 0 |  |  |  |  | 0 |  | 
| 107 | 0 | 0 |  |  |  | 0 | Net::DRI::Exception::usererr_insufficient_parameters('These transport parameters must be defined: '.join(' ',@n)) if @n; | 
| 108 |  |  |  |  |  |  | } | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 1 |  |  |  |  | 2 | return; | 
| 111 |  |  |  |  |  |  | } | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | #################################################################################################### | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | sub verify_name_domain | 
| 117 |  |  |  |  |  |  | { | 
| 118 | 0 |  |  | 0 | 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 |  |  |  |  |  |  | { | 
| 127 | 0 |  |  | 0 | 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 |  |  |  |  |  |  | { | 
| 134 | 0 |  |  | 0 | 0 |  | my ($self,$ndr,$duration,$domain,$curexp)=@_; | 
| 135 |  |  |  |  |  |  |  | 
| 136 | 0 | 0 | 0 |  |  |  | return 0 unless (defined $duration && defined $curexp && Net::DRI::Util::is_class($curexp,'DateTime')); | 
|  |  |  | 0 |  |  |  |  | 
| 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 | 0 |  |  |  |  | return 2 unless ($cmp == -1); ## we must have curexp+duration < 2037 | 
| 141 | 0 |  |  |  |  |  | return 0; ## everything ok | 
| 142 |  |  |  |  |  |  | } | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | #################################################################################################### | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | sub domain_release | 
| 147 |  |  |  |  |  |  | { | 
| 148 | 0 |  |  | 0 | 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 |  |  |  |  |  |  | 1; |