File Coverage

blib/lib/Net/DRI/DRD/ICANN.pm
Criterion Covered Total %
statement 24 28 85.7
branch 14 24 58.3
condition 11 24 45.8
subroutine 5 5 100.0
pod 1 1 100.0
total 55 82 67.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, ICANN policy on reserved names
2             ##
3             ## Copyright (c) 2005-2012,2015-2016 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::DRD::ICANN;
16              
17 70     70   1610 use utf8;
  70         90  
  70         474  
18 70     70   1719 use strict;
  70         84  
  70         1074  
19 70     70   213 use warnings;
  70         82  
  70         1331  
20              
21 70     70   553 use Net::DRI::Util;
  70         145  
  70         37102  
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             our %ALLOW1=map { $_ => 1 } qw/mobi coop biz pro cat info travel tel asia org/; ## Pending ICANN review: (none)
26             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 19     19 1 32 my ($domain,$op)=@_;
32              
33 19 100 66     104 return '' if (defined $op && $op ne 'create');
34              
35 12         35 my @d=split(/\./,lc($domain));
36              
37             ## Tests at all levels
38 12         17 foreach my $d (@d)
39             {
40             ## §A (ICANN+IANA reserved)
41 21 100       63 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);
42              
43             ## §C (tagged domain names)
44 19 100 100     62 return 'NAME_RESERVED_PER_ICANN_RULE_C' if (length($d)>3 && (substr($d,2,2) eq '--') && ($d!~/^xn--/));
      66        
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 9 50       17 if ($d[-1] eq 'tel')
52             {
53 0 0       0 return 'NAME_RESERVED_PER_ICANN_RULE_TEL_1CHAR' if length $d[-2]==1;
54 0 0 0     0 return 'NAME_RESERVED_PER_ICANN_RULE_TEL_2CHARS_CC' if length $d[-2]==2 && exists $Net::DRI::Util::CCA2{$d[-2]};
55 0 0 0     0 return 'NAME_RESERVED_PER_ICANN_RULE_TEL_DIGITS_HYPHENS' if $d[-2]=~m/^[\d-]+$/ && length $d[-2] > 7;
56             }
57              
58             ## §B.1 (additional second level)
59 9 100 66     38 return 'NAME_RESERVED_PER_ICANN_RULE_B1' if (length($d[-2])==1 && ! exists($ALLOW1{$d[-1]}));
60              
61             ## §B.2
62 7 100 66     20 return 'NAME_RESERVED_PER_ICANN_RULE_B2' if (length($d[-2])==2 && ! exists($ALLOW2{$d[-1]}));
63              
64             ## §D (reserved for Registry operations)
65 6 100       20 return 'NAME_RESERVED_PER_ICANN_RULE_D' if ($d[-2]=~m/^(?:nic|whois|www)$/o);
66              
67             ## .NAME specific rules
68 5 50       10 if ($d[-1] eq 'name')
69             {
70 0 0 0     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)$/);
71             }
72              
73 5         16 return '';
74             }
75              
76             ####################################################################################################
77             1;
78              
79             __END__