line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, SIDN EPP Domain extensions |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2009-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::Protocol::EPP::Extensions::SIDN::Domain; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
926
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
21
|
1
|
|
|
1
|
|
5
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
597
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
0
|
|
|
|
|
|
my %tmp=( |
29
|
|
|
|
|
|
|
info => [ undef, \&info_parse], |
30
|
|
|
|
|
|
|
create => [ \&create, undef ], |
31
|
|
|
|
|
|
|
delete_cancel => [ \&delete_cancel, undef ], |
32
|
|
|
|
|
|
|
transfer_request => [ undef, \&transfer_parse ], |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#################################################################################################### |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub build_command_extension |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
|
my ($mes,$epp,$tag)=@_; |
43
|
0
|
|
|
|
|
|
return $mes->command_extension_register($tag,sprintf('xmlns:sidn="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('sidn'))); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub info_parse |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
49
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
50
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('sidn','ext'); |
53
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $ns=$mes->ns('sidn'); |
56
|
0
|
|
|
|
|
|
$infdata=Net::DRI::Util::xml_traverse($infdata,$ns,'infData','domain'); |
57
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
|
my ($name,$c)=@$el; |
62
|
0
|
0
|
|
|
|
|
if ($name eq 'optOut') |
|
|
0
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{opt_out}=Net::DRI::Util::xml_parse_boolean($c->textContent()); |
65
|
|
|
|
|
|
|
} elsif ($name eq 'limited') |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{limited}=Net::DRI::Util::xml_parse_boolean($c->textContent()); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub create |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
76
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('contacts are mandatory in .NL for domain_create') unless Net::DRI::Util::has_contact($rd); |
77
|
0
|
|
|
|
|
|
my $cs=$rd->{contact}; |
78
|
0
|
|
|
|
|
|
my @c=$cs->get('registrant'); |
79
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('one registrant is mandatory in .NL for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::SIDN')); |
80
|
0
|
|
|
|
|
|
@c=$cs->get('admin'); |
81
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('one admin contact is mandatory in .NL for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::SIDN')); |
82
|
0
|
|
|
|
|
|
@c=$cs->get('tech'); |
83
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('at least one tech contact is mandatory in .NL for domain_create') unless (@c >= 1 && scalar(@c)==scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::SIDN') } @c)); |
|
0
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub delete_cancel |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
90
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined($domain) && $domain; |
93
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain); |
94
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'sidn:command'); |
95
|
0
|
|
|
|
|
|
$mes->command_extension($eid,[['sidn:domainCancelDelete',['sidn:name',$domain]],['sidn:clTRID',$mes->cltrid()]]); |
96
|
0
|
|
|
|
|
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub transfer_parse |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
102
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
103
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $trndata=$mes->get_response('sidn','ext'); |
106
|
0
|
0
|
|
|
|
|
return unless defined $trndata; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $ns=$mes->ns('sidn'); |
109
|
0
|
|
|
|
|
|
my $pw=Net::DRI::Util::xml_traverse($trndata,$ns,'trnData','pw'); |
110
|
0
|
0
|
|
|
|
|
return unless defined $pw; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{transfer_new_token}=$pw->textContent(); |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#################################################################################################### |
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |