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 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 61     61   1150 use utf8;
  61         98  
  61         474  
18 61     61   1752 use strict;
  61         96  
  61         1679  
19 61     61   263 use warnings;
  61         81  
  61         1595  
20              
21 61     61   623 use Net::DRI::Util;
  61         84  
  61         42217  
22              
23             ## See http://www.icann.org/en/resources/registries/rsep for changes (done until 2014094)
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/; ## 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 37 my ($domain,$op)=@_;
32              
33 19 100 66     116 return '' if (defined $op && $op ne 'create');
34              
35 12         51 my @d=split(/\./,lc($domain));
36              
37             ## Tests at all levels
38 12         20 foreach my $d (@d)
39             {
40             ## §A (ICANN+IANA reserved)
41 21 100       90 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     70 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       22 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     35 return 'NAME_RESERVED_PER_ICANN_RULE_B1' if (length($d[-2])==1 && ! exists($ALLOW1{$d[-1]}));
60              
61             ## §B.2
62 7 100 66     25 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       22 return 'NAME_RESERVED_PER_ICANN_RULE_D' if ($d[-2]=~m/^(?:nic|whois|www)$/o);
66              
67             ## .NAME specific rules
68 5 50       13 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         21 return '';
74             }
75              
76             ####################################################################################################
77             1;
78              
79             __END__