line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, VeriSign EPP WhoWas Extension |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010,2012,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::VeriSign::WhoWas; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
754
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
494
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return { 'domain' => { 'whowas' => [ \&whowas_info, \&whowas_parse ] } }; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub setup |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
35
|
0
|
|
|
|
|
|
$po->ns({ 'whowas' => [ 'http://www.verisign.com/epp/whowas-1.0','whowas-1.0.xsd' ] }); |
36
|
0
|
|
|
|
|
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#################################################################################################### |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub whowas_info |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined $domain && length $domain; |
46
|
0
|
|
|
|
|
|
my $isroid=0; |
47
|
0
|
0
|
|
|
|
|
if (index($domain,'.') > -1) |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain); |
50
|
|
|
|
|
|
|
} else |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid ROID value: '.$domain) unless Net::DRI::Util::is_roid($domain); |
53
|
0
|
|
|
|
|
|
$isroid=1; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
56
|
0
|
|
|
|
|
|
$mes->command(['info','whowas:info',sprintf('xmlns:whowas="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('whowas'))]); |
57
|
0
|
0
|
|
|
|
|
$mes->command_body([['whowas:type','domain'],[$isroid ? 'whowas:roid' : 'whowas:name',$domain]]); |
58
|
0
|
|
|
|
|
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub whowas_parse |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
64
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
65
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
66
|
0
|
|
|
|
|
|
my $infdata=$mes->get_response('whowas','infData'); |
67
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my %r=(action => 'whowas', name => undef, type => undef, history => []); |
70
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
|
|
|
my ($name,$c)=@$el; |
73
|
0
|
0
|
|
|
|
|
if ($name eq 'type') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
|
|
|
$r{type}=$c->textContent(); |
76
|
|
|
|
|
|
|
} elsif ($name eq 'name') |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
|
|
|
$r{name}=$c->textContent(); |
79
|
|
|
|
|
|
|
} elsif ($name eq 'history') |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
|
|
|
foreach my $subel (Net::DRI::Util::xml_list_children($c)) |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
my ($subname,$subnode)=@$subel; |
84
|
0
|
0
|
|
|
|
|
next unless $subname eq 'rec'; |
85
|
0
|
|
|
|
|
|
my %rec; |
86
|
0
|
|
|
|
|
|
foreach my $rec (Net::DRI::Util::xml_list_children($subnode)) |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
|
|
|
my ($recname,$recnode)=@$rec; |
89
|
0
|
0
|
|
|
|
|
if ($recname=~m/^(?:name|newName|roid|op|clID|clName)$/) |
|
|
0
|
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
|
|
|
$rec{$recname}=$recnode->textContent(); |
92
|
|
|
|
|
|
|
} elsif ($recname eq 'date') |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
|
|
|
$rec{$recname}=$po->parse_iso8601($recnode->textContent()); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
|
push @{$r{history}},\%rec; |
|
0
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $name=$r{name}; |
103
|
0
|
|
|
|
|
|
delete $r{name}; |
104
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$name}=\%r; |
105
|
0
|
|
|
|
|
|
return; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
######################################################################################################### |
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |