Split nic_handles_list off tld_serv_list

To be able to use in_domain() for tld_serv_list
This commit is contained in:
Marco d'Itri 2014-10-15 15:07:23 +02:00
parent 842e142f1a
commit 29b1a3a9c3
7 changed files with 54 additions and 35 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*_del.h
new_gtlds.h
nic_handles.h
tld_serv.h
servers_charset.h
version.h

View File

@ -87,6 +87,9 @@ ip6_del.h: ip6_del_list make_ip6_del.pl
new_gtlds.h: new_gtlds_list make_new_gtlds.pl
$(PERL) make_new_gtlds.pl < $< > $@
nic_handles.h: nic_handles_list make_nic_handles.pl
$(PERL) make_nic_handles.pl < $< > $@
tld_serv.h: tld_serv_list make_tld_serv.pl
$(PERL) make_tld_serv.pl < $< > $@

5
data.h
View File

@ -159,6 +159,11 @@ const char *tld_serv[] = {
NULL, NULL
};
const char *nic_handles_post[] = {
#include "nic_handles.h"
NULL, NULL
};
#ifdef HAVE_ICONV
struct server_charset {
const char *name;

17
make_nic_handles.pl Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
use warnings;
use strict;
while (<>) {
chomp;
s/#.*$//;
s/^\s+//; s/\s+$//;
next if /^$/;
die "format error: $_" if not
(my ($a, $b) = /^(-\w+)\s+([\w\d\.:-]+)$/);
print qq| "$a",\t"$b",\n|;
}

22
nic_handles_list Normal file
View File

@ -0,0 +1,22 @@
-arin whois.arin.net
-ripe whois.ripe.net
-mnt whois.ripe.net
-lacnic whois.lacnic.net
-afrinic whois.afrinic.net
-ap whois.apnic.net
-cznic whois.nic.cz
-dk whois.dk-hostmaster.dk
-il whois.isoc.org.il
-is whois.isnic.is
-kg whois.domain.kg
-coop whois.nic.coop
-frnic whois.nic.fr
-lrms whois.afilias.info
-metu whois.nic.tr
-nicat whois.nic.at
-nicci whois.nic.ci
-irnic whois.nic.ir
-norid whois.norid.no
-tel whois.nic.tel
-adnic whois.nic.org.uy
-sixxs whois.sixxs.net

View File

@ -385,38 +385,3 @@
.xn--xkc2dl3a5ee0h whois.inregistry.net # India, Tamil AW
.xn--yfro4i67o whois.sgnic.sg # Singapore, Chinese
.xn--ygbi2ammx whois.pnina.ps # Palestinian Territory
-dom whois.networksolutions.com
-org whois.networksolutions.com
-hst whois.networksolutions.com
-arin whois.arin.net
-ripe whois.ripe.net
-mnt whois.ripe.net
-lacnic whois.lacnic.net
-afrinic whois.afrinic.net
-ap whois.apnic.net
-cn whois.cnnic.cn
-cz whois.nic.cz
-dk whois.dk-hostmaster.dk
-il whois.isoc.org.il
-is whois.isnic.is
-kg whois.domain.kg
-ti whois.telstra.net
-tw whois.twnic.net.tw
-coop whois.nic.coop
-frnic whois.nic.fr
-gandi whois.gandi.net
-kenic whois.kenic.or.ke
-lrms whois.afilias.info
-metu whois.nic.tr
-nicat whois.nic.at
-nicci whois.nic.ci
-nicir whois.nic.ir
-norid whois.norid.no
-rotld whois.rotld.ro
-sgnic whois.sgnic.sg
-tel whois.nic.tel
-uanic whois.ua
-cunic whois.cunic.ua
-uynic whois.nic.org.uy
-sixxs whois.sixxs.net

View File

@ -541,6 +541,12 @@ char *guess_server(const char *s)
for (i = 0; nic_handles[i]; i += 2)
if (strncaseeq(s, nic_handles[i], strlen(nic_handles[i])))
return strdup(nic_handles[i + 1]);
/* search for strings at the end of the word */
for (i = 0; nic_handles_post[i]; i += 2)
if (domcmp(s, nic_handles_post[i]))
return strdup(nic_handles_post[i + 1]);
/* it's probably a network name */
return strdup("");
}