DRI/DRD/ICANN.pm

filter: Statementstmt 87.8% 29 / 33 Branchbran 58.3% 14 / 24 Conditioncond 45.8% 11 / 24 MC/DCmcdc 33.3% 5 / 15 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 63.7% 65 / 102 CC 22 SCAR 39.0
CC
22
Cov
67%
is_reserved_name
58.3
BEGIN
1.0
BEGIN
1.0
CRAP 49.5
« DRI/Protocol/EPP/Extensions/CentralNic/Release.pm ↑ Summary DRI/Protocol/EPP/Extensions/CIRA/IDN.pm »
1 ## Domain Registry Interface, ICANN policy on reserved names
2 ##
3 ## Copyright (c) 2005-2012,2015-2016 Patrick Mevzek <netdri@dotandco.com>. 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::DRD::ICANN;
16  
17 80 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 80 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 80 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 80 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 ## See http://www.icann.org/en/resources/registries/rsep for changes (done until 2016011)
24 ## + https://www.icann.org/resources/two-character-labels
25 80 our %ALLOW1=map { $_ => 1 } qw/mobi coop biz pro cat info travel tel asia org/; ## Pending ICANN review: (none)
26 80 our %ALLOW2=map { $_ => 1 } qw/mobi coop name jobs biz pro cat info travel tel asia org globo wiki ceo best kred ventures singles holdings guru clothing bike plumbing camera equipment lighting estate gallery graphics photography contractors land technology construction directory kitchen today voyage tips enterprises diamonds shoes careers photos recipes limo domains cab company computer systems academy management center solutions support email builders training camp glass education repair institute solar coffee florist house international holiday marketing viajes codes farm cheap zone agency bargains boutique cool watch works expert foundation exposed villas flights rentals cruises vacations condos properties maison tienda dating events partners productions community catering cards cleaning tools industries parts supplies supply report vision fish services capital engineering exchange gripe associates lease media pictures reisen toys university town wtf fail financial limited care clinic surgery dental tax cash fund investments furniture discount fitness schule gratis claims credit creditcard digital accountants finance insure place guide church life loans auction direct business network xn--czrs0t xn--unup4y xn--vhquv deals xn--fjq720a city xyz college gop trade webcam bid healthcare world band luxury wang xn--3bSt00M xn--6qQ986B3xL xn--czRu2D xn--45Q11C build ren pizza restaurant gifts sarl sohu xn--55qx5d xn--io0a7i abogado bayern beer budapest casa cooking country fashion fishing garden horse luxe miami nrw rodeo surf vodka wedding work yoga immo saarland club jetzt neustar global kiwi berlin whoswho hamburg delivery energy monash frl mini bmw google globo xxx/; ## Pending ICANN review: (none)
27  
28 ## See http://www.icann.org/en/about/agreements/registries
29 sub is_reserved_name
30 {
31 12 ▶ my ($domain,$op)=@_;
Subroutine is_reserved_name: called CC=22 SCAR=40.7
Pod documented
32  
33 12 ▶ return '' if (defined $op && $op ne 'create');
Branch: 1 branch
BranchTrueFalseTotal
if defined $op and $op ne "create" 1 11 12
Condition66%2/3
defined $op and $op ne "create"
!ll&&!rl&&r
0111
MC/DC50%1/2
defined $op and $op ne "create"
defined $op $op ne "create"
Truth table66%2/3
A and B
A= defined $opB= $op ne "create"
ABresult
0X0
100
111
34  
35 11 my @d=split(/\./,lc($domain));
36  
37 ## Tests at all levels
38 11 foreach my $d (@d)
39 {
40 ## §A (ICANN+IANA reserved)
41 19 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_A' if ($d=~m/^(?:aso|gnso|icann|internic|ccnso|afrinic|apnic|arin|example|gtld-servers|iab|iana|iana-servers|iesg|ietf|irtf|istf|lacnic|latnic|rfc-editor|ripe|root-servers)$/o);
Branch: 1 branch
BranchTrueFalseTotal
if $d =~ /^(?:aso|gnso|icann|internic|ccnso|afrinic|apnic|arin|example|gtld-servers|iab|iana|iana-servers|iesg|ietf|irtf|istf|lacnic|latnic|rfc-editor|ripe|root-servers)$/o 2 17 19
42  
43 ## §C (tagged domain names)
44 17 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_C' if (length($d)>3 && (substr($d,2,2) eq '--') && ($d!~/^xn--/));
Branch: 1 branch
BranchTrueFalseTotal
if length $d > 3 and substr($d, 2, 2) eq "--" and not $d =~ /^xn--/ 1 16 17
Condition83%5/6
length $d > 3 and substr($d, 2, 2) eq "--" and not $d =~ /^xn--/
!ll&&!rl&&r
1601
length $d > 3 and substr($d, 2, 2) eq "--"
!ll&&!rl&&r
1511
MC/DC66%2/3
length $d > 3 and substr($d, 2, 2) eq "--" and not $d =~ /^xn--/
length $d > 3 substr($d, 2, 2) eq "--" not $d =~ /^xn--/
Truth table75%3/4
A and B and not(C)
A= length $d > 3B= substr($d, 2, 2) eq "--"C= not $d =~ /^xn--/
ABCresult
0XX0
10X0
1100
1111
45 }
46  
47 ## .TEL specific rules
48 ## per RSEP #2010012
49 ## and http://telnic.org/downloads/GAShortNumericDomains.pdf (2011-06-13)
50 ## (the latter being quite contradictory with RSEP #201008, hence this block must be here not later)
51 8 ▶ if ($d[-1] eq 'tel')
Branch: 1 branch
BranchTrueFalseTotal
if ($d[-1] eq "tel") 0 8 8
52 {
53 0 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_TEL_1CHAR' if length $d[-2]==1;
Branch: 1 branch
BranchTrueFalseTotal
if length $d[-2] == 1 0 0 0
54 0 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_TEL_2CHARS_CC' if length $d[-2]==2 && exists $Net::DRI::Util::CCA2{$d[-2]};
Branch: 1 branch
BranchTrueFalseTotal
if length $d[-2] == 2 and exists $Net::DRI::Util::CCA2{$d[-2]} 0 0 0
Condition0%0/3
length $d[-2] == 2 and exists $Net::DRI::Util::CCA2{$d[-2]}
!ll&&!rl&&r
000
MC/DC0%0/2
length $d[-2] == 2 and exists $Net::DRI::Util::CCA2{$d[-2]}
length $d[-2] == 2 exists $Net::DRI::Util::CCA2{$d[-2]}
Truth table0%0/3
A and B
A= length $d[-2] == 2B= exists $Net::DRI::Util::CCA2{$d[-2]}
ABresult
0X0
100
111
55 0 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_TEL_DIGITS_HYPHENS' if $d[-2]=~m/^[\d-]+$/ && length $d[-2] > 7;
Branch: 1 branch
BranchTrueFalseTotal
if $d[-2] =~ /^[\d-]+$/ and length $d[-2] > 7 0 0 0
Condition0%0/3
$d[-2] =~ /^[\d-]+$/ and length $d[-2] > 7
!ll&&!rl&&r
000
MC/DC0%0/2
$d[-2] =~ /^[\d-]+$/ and length $d[-2] > 7
$d[-2] =~ /^[\d-]+$/ length $d[-2] > 7
Truth table0%0/3
A and B
A= $d[-2] =~ /^[\d-]+$/B= length $d[-2] > 7
ABresult
0X0
100
111
56 }
57  
58 ## §B.1 (additional second level)
59 8 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_B1' if (length($d[-2])==1 && ! exists($ALLOW1{$d[-1]}));
Branch: 1 branch
BranchTrueFalseTotal
if length $d[-2] == 1 and not exists $Net::DRI::DRD::ICANN::ALLOW1{$d[-1]} 2 6 8
Condition66%2/3
length $d[-2] == 1 and not exists $Net::DRI::DRD::ICANN::ALLOW1{$d[-1]}
!ll&&!rl&&r
602
MC/DC50%1/2
length $d[-2] == 1 and not exists $Net::DRI::DRD::ICANN::ALLOW1{$d[-1]}
length $d[-2] == 1 not exists $Net::DRI::DRD::ICANN::ALLOW1{$d[-1]}
Truth table66%2/3
A and not(B)
A= length $d[-2] == 1B= not exists $Net::DRI::DRD::ICANN::ALLOW1{$d[-1]}
ABresult
0X0
100
111
60  
61 ## §B.2
62 6 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_B2' if (length($d[-2])==2 && ! exists($ALLOW2{$d[-1]}));
Branch: 1 branch
BranchTrueFalseTotal
if length $d[-2] == 2 and not exists $Net::DRI::DRD::ICANN::ALLOW2{$d[-1]} 1 5 6
Condition66%2/3
length $d[-2] == 2 and not exists $Net::DRI::DRD::ICANN::ALLOW2{$d[-1]}
!ll&&!rl&&r
501
MC/DC50%1/2
length $d[-2] == 2 and not exists $Net::DRI::DRD::ICANN::ALLOW2{$d[-1]}
length $d[-2] == 2 not exists $Net::DRI::DRD::ICANN::ALLOW2{$d[-1]}
Truth table66%2/3
A and not(B)
A= length $d[-2] == 2B= not exists $Net::DRI::DRD::ICANN::ALLOW2{$d[-1]}
ABresult
0X0
100
111
63  
64 ## §D (reserved for Registry operations)
65 5 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_D' if ($d[-2]=~m/^(?:nic|whois|www)$/o);
Branch: 1 branch
BranchTrueFalseTotal
if $d[-2] =~ /^(?:nic|whois|www)$/o 1 4 5
66  
67 ## .NAME specific rules
68 4 ▶ if ($d[-1] eq 'name')
Branch: 1 branch
BranchTrueFalseTotal
if ($d[-1] eq "name") 0 4 4
69 {
70 0 ▶ return 'NAME_RESERVED_PER_ICANN_RULE_NAME_J' if (@d==2 && $d[-2]=~m/-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/);
Branch: 1 branch
BranchTrueFalseTotal
if @d == 2 and $d[-2] =~ /-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/ 0 0 0
Condition0%0/3
@d == 2 and $d[-2] =~ /-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/
!ll&&!rl&&r
000
MC/DC0%0/2
@d == 2 and $d[-2] =~ /-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/
@d == 2 $d[-2] =~ /-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/
Truth table0%0/3
A and B
A= @d == 2B= $d[-2] =~ /-(?:familie|family|perhe|famille|parivaar|keluarga|famiglia|angkan|rodzina|familia|mischpoche|umdeni)$/
ABresult
0X0
100
111
71 }
72  
73 4 return '';
74 }
75  
76 ####################################################################################################
77 80 1;
78  
79 __END__
80  
81 =pod
82  
83 =head1 NAME
84  
85 Net::DRI::DRD::ICANN - ICANN policies for Net::DRI
86  
87 =head1 SYNOPSIS
88  
89 This module is never used directly, it is used by other DRD modules
90 for registries that follow ICANN policies on syntax of domain names.
91  
92 More precisely, it is called from subroutine _verify_name_rules in
93 L<Net::DRI::DRD>.
94  
95 =head1 DESCRIPTION
96  
97 This module implements ICANN rules on domain names such as minimum and maximum length,
98 allowed characters, etc...
99  
100 =head1 EXAMPLES
101  
102 None.
103  
104 =head1 SUBROUTINES/METHODS
105  
106 =over
107  
108 =item is_reserved_name()
109  
110 returns a string if the name passed violates some ICANN policy on domain name
111 (the string being the ICANN rule name that was violated),
112 and an empty string otherwise (meaning success).
113  
114 =back
115  
116 =head1 DIAGNOSTICS
117  
118 None.
119  
120 =head1 CONFIGURATION AND ENVIRONMENT
121  
122 None.
123  
124 =head1 DEPENDENCIES
125  
126 This module has to be used inside the Net::DRI framework and does not have any dependency.
127  
128 =head1 INCOMPATIBILITIES
129  
130 None.
131  
132 =head1 BUGS AND LIMITATIONS
133  
134 No known bugs. Please report problems to author (see below) or use CPAN RT system. Patches are welcome.
135  
136 xn--something domain names are currently allowed as a temporary passthrough until L<Net::DRI> gets
137 full IDN support.
138  
139 =head1 SUPPORT
140  
141 For now, support questions should be sent to:
142  
143 E<lt>netdri@dotandco.comE<gt>
144  
145 Please also see the SUPPORT file in the distribution.
146  
147 =head1 SEE ALSO
148  
149 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
150  
151 =head1 AUTHOR
152  
153 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
154  
155 =head1 LICENSE AND COPYRIGHT
156  
157 Copyright (c) 2005-2012,2015-2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
158  
159 This program is free software; you can redistribute it and/or modify
160 it under the terms of the GNU General Public License as published by
161 the Free Software Foundation; either version 2 of the License, or
162 (at your option) any later version.
163  
164 See the LICENSE file that comes with this distribution for more details.
165  
166 =cut
167  
« DRI/Protocol/EPP/Extensions/CentralNic/Release.pm ↑ Summary DRI/Protocol/EPP/Extensions/CIRA/IDN.pm »