line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Handling of contact data for .DE |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2007,2008,2013 Tonnerre Lombard . 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::Data::Contact::DENIC; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
858
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use base qw/Net::DRI::Data::Contact/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
69
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
22
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
23
|
1
|
|
|
1
|
|
6
|
use Email::Valid; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
551
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->register_attributes(qw(type sip remarks)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Net::DRI::Data::Contact::DENIC - Handle .DE contact data for Net::DRI |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This subclass of Net::DRI::Data::Contact adds accessors and validation for |
36
|
|
|
|
|
|
|
.DE specific data. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The following accessors/mutators can be called in chain, as they all return the object itself. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 type() |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The type of the contact (Person, Organization, whatever). |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 sip() |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The SIP telephone number of the contact. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 remarks() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Remarks regarding the contact. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SUPPORT |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
For now, support questions should be sent to: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Etonnerre.lombard@sygroup.chE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SEE ALSO |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
http://oss.bsdprojects.net/projects/netdri/ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Tonnerre Lombard Etonnerre.lombard@sygroup.chE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright (c) 2007,2008,2013 Tonnerre Lombard . |
73
|
|
|
|
|
|
|
All rights reserved. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
76
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
77
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
78
|
|
|
|
|
|
|
(at your option) any later version. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#################################################################################################### |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub validate ## See DENIC-11 |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
0
|
0
|
|
my ($self, $change) = @_; |
89
|
0
|
|
0
|
|
|
|
$change ||= 0; |
90
|
0
|
|
|
|
|
|
my @errs; |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
if (!$change) |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: name/city/cc/srid mandatory') |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
95
|
|
|
|
|
|
|
unless (scalar($self->name()) && scalar($self->city()) |
96
|
|
|
|
|
|
|
&& scalar($self->cc()) && $self->srid()); |
97
|
0
|
0
|
|
|
|
|
push @errs,'srid' |
98
|
|
|
|
|
|
|
unless Net::DRI::Util::xml_is_token($self->srid(), |
99
|
|
|
|
|
|
|
3, 32); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
## TODO: convert that to a test on srid(), testing roid() is useless |
103
|
|
|
|
|
|
|
## \w includes _ in Perl |
104
|
0
|
0
|
0
|
|
|
|
push(@errs,'roid') if ($self->roid() && |
105
|
|
|
|
|
|
|
$self->roid() !~ m/^\w{1,80}-\w{1,8}$/); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
push(@errs,'name') if ($self->name() && |
108
|
0
|
0
|
0
|
|
|
|
grep { !Net::DRI::Util::xml_is_normalizedstring($_,1,255) } |
|
0
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
($self->name())); |
110
|
|
|
|
|
|
|
push(@errs,'org') if ($self->org() && |
111
|
0
|
0
|
0
|
|
|
|
grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } |
|
0
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
($self->org())); |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my @rs = ($self->street()); |
115
|
0
|
|
|
|
|
|
foreach my $i (0,1) |
116
|
|
|
|
|
|
|
{ |
117
|
0
|
0
|
|
|
|
|
next unless $rs[$i]; |
118
|
|
|
|
|
|
|
push(@errs,'street') if ((ref($rs[$i]) ne 'ARRAY') || |
119
|
0
|
|
|
|
|
|
(@{$rs[$i]} > 3) || |
120
|
0
|
|
|
|
|
|
(grep { !Net::DRI::Util::xml_is_normalizedstring($_, |
121
|
0
|
0
|
0
|
|
|
|
undef,255) } @{$rs[$i]})); |
|
0
|
|
0
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
push(@errs,'city') if ($self->city() && |
125
|
0
|
0
|
0
|
|
|
|
grep { !Net::DRI::Util::xml_is_normalizedstring($_,1,255) } |
|
0
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
($self->city())); |
127
|
|
|
|
|
|
|
push(@errs,'pc') if ($self->pc() && |
128
|
0
|
0
|
0
|
|
|
|
grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,16) } |
|
0
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
($self->pc())); |
130
|
|
|
|
|
|
|
push(@errs,'cc') if ($self->cc() && |
131
|
0
|
0
|
0
|
|
|
|
grep { !Net::DRI::Util::xml_is_normalizedstring($_,2,2) } |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
($self->cc())); |
133
|
|
|
|
|
|
|
push(@errs,'cc') if ($self->cc() && |
134
|
0
|
0
|
0
|
|
|
|
grep { !exists($Net::DRI::Util::CCA2{uc($_)}) } ($self->cc())); |
|
0
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
0
|
|
|
|
push(@errs,'voice') if ($self->voice() && |
|
|
|
0
|
|
|
|
|
137
|
|
|
|
|
|
|
!Net::DRI::Util::xml_is_token($self->voice(),undef,17) && |
138
|
|
|
|
|
|
|
$self->voice() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/); |
139
|
0
|
0
|
0
|
|
|
|
push(@errs,'fax') if ($self->fax() && |
|
|
|
0
|
|
|
|
|
140
|
|
|
|
|
|
|
!Net::DRI::Util::xml_is_token($self->fax(),undef,17) && |
141
|
|
|
|
|
|
|
$self->fax() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/); |
142
|
0
|
0
|
0
|
|
|
|
push(@errs,'email') if ($self->email() && |
|
|
|
0
|
|
|
|
|
143
|
|
|
|
|
|
|
!Net::DRI::Util::xml_is_token($self->email(),1,undef) && |
144
|
|
|
|
|
|
|
!Email::Valid->rfc822($self->email())); |
145
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: ' . |
147
|
|
|
|
|
|
|
join('/', @errs)) if (@errs); |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return 1; ## everything ok. |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
#################################################################################################### |
153
|
|
|
|
|
|
|
1; |