| 1 | ## Domain Registry Interface, EPP NameStore Extension for Verisign | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2006,2008,2009 Rony Meyer <perl@spot-light.ch>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## 2010,2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 5 | ## | ||||||||||||||||||||||||||||
| 6 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 7 | ## | ||||||||||||||||||||||||||||
| 8 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 9 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 10 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 11 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 12 | ## | ||||||||||||||||||||||||||||
| 13 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 14 | #################################################################################################### | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | package Net::DRI::Protocol::EPP::Extensions::VeriSign::NameStore; | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =pod | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 NAME | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | Net::DRI::Protocol::EPP::Extensions::VeriSign::NameStore - VeriSign EPP NameStore Extension for Net::DRI | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | E<lt>netdri@spot-light.chE<gt> | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Rony Meyer, E<lt>perl@spot-light.chE<gt> | ||||||||||||||||||||||||||||
| 49 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | Copyright (c) 2006,2008,2009 Rony Meyer <perl@spot-light.ch>. | ||||||||||||||||||||||||||||
| 54 | (c) 2010,2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 55 | All rights reserved. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 58 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 59 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 60 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | #################################################################################################### | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | sub register_commands | ||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | # domain functions | ||||||||||||||||||||||||||||
| 72 | 0 | my %tmpDomain = ( | |||||||||||||||||||||||||||
| 73 | check => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 74 | check_multi => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 75 | info => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 76 | transfer_query => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 77 | create => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 78 | delete => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 79 | renew => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 80 | transfer_request => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 81 | transfer_cancel => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 82 | transfer_answer => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 83 | update => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # host functions | ||||||||||||||||||||||||||||
| 87 | 0 | my %tmpHost = ( | |||||||||||||||||||||||||||
| 88 | create => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 89 | check => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 90 | check_multi => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 91 | info => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 92 | delete => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 93 | update => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | # contact functions | ||||||||||||||||||||||||||||
| 97 | 0 | my %tmpContact = ( | |||||||||||||||||||||||||||
| 98 | create => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 99 | check => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 100 | check_multi => [ \&add_namestore_ext, \&parse ], | ||||||||||||||||||||||||||||
| 101 | info => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 102 | delete => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 103 | update => [ \&add_namestore_ext, undef ], | ||||||||||||||||||||||||||||
| 104 | ); | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | return { 'domain' => \%tmpDomain, | |||||||||||||||||||||||||||
| 107 | 'host' => \%tmpHost, | ||||||||||||||||||||||||||||
| 108 | 'contact'=> \%tmpContact, | ||||||||||||||||||||||||||||
| 109 | 'message' => { result => [ undef, \&parse_error ] }, | ||||||||||||||||||||||||||||
| 110 | }; | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | sub setup | ||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 116 | 0 | state $rns = { 'namestoreExt' => 'http://www.verisign-grs.com/epp/namestoreExt-1.1' }; | |||||||||||||||||||||||||||
| 117 | 0 | $po->ns($rns); | |||||||||||||||||||||||||||
| 118 | 0 | return; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | #################################################################################################### | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | ########### Add the NameStore Extenstion to all domain & host commands | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | sub add_namestore_ext | ||||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my ($epp,$domain,@p)=@_; | ||||||||||||||||||||||||||
|
Subroutine
add_namestore_ext: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 128 | 0 | my $rd=pop @p; | |||||||||||||||||||||||||||
| 129 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 130 | 0 | my $defprod=$epp->default_parameters()->{subproductid}; | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | my $eid=$mes->command_extension_register('namestoreExt','namestoreExt'); | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'subproductid') && $rd->{subproductid}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::has_key($rd, "subproductid") and $rd->{"subproductid"}
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "subproductid") and $rd->{"subproductid"}
Net::DRI::Util::has_key($rd, "subproductid")
$rd->{"subproductid"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "subproductid")B= $rd->{"subproductid"}
| |||||||||||||||||||||||||||||
| 135 | { | ||||||||||||||||||||||||||||
| 136 | 0 | $mes->command_extension($eid,['namestoreExt:subProduct',$rd->{subproductid}]); | |||||||||||||||||||||||||||
| 137 | 0 | return; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 0 | ▶ | unless ($defprod eq '_auto_') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||
| 142 | 0 | $mes->command_extension($eid,['namestoreExt:subProduct',$defprod]); | |||||||||||||||||||||||||||
| 143 | 0 | return; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | ## We do not know what will happen in case of check_multi with multiple TLDs | ||||||||||||||||||||||||||||
| 147 | 0 | my $ext='dotCOM'; | |||||||||||||||||||||||||||
| 148 | 0 | ▶ | $domain=$domain->[0] if (ref($domain) eq 'ARRAY'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | $ext='dot'.uc($1) if ($domain=~m/\.(net|cc|tv|bz|jobs|edu)$/i); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | $mes->command_extension($eid,['namestoreExt:subProduct',$ext]); | |||||||||||||||||||||||||||
| 152 | 0 | return; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | sub parse | ||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 158 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 159 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | my $infdata=$mes->get_extension('namestoreExt','namestoreExt'); | |||||||||||||||||||||||||||
| 162 | 0 | ▶ | return unless $infdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | my $c=$infdata->getChildrenByTagNameNS($mes->ns('namestoreExt'),'subProduct'); | |||||||||||||||||||||||||||
| 164 | 0 | ▶ | return unless $c; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | $rinfo->{$otype}->{$oname}->{subproductid}=$c->get_node(1)->textContent(); | |||||||||||||||||||||||||||
| 167 | 0 | return; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | sub parse_error | ||||||||||||||||||||||||||||
| 171 | { | ||||||||||||||||||||||||||||
| 172 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
parse_error: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 173 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | ## Parse namestoreExt in case of errors | ||||||||||||||||||||||||||||
| 176 | 0 | ▶ | return unless $mes->result_is('PARAMETER_VALUE_POLICY_ERROR') || $mes->result_is('COMMAND_SYNTAX_ERROR'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mes->result_is("PARAMETER_VALUE_POLICY_ERROR") or $mes->result_is("COMMAND_SYNTAX_ERROR")
MC/DC0%0/2
$mes->result_is("PARAMETER_VALUE_POLICY_ERROR") or $mes->result_is("COMMAND_SYNTAX_ERROR")
$mes->result_is("PARAMETER_VALUE_POLICY_ERROR")
$mes->result_is("COMMAND_SYNTAX_ERROR")
Truth table0%0/3
A or B
A= $mes->result_is("PARAMETER_VALUE_POLICY_ERROR")B= $mes->result_is("COMMAND_SYNTAX_ERROR")
| |||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | my $data=$mes->get_extension('namestoreExt','nsExtErrData'); | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 0 | $data=$data->getChildrenByTagNameNS($mes->ns('namestoreExt'),'msg'); | |||||||||||||||||||||||||||
| 181 | 0 | ▶ | return unless defined $data && $data->size(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $data and $data->size
MC/DC0%0/2
defined $data and $data->size
defined $data
$data->size
Truth table0%0/3
A and B
A= defined $dataB= $data->size
| |||||||||||||||||||||||||||||
| 182 | 0 | $data=$data->get_node(1); | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | ## We add it to the latest status extra_info seen. | ||||||||||||||||||||||||||||
| 185 | 0 | $mes->add_to_extra_info({from => 'verisign:namestoreExt', type => 'text', message => $data->textContent(), code => $data->getAttribute('code')}); | |||||||||||||||||||||||||||
| 186 | 0 | return; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | ######################################################################################################### | ||||||||||||||||||||||||||||
| 190 | 1 | 1; | |||||||||||||||||||||||||||