line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, RRP Connection handling |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2005,2007-2010 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::RRP::Connection; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
1205
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
18
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
41
|
|
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
326
|
use Net::DRI::Protocol::RRP::Message; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
11
|
|
21
|
2
|
|
|
2
|
|
51
|
use Net::DRI::Protocol::ResultStatus; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
22
|
2
|
|
|
2
|
|
350
|
use Net::DRI::Data::Raw; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
23
|
2
|
|
|
2
|
|
39
|
use Net::DRI::Util; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1329
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Net::DRI::Protocol::RRP::Connection - RRP Connection handling for Net::DRI |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Please see the README file for details. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SUPPORT |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
For now, support questions should be sent to: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SEE ALSO |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AUTHOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 COPYRIGHT |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Copyright (c) 2005,2007-2010 Patrick Mevzek . |
54
|
|
|
|
|
|
|
All rights reserved. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
57
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
58
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
59
|
|
|
|
|
|
|
(at your option) any later version. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#################################################################################################### |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub login |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
my ($class,$cm,$id,$pass,$cltrid,$dr,$newpass)=@_; |
70
|
0
|
|
|
|
|
|
my %h=(Id => $id, Password => $pass); |
71
|
0
|
0
|
0
|
|
|
|
$h{NewPassword}=$newpass if (defined($newpass) && $newpass); |
72
|
0
|
|
|
|
|
|
my $mes=Net::DRI::Protocol::RRP::Message->new({ command => 'session', options => \%h}); |
73
|
0
|
|
|
|
|
|
return $mes; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub logout |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
0
|
|
my ($class,$cm,$cltrid)=@_; |
79
|
0
|
|
|
|
|
|
my $mes=Net::DRI::Protocol::RRP::Message->new({ command => 'quit' }); |
80
|
0
|
|
|
|
|
|
return $mes; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub keepalive |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
0
|
0
|
|
my ($class,$cm,$cltrid)=@_; |
86
|
0
|
|
|
|
|
|
my $mes=Net::DRI::Protocol::RRP::Message->new({ command => 'describe' }); |
87
|
0
|
|
|
|
|
|
return $mes; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#################################################################################################### |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub read_data |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
0
|
|
my ($class,$to,$sock)=@_; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my (@l); |
97
|
0
|
|
|
|
|
|
while(my $l=$sock->getline()) |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
|
|
|
push @l,$l; |
100
|
0
|
0
|
|
|
|
|
last if ($l=~m/^\.\s*\n?$/); |
101
|
|
|
|
|
|
|
} |
102
|
0
|
|
|
|
|
|
@l=map { Net::DRI::Util::decode_ascii($_); } @l; |
|
0
|
|
|
|
|
|
|
103
|
0
|
0
|
0
|
|
|
|
die(Net::DRI::Protocol::ResultStatus->new_error('COMMAND_FAILED_CLOSING',@l? $l[0] : '','en')) unless (@l && $l[-1]=~m/^\.\s*\n?$/); |
|
|
0
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return Net::DRI::Data::Raw->new_from_array(\@l); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub write_message |
108
|
|
|
|
|
|
|
{ |
109
|
0
|
|
|
0
|
0
|
|
my ($self,$to,$msg)=@_; |
110
|
0
|
|
|
|
|
|
return Net::DRI::Util::encode_ascii($msg); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub parse_greeting |
114
|
|
|
|
|
|
|
{ |
115
|
0
|
|
|
0
|
0
|
|
my ($class,$dc)=@_; |
116
|
0
|
|
|
|
|
|
my ($code,$msg)=find_code($dc); |
117
|
0
|
0
|
0
|
|
|
|
unless (defined($code) && ($code==0)) |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
0
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_error('COMMAND_SYNTAX_ERROR',($msg || '?').' ('.($code || '?').')','en'); |
|
|
|
0
|
|
|
|
|
120
|
|
|
|
|
|
|
} else |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
|
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_success('COMMAND_SUCCESSFUL','Greeting OK','en'); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub parse_login |
127
|
|
|
|
|
|
|
{ |
128
|
0
|
|
|
0
|
0
|
|
my ($class,$dc)=@_; |
129
|
0
|
|
|
|
|
|
my ($code,$msg)=find_code($dc); |
130
|
0
|
0
|
0
|
|
|
|
unless (defined($code) && ($code==200)) |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
0
|
|
|
|
|
my $eppcode=(defined($code))? Net::DRI::Protocol::RRP::Message::_eppcode($code) : 'COMMAND_SYNTAX_ERROR'; |
133
|
0
|
|
0
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_error($eppcode,($msg || 'Login failed').' ('.($code || '?').')','en'); |
|
|
|
0
|
|
|
|
|
134
|
|
|
|
|
|
|
} else |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
0
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_success('COMMAND_SUCCESSFUL',$msg || 'Login OK','en'); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub parse_logout |
141
|
|
|
|
|
|
|
{ |
142
|
0
|
|
|
0
|
0
|
|
my ($class,$dc)=@_; |
143
|
0
|
|
|
|
|
|
my ($code,$msg)=find_code($dc); |
144
|
0
|
0
|
0
|
|
|
|
unless (defined($code) && ($code==220)) |
145
|
|
|
|
|
|
|
{ |
146
|
0
|
0
|
|
|
|
|
my $eppcode=(defined($code))? Net::DRI::Protocol::RRP::Message::_eppcode($code) : 'COMMAND_SYNTAX_ERROR'; |
147
|
0
|
|
0
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_error($eppcode,($msg || 'Logout failed').' ('.($code || '?').')','en'); |
|
|
|
0
|
|
|
|
|
148
|
|
|
|
|
|
|
} else |
149
|
|
|
|
|
|
|
{ |
150
|
0
|
|
0
|
|
|
|
return Net::DRI::Protocol::ResultStatus->new_success('COMMAND_SUCCESSFUL_END',$msg || 'Logout OK','en'); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub find_code |
155
|
|
|
|
|
|
|
{ |
156
|
0
|
|
|
0
|
0
|
|
my $dc=shift; |
157
|
0
|
|
|
|
|
|
my @a=$dc->as_array(); |
158
|
0
|
0
|
|
|
|
|
return (0,'LOGIN') if ($a[0]=~m/^.+ RRP Server version/); ## initial login |
159
|
0
|
0
|
|
|
|
|
return () unless $#a>0; ## at least 2 lines |
160
|
0
|
0
|
|
|
|
|
return () unless $a[-1]=~m/^\.\s*\n?$/; |
161
|
0
|
0
|
|
|
|
|
return () unless $a[0]=~m/^(\d+) (\S.+)$/; |
162
|
0
|
|
|
|
|
|
return (0+$1,$2); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub transport_default |
166
|
|
|
|
|
|
|
{ |
167
|
0
|
|
|
0
|
0
|
|
my ($self,$tname)=@_; |
168
|
0
|
|
|
|
|
|
return (defer => 0, socktype => 'ssl', ssl_version => 'TLSv1', remote_port => 648); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
#################################################################################################### |
172
|
|
|
|
|
|
|
1; |