line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, .NO Domain extensions |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2008-2010,2013-2014 UNINETT Norid AS, Ehttp://www.norid.noE, |
4
|
|
|
|
|
|
|
## Trond Haugen Einfo@norid.noE |
5
|
|
|
|
|
|
|
## (c) 2016 Patrick Mevzek Enetdri@dotandco.comE |
6
|
|
|
|
|
|
|
## All rights reserved. |
7
|
|
|
|
|
|
|
## |
8
|
|
|
|
|
|
|
## This file is part of Net::DRI |
9
|
|
|
|
|
|
|
## |
10
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
11
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
12
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
13
|
|
|
|
|
|
|
## (at your option) any later version. |
14
|
|
|
|
|
|
|
## |
15
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
16
|
|
|
|
|
|
|
#################################################################################################### |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Net::DRI::Protocol::EPP::Extensions::NO::Domain; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
729
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
21
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
4
|
use Net::DRI::DRD::NORID; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
24
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Protocol::EPP::Core::Domain; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
25
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
26
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
27
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Protocol::EPP::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
28
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Protocol::EPP::Extensions::NO::Host; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1454
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=pod |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Net::DRI::Protocol::EPP::Extensions::NO::Domain - .NO EPP Domain extension commands for Net::DRI |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Please see the README file for details. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SUPPORT |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
For now, support questions should be sent to: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Trond Haugen, Einfo@norid.noE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Copyright (c) 2008-2010,2013-2014 UNINETT Norid AS, Ehttp://www.norid.noE, |
59
|
|
|
|
|
|
|
Trond Haugen Einfo@norid.noE |
60
|
|
|
|
|
|
|
(c) 2016 Patrick Mevzek Enetdri@dotandco.comE |
61
|
|
|
|
|
|
|
All rights reserved. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
64
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
65
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
66
|
|
|
|
|
|
|
(at your option) any later version. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#################################################################################################### |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub register_commands { |
75
|
0
|
|
|
0
|
0
|
|
my ( $class, $version ) = @_; |
76
|
0
|
|
|
|
|
|
my %tmp = ( |
77
|
|
|
|
|
|
|
check => [ \&facet, undef ], |
78
|
|
|
|
|
|
|
info => [ \&facet, \&parse_info ], |
79
|
|
|
|
|
|
|
transfer_cancel => [ \&facet, undef ], |
80
|
|
|
|
|
|
|
transfer_query => [ \&facet, undef ], |
81
|
|
|
|
|
|
|
renew => [ \&facet, undef ], |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
create => [ \&create, undef ], |
84
|
|
|
|
|
|
|
update => [ \&update, undef ], |
85
|
|
|
|
|
|
|
delete => [ \&delete, undef ], |
86
|
|
|
|
|
|
|
transfer_request => [ \&transfer_request, undef ], |
87
|
|
|
|
|
|
|
transfer_execute => [ |
88
|
|
|
|
|
|
|
\&transfer_execute, |
89
|
|
|
|
|
|
|
\&Net::DRI::Protocol::EPP::Core::Domain::transfer_parse |
90
|
|
|
|
|
|
|
], |
91
|
|
|
|
|
|
|
withdraw => [ \&withdraw, undef ], |
92
|
|
|
|
|
|
|
); |
93
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#################################################################################################### |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub build_command_extension { |
99
|
0
|
|
|
0
|
0
|
|
my ( $mes, $epp, $tag, $no_version ) = @_; |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
0
|
|
|
|
if ($no_version && $no_version eq "1.1") { |
102
|
0
|
|
|
|
|
|
return $mes->command_extension_register( |
103
|
|
|
|
|
|
|
$tag, |
104
|
|
|
|
|
|
|
sprintf( |
105
|
|
|
|
|
|
|
'xmlns:no-ext-domain="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('no_domain_1_1') |
106
|
|
|
|
|
|
|
) |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
} else { |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $mes->command_extension_register( |
111
|
|
|
|
|
|
|
$tag, |
112
|
|
|
|
|
|
|
sprintf( |
113
|
|
|
|
|
|
|
'xmlns:no-ext-domain="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('no_domain') |
114
|
|
|
|
|
|
|
) |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub facet { |
120
|
0
|
|
|
0
|
0
|
|
my ( $epp, $o, $rd ) = @_; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
return Net::DRI::Protocol::EPP::Extensions::NO::Host::build_facets( $epp, $rd ); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub applicant_dataset { |
126
|
0
|
|
|
0
|
0
|
|
my ( $epp, $command, $rd ) = @_; |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my @e; |
129
|
|
|
|
|
|
|
my $eid; |
130
|
|
|
|
|
|
|
|
131
|
0
|
0
|
0
|
|
|
|
return unless ( ref $rd eq 'HASH' && defined $rd->{applicantdataset} && keys %{$rd->{applicantdataset}} ); |
|
0
|
|
0
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
0
|
0
|
0
|
|
|
|
return unless ($command eq 'create' || $command eq 'update'); |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
my $r = $rd->{applicantdataset}; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Check precense of all mandatory elements. |
138
|
|
|
|
|
|
|
# All fields except registrarref are required to have a value. |
139
|
0
|
|
|
|
|
|
foreach my $el ( qw / versionnumber acceptname acceptdate /) { |
140
|
0
|
0
|
|
|
|
|
unless ( $r->{$el} ) { |
141
|
0
|
|
|
|
|
|
Net::DRI::Exception->die(0,'protocol/EPP',1,"applicantdataset is missing a mandatory element: $el"); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
my $versionnumber = $r->{versionnumber}; |
146
|
0
|
|
|
|
|
|
my $acceptname = $r->{acceptname}; |
147
|
0
|
|
|
|
|
|
my $acceptdate = $r->{acceptdate}; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $mes = $epp->message(); |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
$eid = build_command_extension( $mes, $epp, 'no-ext-domain:' . $command, '1.1' ); |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
my @te; |
154
|
0
|
|
|
|
|
|
push @te, [ "no-ext-domain:versionNumber", $versionnumber ]; |
155
|
0
|
|
|
|
|
|
push @te, [ "no-ext-domain:acceptName" , $acceptname ]; |
156
|
0
|
|
|
|
|
|
push @te, [ "no-ext-domain:acceptDate" , $acceptdate ]; |
157
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
if ($command eq 'create') { |
|
|
0
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
push @e, [ 'no-ext-domain:applicantDataset', @te ]; |
160
|
|
|
|
|
|
|
} elsif ($command eq 'update') { |
161
|
0
|
|
|
|
|
|
push @e, [ 'no-ext-domain:chg', [ 'no-ext-domain:applicantDataset', @te ] ]; |
162
|
|
|
|
|
|
|
} |
163
|
0
|
|
|
|
|
|
return $mes->command_extension( $eid, \@e ); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub parse_info { |
167
|
0
|
|
|
0
|
0
|
|
my ( $po, $otype, $oaction, $oname, $rinfo ) = @_; |
168
|
0
|
|
|
|
|
|
my $mes = $po->message(); |
169
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
my $NS = $mes->ns('no_domain_1_1'); |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my $c = $rinfo->{domain}->{$oname}->{self}; |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my $adata = $mes->get_extension('no_domain_1_1','infData'); |
176
|
|
|
|
|
|
|
|
177
|
0
|
0
|
|
|
|
|
return unless $adata; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
for my $t ('versionNumber', 'acceptName', 'acceptDate', 'updateClientID', 'updateDate') { |
180
|
0
|
|
|
|
|
|
my $el = $adata->getElementsByTagNameNS( $NS, $t ); |
181
|
0
|
0
|
|
|
|
|
my $v = $el ? $el->get_node(1)->getFirstChild()->getData() : undef; |
182
|
|
|
|
|
|
|
# Transform the dates to date objects |
183
|
0
|
0
|
0
|
|
|
|
if (defined $v && $v && ($t eq 'acceptDate' || $t eq 'updateDate')) { |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
184
|
0
|
|
|
|
|
|
$v = $po->parse_iso8601($v); |
185
|
|
|
|
|
|
|
} |
186
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{applicantDataset}->{$t} = $v; |
187
|
|
|
|
|
|
|
} |
188
|
0
|
|
|
|
|
|
return; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub create { |
192
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $rd ) = @_; |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
my $fs = $rd->{facets}; |
195
|
0
|
|
|
|
|
|
my $ds = $rd->{applicantdataset}; |
196
|
|
|
|
|
|
|
|
197
|
0
|
0
|
0
|
|
|
|
return unless ( defined($fs) && $fs || defined($ds) && $ds ); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
my $r; |
200
|
|
|
|
|
|
|
|
201
|
0
|
0
|
0
|
|
|
|
if (defined($ds) && $ds) { |
202
|
0
|
|
|
|
|
|
$r = applicant_dataset($epp, 'create', $rd); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
0
|
0
|
|
|
|
|
if ($fs) { |
206
|
0
|
|
|
|
|
|
my $rd; |
207
|
0
|
|
|
|
|
|
$rd->{facets} = $fs; |
208
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
209
|
|
|
|
|
|
|
} |
210
|
0
|
|
|
|
|
|
return $r; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
sub update { |
215
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $todo ) = @_; |
216
|
|
|
|
|
|
|
|
217
|
0
|
|
|
|
|
|
my $fs = $todo->set('facets'); |
218
|
0
|
|
|
|
|
|
my $ds = $todo->set('applicantdataset'); |
219
|
|
|
|
|
|
|
|
220
|
0
|
0
|
0
|
|
|
|
return unless ( defined($fs) && $fs || defined($ds) && $ds ); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
my $r; |
223
|
|
|
|
|
|
|
|
224
|
0
|
0
|
0
|
|
|
|
if (defined($ds) && $ds) { |
225
|
0
|
|
|
|
|
|
my $rd; |
226
|
0
|
|
|
|
|
|
$rd->{applicantdataset} = $ds; |
227
|
0
|
|
|
|
|
|
$r = applicant_dataset($epp, 'update', $rd); |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
|
if ($fs) { |
231
|
0
|
|
|
|
|
|
my $rd; |
232
|
0
|
|
|
|
|
|
$rd->{facets} = $fs; |
233
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
234
|
|
|
|
|
|
|
} |
235
|
0
|
|
|
|
|
|
return $r; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub delete { ## no critic (Subroutines::ProhibitBuiltinHomonyms) |
240
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $rd ) = @_; |
241
|
0
|
|
|
|
|
|
my $mes = $epp->message(); |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
|
|
|
my $ddate = $rd->{deleteDate}; |
244
|
0
|
|
|
|
|
|
my $dfd = $rd->{deletefromdns}; |
245
|
0
|
|
|
|
|
|
my $dfr = $rd->{deletefromregistry}; |
246
|
0
|
|
|
|
|
|
my $fs = $rd->{facets}; |
247
|
|
|
|
|
|
|
|
248
|
0
|
0
|
0
|
|
|
|
return unless ( ( defined($dfd) || defined($dfr) || defined($fs) ) && ( $dfd || $dfr || $fs ) ); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
0
|
0
|
0
|
|
|
|
if (defined($dfd) && ref($dfd)) { |
251
|
0
|
|
|
|
|
|
Net::DRI::Util::check_isa($dfd,'DateTime'); |
252
|
0
|
|
|
|
|
|
$dfd = $dfd->set_time_zone('CET')->strftime('%Y-%m-%d'); |
253
|
|
|
|
|
|
|
} |
254
|
0
|
0
|
0
|
|
|
|
if (defined($dfr) && ref($dfr)) { |
255
|
0
|
|
|
|
|
|
Net::DRI::Util::check_isa($dfr,'DateTime'); |
256
|
0
|
|
|
|
|
|
$dfr = $dfr->set_time_zone('CET')->strftime('%Y-%m-%d'); |
257
|
|
|
|
|
|
|
} |
258
|
0
|
0
|
|
|
|
|
if (defined($ddate)) { |
259
|
0
|
0
|
|
|
|
|
if (ref($ddate)) { |
260
|
0
|
|
|
|
|
|
Net::DRI::Util::check_isa($ddate,'DateTime'); |
261
|
0
|
|
|
|
|
|
$ddate = $ddate->set_time_zone('CET')->strftime('%Y-%m-%d'); |
262
|
|
|
|
|
|
|
} |
263
|
0
|
0
|
|
|
|
|
$dfd = $ddate if !$dfd; |
264
|
0
|
0
|
|
|
|
|
$dfr = $ddate if !$dfr; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
my $r; |
268
|
0
|
0
|
0
|
|
|
|
if ( $dfd || $dfr ) { |
269
|
0
|
|
|
|
|
|
my $eid = build_command_extension( $mes, $epp, 'no-ext-domain:delete', '1.1' ); |
270
|
0
|
|
|
|
|
|
my @e; |
271
|
0
|
0
|
0
|
|
|
|
push @e, [ 'no-ext-domain:deleteFromDNS', $dfd ] if ( defined($dfd) && $dfd ); |
272
|
0
|
0
|
0
|
|
|
|
push @e, [ 'no-ext-domain:deleteFromRegistry', $dfr ] if ( defined($dfr) && $dfr ); |
273
|
|
|
|
|
|
|
|
274
|
0
|
0
|
|
|
|
|
$r = $mes->command_extension( $eid, \@e ) if (@e); |
275
|
|
|
|
|
|
|
} |
276
|
0
|
0
|
|
|
|
|
if ($fs) { |
277
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
278
|
|
|
|
|
|
|
} |
279
|
0
|
|
|
|
|
|
return $r; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub transfer_request { |
285
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $rd ) = @_; |
286
|
0
|
|
|
|
|
|
my $mes = $epp->message(); |
287
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
|
my $mp = $rd->{mobilephone}; |
289
|
0
|
|
|
|
|
|
my $em = $rd->{email}; |
290
|
0
|
|
|
|
|
|
my $fs = $rd->{facets}; |
291
|
|
|
|
|
|
|
|
292
|
0
|
0
|
0
|
|
|
|
return unless ( ( defined($mp) || defined($em) || defined($fs) ) && ( $mp || $em || $fs) ); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
my $r; |
295
|
0
|
0
|
0
|
|
|
|
if ($mp || $em) { |
296
|
0
|
|
|
|
|
|
my $eid = build_command_extension( $mes, $epp, 'no-ext-domain:transfer', '1.1' ); |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
my @d; |
299
|
0
|
0
|
0
|
|
|
|
push @d, |
300
|
|
|
|
|
|
|
Net::DRI::Protocol::EPP::Util::build_tel( |
301
|
|
|
|
|
|
|
'no-ext-domain:mobilePhone', $mp ) |
302
|
|
|
|
|
|
|
if ( defined($mp) && $mp ); |
303
|
0
|
0
|
0
|
|
|
|
push @d, [ 'no-ext-domain:email', $em ] if ( defined($em) && $em ); |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
my @e; |
306
|
0
|
|
|
|
|
|
push @e, [ 'no-ext-domain:notify', @d ]; |
307
|
0
|
|
|
|
|
|
$r = $mes->command_extension( $eid, \@e ); |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
} |
310
|
0
|
0
|
|
|
|
|
if ($fs) { |
311
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
return $r; |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub withdraw { |
320
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $rd ) = @_; |
321
|
0
|
|
|
|
|
|
my $mes = $epp->message(); |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
my $transaction; |
324
|
0
|
0
|
|
|
|
|
$transaction = $rd->{transactionname} if $rd->{transactionname}; |
325
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
my $fs = $rd->{facets}; |
327
|
|
|
|
|
|
|
|
328
|
0
|
0
|
0
|
|
|
|
return unless ( $transaction && $transaction eq 'withdraw'); |
329
|
|
|
|
|
|
|
|
330
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters( |
331
|
|
|
|
|
|
|
'Witdraw command requires a domain name') |
332
|
|
|
|
|
|
|
unless ( defined($domain) && $domain ); |
333
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
my $r; |
335
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
my (undef,$NS,$NSX)=$mes->nsattrs('no_domain_1_1'); |
337
|
0
|
|
|
|
|
|
my (undef,$ExtNS,$ExtNSX)=$mes->nsattrs('no_epp'); |
338
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
my $eid = $mes->command_extension_register( 'command', |
340
|
|
|
|
|
|
|
'xmlns="' |
341
|
|
|
|
|
|
|
. $ExtNS |
342
|
|
|
|
|
|
|
. '" xsi:schemaLocation="' |
343
|
|
|
|
|
|
|
. $ExtNS |
344
|
|
|
|
|
|
|
. " $ExtNSX" |
345
|
|
|
|
|
|
|
. '"' ); |
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
my $cltrid=$mes->cltrid(); |
348
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
my %domns; |
350
|
0
|
|
|
|
|
|
$domns{'xmlns:domain'} = $NS; |
351
|
0
|
|
|
|
|
|
$domns{'xsi:schemaLocation'} = $NS . " $NSX"; |
352
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
$r=$mes->command_extension( |
354
|
|
|
|
|
|
|
$eid, |
355
|
|
|
|
|
|
|
[ [ 'withdraw', |
356
|
|
|
|
|
|
|
[ 'domain:withdraw', [ 'domain:name', $domain ], |
357
|
|
|
|
|
|
|
\%domns, \%domns |
358
|
|
|
|
|
|
|
] |
359
|
|
|
|
|
|
|
], |
360
|
|
|
|
|
|
|
[ 'clTRID', $cltrid ] |
361
|
|
|
|
|
|
|
] |
362
|
|
|
|
|
|
|
); |
363
|
|
|
|
|
|
|
|
364
|
0
|
0
|
0
|
|
|
|
if ( defined($fs) && $fs ) { |
365
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
0
|
|
|
|
|
|
return $r; |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub transfer_execute { |
373
|
0
|
|
|
0
|
0
|
|
my ( $epp, $domain, $rd ) = @_; |
374
|
0
|
|
|
|
|
|
my $mes = $epp->message(); |
375
|
|
|
|
|
|
|
|
376
|
0
|
|
|
|
|
|
my $transaction; |
377
|
0
|
0
|
|
|
|
|
$transaction = $rd->{transactionname} if $rd->{transactionname}; |
378
|
|
|
|
|
|
|
|
379
|
0
|
0
|
0
|
|
|
|
return unless ( $transaction && $transaction eq 'transfer_execute' ); |
380
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
|
my (undef,$NS,$NSX)=$mes->nsattrs('no_domain_1_1'); |
382
|
0
|
|
|
|
|
|
my (undef,$ExtNS,$ExtNSX)=$mes->nsattrs('no_epp'); |
383
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
|
my ( $auth, $du, $token, $fs ); |
385
|
0
|
0
|
|
|
|
|
$auth = $rd->{auth} if Net::DRI::Util::has_key($rd,'auth'); |
386
|
0
|
0
|
|
|
|
|
$du = $rd->{duration} if Net::DRI::Util::has_key($rd,'duration'); |
387
|
0
|
0
|
|
|
|
|
$token = $rd->{token} if Net::DRI::Util::has_key($rd,'token'); |
388
|
0
|
0
|
|
|
|
|
$fs = $rd->{facets} if Net::DRI::Util::has_key($rd,'facets'); |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
# Duration is optional |
391
|
0
|
|
|
|
|
|
my $dur; |
392
|
0
|
0
|
0
|
|
|
|
if ( defined($du) |
|
|
|
0
|
|
|
|
|
393
|
|
|
|
|
|
|
&& $du |
394
|
|
|
|
|
|
|
&& Net::DRI::Util::has_duration( $rd ) |
395
|
|
|
|
|
|
|
) |
396
|
|
|
|
|
|
|
{ |
397
|
0
|
|
|
|
|
|
Net::DRI::Util::check_isa( $du, 'DateTime::Duration' ); |
398
|
|
|
|
|
|
|
|
399
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die( 0, 'DRD::NO', 3, 'Invalid duration' ) |
400
|
|
|
|
|
|
|
if Net::DRI::DRD::NORID->verify_duration_renew(undef, $du, $domain ); ## TODO: this test should be done in Net::DRI::DRD::NORID directly ! |
401
|
0
|
|
|
|
|
|
$dur = Net::DRI::Protocol::EPP::Util::build_period($du); |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
0
|
|
|
|
|
|
my $eid = $mes->command_extension_register( 'command', |
405
|
|
|
|
|
|
|
'xmlns="' |
406
|
|
|
|
|
|
|
. $ExtNS |
407
|
|
|
|
|
|
|
. '" xsi:schemaLocation="' |
408
|
|
|
|
|
|
|
. $ExtNS |
409
|
|
|
|
|
|
|
. " $ExtNSX" |
410
|
|
|
|
|
|
|
. '"' ); |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
my $cltrid=$mes->cltrid(); |
414
|
|
|
|
|
|
|
|
415
|
0
|
|
|
|
|
|
my %domns; |
416
|
0
|
|
|
|
|
|
$domns{'xmlns:domain'} = 'urn:ietf:params:xml:ns:domain-1.0'; |
417
|
0
|
|
|
|
|
|
$domns{'xsi:schemaLocation'} |
418
|
|
|
|
|
|
|
= 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd'; |
419
|
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
|
my %domns2; |
421
|
0
|
|
|
|
|
|
$domns2{'xmlns:no-ext-domain'} = $NS; |
422
|
0
|
|
|
|
|
|
$domns2{'xsi:schemaLocation'} = $NS . " $NSX"; |
423
|
|
|
|
|
|
|
|
424
|
0
|
|
|
|
|
|
my $r; |
425
|
|
|
|
|
|
|
|
426
|
0
|
0
|
0
|
|
|
|
if ( Net::DRI::Util::has_auth( $rd ) |
|
|
0
|
|
|
|
|
|
427
|
|
|
|
|
|
|
&& ( ref( $rd->{auth} ) eq 'HASH' ) ) |
428
|
|
|
|
|
|
|
{ |
429
|
|
|
|
|
|
|
$r=$mes->command_extension( |
430
|
|
|
|
|
|
|
$eid, |
431
|
|
|
|
|
|
|
[ [ 'transfer', |
432
|
|
|
|
|
|
|
{ 'op' => 'execute' }, |
433
|
|
|
|
|
|
|
[ 'domain:transfer', |
434
|
|
|
|
|
|
|
\%domns, |
435
|
|
|
|
|
|
|
[ 'domain:name', $domain ], |
436
|
|
|
|
|
|
|
$dur, |
437
|
|
|
|
|
|
|
Net::DRI::Protocol::EPP::Util::domain_build_authinfo( |
438
|
|
|
|
|
|
|
$epp, $rd->{auth} |
439
|
0
|
|
|
|
|
|
), |
440
|
|
|
|
|
|
|
], |
441
|
|
|
|
|
|
|
], |
442
|
|
|
|
|
|
|
[ 'clTRID', $cltrid ] |
443
|
|
|
|
|
|
|
] |
444
|
|
|
|
|
|
|
); |
445
|
|
|
|
|
|
|
} elsif ($token) { |
446
|
0
|
|
|
|
|
|
$r=$mes->command_extension( |
447
|
|
|
|
|
|
|
$eid, |
448
|
|
|
|
|
|
|
[ [ 'transfer', |
449
|
|
|
|
|
|
|
{ 'op' => 'execute' }, |
450
|
|
|
|
|
|
|
[ 'domain:transfer', \%domns, |
451
|
|
|
|
|
|
|
[ 'domain:name', $domain ], $dur, |
452
|
|
|
|
|
|
|
], |
453
|
|
|
|
|
|
|
], |
454
|
|
|
|
|
|
|
[ 'extension', |
455
|
|
|
|
|
|
|
[ 'no-ext-domain:transfer', \%domns2, |
456
|
|
|
|
|
|
|
[ 'no-ext-domain:token', $token ] |
457
|
|
|
|
|
|
|
] |
458
|
|
|
|
|
|
|
], |
459
|
|
|
|
|
|
|
[ 'clTRID', $cltrid ] |
460
|
|
|
|
|
|
|
] |
461
|
|
|
|
|
|
|
); |
462
|
|
|
|
|
|
|
} else { |
463
|
0
|
|
|
|
|
|
$r=$mes->command_extension( |
464
|
|
|
|
|
|
|
$eid, |
465
|
|
|
|
|
|
|
[ [ 'transfer', |
466
|
|
|
|
|
|
|
{ 'op' => 'execute' }, |
467
|
|
|
|
|
|
|
[ 'domain:transfer', \%domns, |
468
|
|
|
|
|
|
|
[ 'domain:name', $domain ], $dur, |
469
|
|
|
|
|
|
|
], |
470
|
|
|
|
|
|
|
], |
471
|
|
|
|
|
|
|
[ 'clTRID', $cltrid ] |
472
|
|
|
|
|
|
|
] |
473
|
|
|
|
|
|
|
); |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
|
476
|
0
|
0
|
0
|
|
|
|
if ( defined($fs) && $fs ) { |
477
|
0
|
|
|
|
|
|
$r = facet($epp, $domain, $rd); |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
0
|
|
|
|
|
|
return $r; |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
#################################################################################################### |
485
|
|
|
|
|
|
|
1; |