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