Merge branch 'master' into wheezy-backports

This commit is contained in:
Marco d'Itri 2015-01-09 03:50:16 +01:00
commit 068d4cc80d
19 changed files with 298 additions and 104 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*_del.h *_del.h
new_gtlds.h new_gtlds.h
nic_handles.h
tld_serv.h tld_serv.h
servers_charset.h servers_charset.h
version.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 new_gtlds.h: new_gtlds_list make_new_gtlds.pl
$(PERL) 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 tld_serv.h: tld_serv_list make_tld_serv.pl
$(PERL) make_tld_serv.pl < $< > $@ $(PERL) make_tld_serv.pl < $< > $@
@ -118,7 +121,7 @@ distclean: clean
clean: clean:
rm -f Makefile.depend as_del.h as32_del.h ip_del.h ip6_del.h \ rm -f Makefile.depend as_del.h as32_del.h ip_del.h ip6_del.h \
tld_serv.h servers_charset.h *.o whois mkpasswd new_gtlds.h tld_serv.h servers_charset.h *.o whois mkpasswd
rm -f po/*.mo rm -f po/*.mo
pos: pos:

View File

@ -81,6 +81,15 @@
# define RANDOM_DEVICE "/dev/urandom" # define RANDOM_DEVICE "/dev/urandom"
#endif #endif
/* use arc4random_buf instead if it is available */
#if (defined __FreeBSD__ && __FreeBSD__ >= 9) || \
(defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || \
(defined OpenBSD && OpenBSD >= 200805) || \
(defined __APPLE__ && defined __MACH__)
# define HAVE_ARC4RANDOM_BUF
# undef RANDOM_DEVICE
#endif
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
# ifndef NLS_CAT_NAME # ifndef NLS_CAT_NAME
# define NLS_CAT_NAME "whois" # define NLS_CAT_NAME "whois"

9
data.h
View File

@ -11,17 +11,13 @@ const char *ripe_servers[] = {
"whois.apnic.net", "whois.apnic.net",
"whois.afrinic.net", "whois.afrinic.net",
"rr.arin.net", /* does not accept the old syntax */ "rr.arin.net", /* does not accept the old syntax */
"whois.6bone.net", /* 3.0.0b1 */
"whois.connect.com.au", /* 3.0.0b1 */ "whois.connect.com.au", /* 3.0.0b1 */
"whois.nic.fr", "whois.nic.fr",
"whois.telstra.net",
"whois.restena.lu", "whois.restena.lu",
"rr.level3.net", /* 3.0.0a13 */ "rr.level3.net", /* 3.0.0a13 */
"whois.ripn.net", "whois.ripn.net",
"whois.arnes.si", "whois.arnes.si",
"www.registry.co.ug",
"whois.nic.ir", "whois.nic.ir",
"whois.nic.ck",
"whois.ra.net", "whois.ra.net",
"whois.bgpmon.net", "whois.bgpmon.net",
NULL NULL
@ -159,6 +155,11 @@ const char *tld_serv[] = {
NULL, NULL NULL, NULL
}; };
const char *nic_handles_post[] = {
#include "nic_handles.h"
NULL, NULL
};
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
struct server_charset { struct server_charset {
const char *name; const char *name;

33
debian/changelog vendored
View File

@ -1,8 +1,35 @@
whois (5.2.0~bpo70+1) wheezy-backports; urgency=medium whois (5.2.3) unstable; urgency=medium
* Rebuilt for wheezy. * Added the .gw TLD server.
* Updated the .bm, .gr, .gt, .md, .np, .py, .tc, .tg, .vi, .net.za,
.org.za and .web.za TLD servers. (Closes: #773489)
* Removed the .cg TLD server.
* Updated the list of new gTLDs.
* mkpasswd: use arc4random_buf(3) where available.
* mkpasswd: support OpenBSD's new hash 2b.
* Updated some IPv4 allocations.
* Remove the new_gtlds.h generated file from the Debian source package.
-- Marco d'Itri <md@linux.it> Sun, 14 Sep 2014 13:30:49 +0200 -- Marco d'Itri <md@linux.it> Fri, 26 Dec 2014 20:12:24 +0100
whois (5.2.2) unstable; urgency=medium
* Fixed the code that removes trailing dots. (Closes: #763834)
* Added the .xn--d1alf (.мкд, Macedonia) and .xn--node (.გე, Georgia)
TLD servers.
* Updated the list of new gTLDs.
-- Marco d'Itri <md@linux.it> Thu, 06 Nov 2014 03:47:43 +0100
whois (5.2.1) unstable; urgency=medium
* Added the .aw and .zm TLD servers.
* Added the charset for whois.domain.kg.
* Updated the list of new gTLDs.
* Queries for bare TLDs will be directed to whois.iana.org.
(Closes: #763833)
-- Marco d'Itri <md@linux.it> Thu, 16 Oct 2014 02:01:20 +0200
whois (5.2.0) unstable; urgency=medium whois (5.2.0) unstable; urgency=medium

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: whois
Section: net Section: net
Priority: standard Priority: standard
Maintainer: Marco d'Itri <md@linux.it> Maintainer: Marco d'Itri <md@linux.it>
Standards-Version: 3.9.5 Standards-Version: 3.9.6
Build-Depends: debhelper (>= 5), gettext, libidn11-dev Build-Depends: debhelper (>= 5), gettext, libidn11-dev
Vcs-Git: git://github.com/rfc1036/whois.git Vcs-Git: git://github.com/rfc1036/whois.git
Vcs-Browser: https://github.com/rfc1036/whois Vcs-Browser: https://github.com/rfc1036/whois

View File

@ -19,6 +19,7 @@
39.0.0.0/8 apnic 39.0.0.0/8 apnic
41.0.0.0/8 afrinic 41.0.0.0/8 afrinic
42.0.0.0/8 apnic 42.0.0.0/8 apnic
43.224.0.0/11 apnic
43.0.0.0/8 whois.nic.ad.jp 43.0.0.0/8 whois.nic.ad.jp
46.0.0.0/8 ripe 46.0.0.0/8 ripe
49.0.0.0/8 apnic 49.0.0.0/8 apnic
@ -149,11 +150,6 @@
196.0.0.0/7 afrinic 196.0.0.0/7 afrinic
198.0.0.0/7 arin 198.0.0.0/7 arin
200.17.0.0/16 whois.nic.br
200.18.0.0/15 whois.nic.br
200.20.0.0/16 whois.nic.br
200.96.0.0/13 whois.nic.br
200.128.0.0/9 whois.nic.br
200.0.0.0/7 lacnic 200.0.0.0/7 lacnic
202.11.0.0/16 whois.nic.ad.jp 202.11.0.0/16 whois.nic.ad.jp
202.13.0.0/16 whois.nic.ad.jp 202.13.0.0/16 whois.nic.ad.jp

View File

@ -9,8 +9,8 @@ while (<>) {
s/^\s+//; s/\s+$//; s/^\s+//; s/\s+$//;
next if /^$/; next if /^$/;
die "format error: $_" if not /^((?:xn--)?[a-z0-9]+)$/; die "format error: $_" if not /^(xn--[a-z0-9-]+|[a-z]+)$/;
print qq| ".$_",\n|; print qq| "$_",\n|;
} }

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|;
}

View File

@ -10,7 +10,7 @@ while (<>) {
next if /^$/; next if /^$/;
die "format error: $_" if not die "format error: $_" if not
(my ($a, $b) = /^([\w\d\.-]+)\s+([\w\d\.:-]+|[A-Z]+\s+.*)$/); (my ($a, $b) = /^\.(\w[\w\d\.-]+)\s+([\w\d\.:-]+|[A-Z]+\s+.*)$/);
$b =~ s/^W(?:EB)?\s+/\\x01/; $b =~ s/^W(?:EB)?\s+/\\x01/;
$b =~ s/^VERISIGN\s+/\\x04" "/; $b =~ s/^VERISIGN\s+/\\x04" "/;

View File

@ -86,7 +86,13 @@ static const struct crypt_method methods[] = {
N_("standard 56 bit DES-based crypt(3)") }, N_("standard 56 bit DES-based crypt(3)") },
{ "md5", "$1$", 8, 8, 0, "MD5" }, { "md5", "$1$", 8, 8, 0, "MD5" },
#if defined OpenBSD || defined FreeBSD || (defined __SVR4 && defined __sun) #if defined OpenBSD || defined FreeBSD || (defined __SVR4 && defined __sun)
# if (defined OpenBSD && OpenBSD >= 201405)
/* http://marc.info/?l=openbsd-misc&m=139320023202696 */
{ "bf", "$2b$", 22, 22, 1, "Blowfish" },
{ "bfa", "$2a$", 22, 22, 1, "Blowfish (obsolete $2a$ version)" },
# else
{ "bf", "$2a$", 22, 22, 1, "Blowfish" }, { "bf", "$2a$", 22, 22, 1, "Blowfish" },
# endif
#endif #endif
#if defined HAVE_LINUX_CRYPT_GENSALT #if defined HAVE_LINUX_CRYPT_GENSALT
{ "bf", "$2a$", 22, 22, 1, "Blowfish, system-specific on 8-bit chars" }, { "bf", "$2a$", 22, 22, 1, "Blowfish, system-specific on 8-bit chars" },
@ -377,20 +383,27 @@ void* get_random_bytes(const unsigned int count)
} }
#endif #endif
#ifdef RANDOM_DEVICE #if defined RANDOM_DEVICE || defined HAVE_ARC4RANDOM_BUF
void generate_salt(char *const buf, const unsigned int len) void generate_salt(char *const buf, const unsigned int len)
{ {
unsigned int i; unsigned int i;
unsigned char *entropy;
#if defined HAVE_ARC4RANDOM_BUF
void *entropy = NOFAIL(malloc(len));
arc4random_buf(entropy, len);
#else
entropy = get_random_bytes(len);
#endif
unsigned char *entropy = get_random_bytes(len * sizeof(unsigned char));
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
buf[i] = valid_salts[entropy[i] % (sizeof valid_salts - 1)]; buf[i] = valid_salts[entropy[i] % (sizeof valid_salts - 1)];
buf[i] = '\0'; buf[i] = '\0';
free(entropy); free(entropy);
} }
#else /* RANDOM_DEVICE */ #else /* RANDOM_DEVICE || HAVE_ARC4RANDOM_BUF */
void generate_salt(char *const buf, const unsigned int len) void generate_salt(char *const buf, const unsigned int len)
{ {
@ -418,7 +431,7 @@ void generate_salt(char *const buf, const unsigned int len)
buf[i] = '\0'; buf[i] = '\0';
} }
#endif /* RANDOM_DEVICE */ #endif /* RANDOM_DEVICE || HAVE_ARC4RANDOM_BUF */
void display_help(int error) void display_help(int error)
{ {

View File

@ -4,12 +4,19 @@
# Any exceptions can be handled in tld_serv_list as usual, since it will # Any exceptions can be handled in tld_serv_list as usual, since it will
# be checked first. # be checked first.
abogado
academy academy
accountants accountants
active active
actor actor
adult
agency agency
airforce airforce
allfinanz
alsace
amsterdam
android
aquarelle
archi archi
army army
associates associates
@ -18,6 +25,7 @@ auction
audio audio
autos autos
axa axa
band
bar bar
bargains bargains
bayern bayern
@ -29,18 +37,21 @@ bike
bio bio
black black
blackfriday blackfriday
bloomberg
blue blue
bmw bmw
bnpparibas bnpparibas
boo boo
boutique boutique
brussels brussels
budapest
build build
builders builders
business business
buzz buzz
bzh bzh
cab cab
cal
camera camera
camp camp
cancerresearch cancerresearch
@ -51,13 +62,17 @@ cards
care care
career career
careers careers
cartier
casa
cash cash
catering catering
center center
ceo ceo
cern cern
channel
cheap cheap
christmas christmas
chrome
church church
citic citic
city city
@ -67,11 +82,11 @@ click
clinic clinic
clothing clothing
club club
coach
codes codes
coffee coffee
college college
cologne cologne
com
community community
company company
computer computer
@ -84,6 +99,8 @@ cool
country country
credit credit
creditcard creditcard
cricket
crs
cruises cruises
cuisinella cuisinella
cymru cymru
@ -93,10 +110,12 @@ dating
day day
deals deals
degree degree
delivery
democrat democrat
dental dental
dentist dentist
desi desi
dev
diamonds diamonds
diet diet
digital digital
@ -104,33 +123,46 @@ direct
directory directory
discount discount
dnp dnp
docs
domains domains
doosan
durban durban
dvag
eat eat
education education
email email
emerck
energy
engineer engineer
engineering engineering
enterprises enterprises
equipment equipment
esq esq
estate estate
eurovision
eus eus
events events
everbank
exchange exchange
expert expert
exposed exposed
fail fail
farm farm
fashion
feedback feedback
finance finance
financial financial
firmdale
fish fish
fishing fishing
fitness fitness
flights flights
florist florist
flowers
flsmidth
fly
foo foo
forsale
foundation foundation
frl frl
frogans frogans
@ -139,17 +171,21 @@ furniture
futbol futbol
gal gal
gallery gallery
garden
gbiz gbiz
gent gent
ggee
gift gift
gifts gifts
gives gives
glass glass
gle
global global
globo globo
gmail gmail
gmo gmo
gmx gmx
google
gop gop
graphics graphics
gratis gratis
@ -173,16 +209,18 @@ host
hosting hosting
house house
how how
ibm
immo immo
immobilien immobilien
industries industries
info
ing ing
ink ink
institute institute
insure insure
international international
investments investments
irish
iwc
jetzt jetzt
joburg joburg
juegos juegos
@ -195,9 +233,13 @@ krd
kred kred
lacaixa lacaixa
land land
latrobe
lawyer lawyer
lds
lease lease
legal
lgbt lgbt
lidl
life life
lighting lighting
limited limited
@ -209,6 +251,7 @@ lotto
ltda ltda
luxe luxe
luxury luxury
madrid
maison maison
management management
mango mango
@ -218,22 +261,25 @@ media
meet meet
melbourne melbourne
meme meme
memorial
menu menu
miami miami
mini mini
moda moda
moe moe
monash monash
money
mormon
mortgage mortgage
moscow moscow
motorcycles motorcycles
mov mov
nagoya nagoya
navy navy
net
network network
neustar neustar
new new
nexus
ngo ngo
nhk nhk
ninja ninja
@ -244,13 +290,14 @@ okinawa
ong ong
onl onl
ooo ooo
org
organic organic
osaka
otsuka otsuka
ovh ovh
paris paris
partners partners
parts parts
party
pharmacy pharmacy
photo photo
photography photography
@ -262,10 +309,14 @@ pink
pizza pizza
place place
plumbing plumbing
pohl
poker
porn
praxi praxi
press press
prod prod
productions productions
prof
properties properties
property property
pub pub
@ -277,6 +328,7 @@ red
rehab rehab
reise reise
reisen reisen
reit
ren ren
rentals rentals
repair repair
@ -287,23 +339,30 @@ restaurant
reviews reviews
rich rich
rio rio
rip
rocks rocks
rodeo rodeo
rsvp rsvp
ruhr ruhr
ryukyu ryukyu
saarland saarland
sale
samsung
sarl sarl
sca sca
scb scb
schmidt schmidt
schule schule
schwarz
science
scot scot
services services
sew
sexy sexy
shiksha shiksha
shoes shoes
singles singles
sky
social social
software software
sohu sohu
@ -318,13 +377,16 @@ support
surf surf
surgery surgery
suzuki suzuki
sydney
systems systems
taipei
tatar tatar
tattoo tattoo
tax tax
technology technology
tienda tienda
tips tips
tires
tirol tirol
today today
tokyo tokyo
@ -334,6 +396,8 @@ town
toys toys
trade trade
training training
trust
tui
university university
uno uno
uol uol
@ -343,6 +407,7 @@ ventures
versicherung versicherung
vet vet
viajes viajes
video
villas villas
vision vision
vlaanderen vlaanderen
@ -357,17 +422,21 @@ watch
webcam webcam
website website
wed wed
wedding
whoswho whoswho
wien wien
wiki wiki
williamhill williamhill
wme wme
work
works works
world
wtc wtc
wtf wtf
xn--1qqw23a xn--1qqw23a
xn--3bst00m xn--3bst00m
xn--3ds443g xn--3ds443g
xn--45q11c
xn--4gbrim xn--4gbrim
xn--55qw42g xn--55qw42g
xn--55qx5d xn--55qx5d
@ -379,10 +448,13 @@ xn--80aswg
xn--c1avg xn--c1avg
xn--cg4bki xn--cg4bki
xn--czr694b xn--czr694b
xn--czrs0t
xn--czru2d xn--czru2d
xn--d1acj3b xn--d1acj3b
xn--fiq228c5hs xn--fiq228c5hs
xn--fiq64b xn--fiq64b
xn--flw351e
xn--hxt814e
xn--i1b6b1a6a2e xn--i1b6b1a6a2e
xn--io0a7i xn--io0a7i
xn--kput3i xn--kput3i
@ -390,16 +462,23 @@ xn--mgbab2bd
xn--ngbc5azd xn--ngbc5azd
xn--nqv7f xn--nqv7f
xn--nqv7fs00ema xn--nqv7fs00ema
xn--p1acf
xn--q9jyb4c xn--q9jyb4c
xn--qcka1pmc
xn--rhqv96g xn--rhqv96g
xn--ses554g xn--ses554g
xn--unup4y xn--unup4y
xn--vermgensberater-ctb
xn--vermgensberatung-pwb
xn--vhquv xn--vhquv
xn--xhq521b xn--xhq521b
xn--zfr164b xn--zfr164b
xyz xyz
yachts yachts
yandex yandex
yoga
yokohama yokohama
youtube youtube
zip
zone zone
zuerich

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

@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2002-08-24 16:22+0200\n" "PO-Revision-Date: 2002-08-24 16:22+0200\n"
"Last-Translator: Aitor Ibaez <aitiba@gmail.com>\n" "Last-Translator: Aitor Ibaez <aitiba@gmail.com>\n"
"Language-Team: Euskara <Librezale@librezale.org>\n" "Language-Team: Euskara <Librezale@librezale.org>\n"
"Language: \n" "Language: eu\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"

View File

@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2006-04-26 21:03-0300\n" "PO-Revision-Date: 2006-04-26 21:03-0300\n"
"Last-Translator: Anderson Goulart <globalx@gmail.com>\n" "Last-Translator: Anderson Goulart <globalx@gmail.com>\n"
"Language-Team: Portuguese/Brazil\n" "Language-Team: Portuguese/Brazil\n"
"Language: \n" "Language: pt_BR\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n" "Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"

View File

@ -32,6 +32,7 @@ whois.isnic.is iso-8859-1
whois.nic.it utf-8 whois.nic.it utf-8
whois.jprs.jp iso-2022-jp whois.jprs.jp iso-2022-jp
whois.nic.ad.jp iso-2022-jp whois.nic.ad.jp iso-2022-jp
whois.domain.kg cp1251
whois.nic.or.kr utf-8 whois.nic.or.kr utf-8
whois.kr utf-8 whois.kr utf-8
# XXX I had to guess: the server is unable to fully transcode U+49b in the # XXX I had to guess: the server is unable to fully transcode U+49b in the
@ -40,6 +41,7 @@ whois.nic.kz rk1048
whois.nic.li utf-8 whois.nic.li utf-8
whois.domreg.lt utf-8 whois.domreg.lt utf-8
whois.dns.lu iso-8859-1 whois.dns.lu iso-8859-1
whois.marnet.mk utf-8
whois.nic.mu utf-8 whois.nic.mu utf-8
whois.norid.no iso-8859-1 whois.norid.no iso-8859-1
whois.iis.nu utf-8 whois.iis.nu utf-8

View File

@ -91,7 +91,7 @@
.bi whois1.nic.bi .bi whois1.nic.bi
.bj whois.nic.bj .bj whois.nic.bj
#.bl #.bl
.bm WEB http://207.228.133.14/cgi-bin/lansaweb?procfun+BMWHO+BMWHO2+WHO .bm WEB http://www.bermudanic.bm/cgi-bin/lansaweb?procfun+BMWHO+BMWHO2+WHO
.bn whois.bn # www.brunet.bn .bn whois.bn # www.brunet.bn
.bo whois.nic.bo .bo whois.nic.bo
#.bq #.bq
@ -107,7 +107,7 @@
.cc VERISIGN ccwhois.verisign-grs.com .cc VERISIGN ccwhois.verisign-grs.com
.cd whois.nic.cd .cd whois.nic.cd
.cf whois.dot.cf .cf whois.dot.cf
.cg WEB http://www.nic.cg/cgi-bin/whois.pl .cg NONE
.ch whois.nic.ch .ch whois.nic.ch
.ci whois.nic.ci .ci whois.nic.ci
.ck NONE .ck NONE
@ -156,12 +156,12 @@
.gm WEB http://www.nic.gm/htmlpages/whois.htm .gm WEB http://www.nic.gm/htmlpages/whois.htm
.gn NONE # http://www.psg.com/dns/gn/ .gn NONE # http://www.psg.com/dns/gn/
.gp WEB https://www.dom-enic.com/whois.html .gp WEB https://www.dom-enic.com/whois.html
.gq NONE # NO NIC http://www.getesa.gq/ .gq whois.dominio.gq
.gr WEB https://grweb.ics.forth.gr/Whois?lang=en .gr WEB https://grweb.ics.forth.gr/public/whois.jsp?lang=en
.gs whois.nic.gs .gs whois.nic.gs
.gt WEB http://www.gt/who_is.html .gt WEB http://www.gt/
.gu WEB http://gadao.gov.gu/domainsearch.htm .gu WEB http://gadao.gov.gu/domainsearch.htm
.gw NONE # currently no registry .gw WEB http://nic.gw/en/whois/
.gy whois.registry.gy .gy whois.registry.gy
.hk whois.hkirc.hk .hk whois.hkirc.hk
.hm whois.registry.hm .hm whois.registry.hm
@ -185,7 +185,7 @@
.jp whois.jprs.jp .jp whois.jprs.jp
.ke whois.kenic.or.ke .ke whois.kenic.or.ke
.kg whois.domain.kg .kg whois.domain.kg
.kh NONE # http://www.mptc.gov.kh/DomainNameRegistrationForm.aspx http://www.nic.net.kh/ .kh NONE # http://www.trc.gov.kh/index.php/en/newsCategory/view?id=42&detail_id=68
.ki whois.nic.mu .ki whois.nic.mu
.km NONE # www.domaine.km .km NONE # www.domaine.km
.kn WEB http://www.nic.kn/ .kn WEB http://www.nic.kn/
@ -207,7 +207,7 @@
.ly whois.nic.ly .ly whois.nic.ly
.ma whois.iam.net.ma # www.nic.ma .ma whois.iam.net.ma # www.nic.ma
.mc NONE # www.nic.mc .mc NONE # www.nic.mc
.md WEB http://www.dns.md/wh1.php # whois.nic.md is restricted .md whois.nic.md
.me whois.nic.me # afilias .me whois.nic.me # afilias
#.mf #.mf
.mg whois.nic.mg .mg whois.nic.mg
@ -227,7 +227,7 @@
.mw WEB http://www.registrar.mw/ .mw WEB http://www.registrar.mw/
.mx whois.mx .mx whois.mx
.my whois.mynic.my .my whois.mynic.my
.mz NONE # NIC? www.uem.mz .mz whois.nic.mz
.na whois.na-nic.com.na .na whois.na-nic.com.na
.nc whois.nc .nc whois.nc
.ne NONE # NIC? http://www.intnet.ne .ne NONE # NIC? http://www.intnet.ne
@ -236,7 +236,7 @@
.ni WEB http://www.nic.ni/ .ni WEB http://www.nic.ni/
.nl whois.domain-registry.nl .nl whois.domain-registry.nl
.no whois.norid.no .no whois.norid.no
.np WEB http://register.mos.com.np/userSearchInc.asp .np WEB http://register.mos.com.np/np-whois-lookup
.nr WEB http://www.cenpac.net.nr/dns/whois.html .nr WEB http://www.cenpac.net.nr/dns/whois.html
.nu whois.iis.nu .nu whois.iis.nu
.nz whois.srs.net.nz .nz whois.srs.net.nz
@ -255,7 +255,7 @@
.ps whois.pnina.ps .ps whois.pnina.ps
.pt whois.dns.pt .pt whois.dns.pt
.pw whois.nic.pw .pw whois.nic.pw
.py WEB http://www.nic.py/consultas.html .py WEB http://www.nic.py/consulta-datos.php
.qa whois.registry.qa .qa whois.registry.qa
.re whois.nic.re .re whois.nic.re
.ro whois.rotld.ro .ro whois.rotld.ro
@ -285,10 +285,10 @@
.sx whois.sx .sx whois.sx
.sy whois.tld.sy .sy whois.tld.sy
.sz NONE # http://www.sispa.org.sz/ .sz NONE # http://www.sispa.org.sz/
.tc whois.meridiantld.net .tc whois.nic.tc
.td WEB http://www.nic.td/ .td WEB http://www.nic.td/
.tf whois.nic.tf .tf whois.nic.tf
.tg WEB http://www.nic.tg/ .tg whois.nic.tg
.th whois.thnic.co.th .th whois.thnic.co.th
.tj WEB http://www.nic.tj/whois.html .tj WEB http://www.nic.tj/whois.html
.tk whois.dot.tk .tk whois.dot.tk
@ -329,7 +329,7 @@
.vc AFILIAS .vc AFILIAS
.ve whois.nic.ve .ve whois.nic.ve
.vg whois.adamsnames.tc .vg whois.adamsnames.tc
.vi WEB http://www.nic.vi/whoisform.htm .vi WEB https://secure.nic.vi/whois-lookup/
.vn WEB http://www.vnnic.vn/en/domain .vn WEB http://www.vnnic.vn/en/domain
.vu vunic.vu .vu vunic.vu
.wf whois.nic.wf .wf whois.nic.wf
@ -340,10 +340,10 @@
.alt.za whois.alt.za .alt.za whois.alt.za
.co.za whois.registry.net.za .co.za whois.registry.net.za
.gov.za whois.gov.za .gov.za whois.gov.za
.net.za whois.net.za .net.za net-whois.registry.net.za
.org.za WEB http://www.org.za/ # rwhois.org.za:4321 is restricted .org.za org-whois.registry.net.za
.web.za whois.web.za .web.za web-whois.registry.net.za
.za NONE # http://www.zadna.org.za/annexure-d.html .za NONE # http://www.zadna.org.za/content/page/domain-information
.zm whois.nic.zm .zm whois.nic.zm
.zw NONE # http://www.zispa.co.zw/ .zw NONE # http://www.zispa.co.zw/
@ -354,6 +354,7 @@
.xn--80ao21a whois.nic.kz # Kazakhstan .xn--80ao21a whois.nic.kz # Kazakhstan
.xn--90a3ac whois.rnids.rs # Serbia .xn--90a3ac whois.rnids.rs # Serbia
.xn--clchc0ea0b2g2a9gcd whois.sgnic.sg # Singapore, Tamil .xn--clchc0ea0b2g2a9gcd whois.sgnic.sg # Singapore, Tamil
.xn--d1alf whois.marnet.mk # Macedonia
.xn--fiqs8s cwhois.cnnic.cn # China, Simplified Chinese .xn--fiqs8s cwhois.cnnic.cn # China, Simplified Chinese
.xn--fiqz9s cwhois.cnnic.cn # China, Traditional Chinese .xn--fiqz9s cwhois.cnnic.cn # China, Traditional Chinese
.xn--fpcrj9c3d whois.inregistry.net # India, Telugu AW .xn--fpcrj9c3d whois.inregistry.net # India, Telugu AW
@ -374,6 +375,7 @@
.xn--mgbc0a9azcg NONE # Morocco .xn--mgbc0a9azcg NONE # Morocco
.xn--mgberp4a5d4ar whois.nic.net.sa # Saudi Arabia .xn--mgberp4a5d4ar whois.nic.net.sa # Saudi Arabia
.xn--mgbx4cd0ab whois.mynic.my # Malaysia AW .xn--mgbx4cd0ab whois.mynic.my # Malaysia AW
.xn--node whois.itdc.ge # Georgia
.xn--o3cw4h whois.thnic.co.th # Thailand .xn--o3cw4h whois.thnic.co.th # Thailand
.xn--ogbpf8fl whois.tld.sy # Syria .xn--ogbpf8fl whois.tld.sy # Syria
.xn--p1ai whois.tcinet.ru # Russian Federation .xn--p1ai whois.tcinet.ru # Russian Federation
@ -385,38 +387,3 @@
.xn--xkc2dl3a5ee0h whois.inregistry.net # India, Tamil AW .xn--xkc2dl3a5ee0h whois.inregistry.net # India, Tamil AW
.xn--yfro4i67o whois.sgnic.sg # Singapore, Chinese .xn--yfro4i67o whois.sgnic.sg # Singapore, Chinese
.xn--ygbi2ammx whois.pnina.ps # Palestinian Territory .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

102
whois.c
View File

@ -442,7 +442,7 @@ const char *match_config_file(const char *s)
} }
regfree(&re); regfree(&re);
#else #else
if (domcmp(s, pattern)) { if (endstrcaseeq(s, pattern)) {
fclose(fp); fclose(fp);
return strdup(server); return strdup(server);
} }
@ -496,6 +496,15 @@ char *guess_server(const char *s)
/* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */ /* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
if (!strpbrk(s, ".-")) { if (!strpbrk(s, ".-")) {
/* if it is a TLD or a new gTLD then ask IANA */
for (i = 0; tld_serv[i]; i += 2)
if (strcaseeq(s, tld_serv[i]))
return strdup("whois.iana.org");
for (i = 0; new_gtlds[i]; i++)
if (strcaseeq(s, new_gtlds[i]))
return strdup("whois.iana.org");
if (strncaseeq(s, "as", 2) && /* it's an AS */ if (strncaseeq(s, "as", 2) && /* it's an AS */
(isasciidigit(s[2]) || s[2] == ' ')) (isasciidigit(s[2]) || s[2] == ' '))
return strdup(whereas(atol(s + 2))); return strdup(whereas(atol(s + 2)));
@ -524,7 +533,7 @@ char *guess_server(const char *s)
/* check the TLDs list */ /* check the TLDs list */
for (i = 0; tld_serv[i]; i += 2) for (i = 0; tld_serv[i]; i += 2)
if (domcmp(s, tld_serv[i])) if (in_domain(s, tld_serv[i]))
return strdup(tld_serv[i + 1]); return strdup(tld_serv[i + 1]);
/* use the default server name for "new" gTLDs */ /* use the default server name for "new" gTLDs */
@ -541,6 +550,12 @@ char *guess_server(const char *s)
for (i = 0; nic_handles[i]; i += 2) for (i = 0; nic_handles[i]; i += 2)
if (strncaseeq(s, nic_handles[i], strlen(nic_handles[i]))) if (strncaseeq(s, nic_handles[i], strlen(nic_handles[i])))
return strdup(nic_handles[i + 1]); 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 (endstrcaseeq(s, nic_handles_post[i]))
return strdup(nic_handles_post[i + 1]);
/* it's probably a network name */ /* it's probably a network name */
return strdup(""); return strdup("");
} }
@ -633,9 +648,9 @@ char *queryformat(const char *server, const char *flags, const char *query)
/* add useful default flags if there are no flags or multiple arguments */ /* add useful default flags if there are no flags or multiple arguments */
if (isripe) { } if (isripe) { }
else if (strchr(query, ' ') || *flags) { } else if (strchr(query, ' ') || *flags) { }
else if (streq(server, "whois.denic.de") && domcmp(query, ".de")) else if (streq(server, "whois.denic.de") && in_domain(query, "de"))
strcat(buf, "-T dn" DENIC_PARAM_ACE DENIC_PARAM_CHARSET " "); strcat(buf, "-T dn" DENIC_PARAM_ACE DENIC_PARAM_CHARSET " ");
else if (streq(server, "whois.dk-hostmaster.dk") && domcmp(query, ".dk")) else if (streq(server, "whois.dk-hostmaster.dk") && in_domain(query, "dk"))
strcat(buf, "--show-handles "); strcat(buf, "--show-handles ");
/* mangle and add the query string */ /* mangle and add the query string */
@ -1035,18 +1050,50 @@ int japanese_locale(void) {
} }
/* check if dom ends with tld */ /* check if dom ends with tld */
int domcmp(const char *dom, const char *tld) int endstrcaseeq(const char *dom, const char *tld)
{ {
const char *p, *q; size_t dom_len, tld_len;
const char *p = NULL;
for (p = dom; *p; p++); p--; /* move to the last char */ if ((dom_len = strlen(dom)) == 0)
for (q = tld; *q; q++); q--; return 0;
while (p >= dom && q >= tld && tolower(*p) == *q) { /* compare backwards */
if (q == tld) /* start of the second word? */ if ((tld_len = strlen(tld)) == 0)
return 1; return 0;
p--; q--;
} /* dom cannot be shorter than what we are looking for */
return 0; if (tld_len > dom_len)
return 0;
p = dom + dom_len - tld_len;
return strcaseeq(p, tld);
}
/* check if dom is a subdomain of tld */
int in_domain(const char *dom, const char *tld)
{
size_t dom_len, tld_len;
const char *p = NULL;
if ((dom_len = strlen(dom)) == 0)
return 0;
if ((tld_len = strlen(tld)) == 0)
return 0;
/* dom cannot be shorter than what we are looking for */
/* -1 to ignore dom containing just a dot and tld */
if (tld_len >= dom_len - 1)
return 0;
p = dom + dom_len - tld_len;
/* fail if the character before tld is not a dot */
if (*(p - 1) != '.')
return 0;
return strcaseeq(p, tld);
} }
const char *is_new_gtld(const char *s) const char *is_new_gtld(const char *s)
@ -1054,8 +1101,8 @@ const char *is_new_gtld(const char *s)
int i; int i;
for (i = 0; new_gtlds[i]; i++) for (i = 0; new_gtlds[i]; i++)
if (domcmp(s, new_gtlds[i])) if (in_domain(s, new_gtlds[i]))
return new_gtlds[i] + 1; return new_gtlds[i];
return 0; return 0;
} }
@ -1063,7 +1110,7 @@ const char *is_new_gtld(const char *s)
/* /*
* Attempt to normalize a query by removing trailing dots and whitespace, * Attempt to normalize a query by removing trailing dots and whitespace,
* then convert the domain to punycode. * then convert the domain to punycode.
* The function assumes that the domain is the last token of they query. * The function assumes that the domain is the last token of the query.
* Returns a malloc'ed string which needs to be freed by the caller. * Returns a malloc'ed string which needs to be freed by the caller.
*/ */
char *normalize_domain(const char *dom) char *normalize_domain(const char *dom)
@ -1074,10 +1121,15 @@ char *normalize_domain(const char *dom)
#endif #endif
ret = strdup(dom); ret = strdup(dom);
/* eat trailing dots and blanks */ /* start from the last character */
p = ret + strlen(ret); p = ret + strlen(ret) - 1;
for (; *p == '.' || *p == ' ' || *p == '\t' || p == ret; p--) /* and then eat trailing dots and blanks */
while (p > ret) {
if (!(*p == '.' || *p == ' ' || *p == '\t'))
break;
*p = '\0'; *p = '\0';
p--;
}
#ifdef HAVE_LIBIDN #ifdef HAVE_LIBIDN
/* find the start of the last word if there are spaces in the query */ /* find the start of the last word if there are spaces in the query */
@ -1235,19 +1287,23 @@ char *convert_inaddr(const char *s)
if (errno || a < 0 || a > 255 || *endptr != '.') if (errno || a < 0 || a > 255 || *endptr != '.')
return strdup("0.0.0.0"); return strdup("0.0.0.0");
if (domcmp(endptr + 1, ".in-addr.arpa")) { if (in_domain(endptr + 1, "in-addr.arpa")) {
b = strtol(endptr + 1, &endptr, 10); /* 1.2. */ b = strtol(endptr + 1, &endptr, 10); /* 1.2. */
if (errno || b < 0 || b > 255 || *endptr != '.') if (errno || b < 0 || b > 255 || *endptr != '.')
return strdup("0.0.0.0"); return strdup("0.0.0.0");
if (domcmp(endptr + 1, ".in-addr.arpa")) { if (in_domain(endptr + 1, "in-addr.arpa")) {
c = strtol(endptr + 1, &endptr, 10); /* 1.2.3. */ c = strtol(endptr + 1, &endptr, 10); /* 1.2.3. */
if (errno || c < 0 || c > 255 || *endptr != '.') if (errno || c < 0 || c > 255 || *endptr != '.')
return strdup("0.0.0.0"); return strdup("0.0.0.0");
if (domcmp(endptr + 1, ".in-addr.arpa")) if (in_domain(endptr + 1, "in-addr.arpa"))
return strdup("0.0.0.0"); return strdup("0.0.0.0");
} else {
c = b; b = a; a = 0;
} }
} else {
c = a; a = 0;
} }
new = malloc(sizeof("255.255.255.255")); new = malloc(sizeof("255.255.255.255"));

View File

@ -28,7 +28,8 @@ int japanese_locale(void);
unsigned long myinet_aton(const char *); unsigned long myinet_aton(const char *);
unsigned long asn32_to_long(const char *); unsigned long asn32_to_long(const char *);
int isasciidigit(const char); int isasciidigit(const char);
int domcmp(const char *, const char *); int endstrcaseeq(const char *, const char *);
int in_domain(const char *, const char *);
const char *is_new_gtld(const char *); const char *is_new_gtld(const char *);
int domfind(const char *, const char *[]); int domfind(const char *, const char *[]);
char *normalize_domain(const char *); char *normalize_domain(const char *);