From c30d63196924e6f5d42a11bbbd545e11c379fb4b Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sun, 30 Jan 2005 13:51:30 +0100 Subject: Imported Debian version 4.7.0 --- Makefile | 9 ++++-- README | 9 ------ config.h | 2 +- data.h | 92 ++++---------------------------------------------------- debian/changelog | 18 +++++++++++ debian/control | 2 +- debian/rules | 2 +- ip6_del_list | 46 ++++++++++++++++++++++++++++ ip_del_list | 3 ++ make_ip6_del.pl | 36 ++++++++++++++++++++++ tld_serv_list | 51 ++++++++++++++++--------------- whois.c | 38 +++++++++-------------- whois.h | 6 ++-- whois.spec | 2 +- 14 files changed, 163 insertions(+), 153 deletions(-) create mode 100644 ip6_del_list create mode 100755 make_ip6_del.pl diff --git a/Makefile b/Makefile index b0a0bcc..ec2a88d 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,11 @@ LIBIDN += -lidn CFLAGS += -DHAVE_LIBIDN endif -PERL=perl +PERL := perl all: whois #pos -whois: whois.c whois.h config.h data.h as_del.h ip_del.h tld_serv.h +whois: whois.c whois.h config.h data.h as_del.h ip_del.h ip6_del.h tld_serv.h $(CC) $(CFLAGS) $(OPTS) whois.c -o whois $(LDFLAGS) $(LIBIDN) mkpasswd: mkpasswd.c @@ -36,6 +36,9 @@ as_del.h: as_del_list make_as_del.pl ip_del.h: ip_del_list make_ip_del.pl $(PERL) -w make_ip_del.pl < ip_del_list > ip_del.h +ip6_del.h: ip6_del_list make_ip6_del.pl + $(PERL) -w make_ip6_del.pl < ip6_del_list > ip6_del.h + tld_serv.h: tld_serv_list make_tld_serv.pl $(PERL) -w make_tld_serv.pl < tld_serv_list > tld_serv.h @@ -50,7 +53,7 @@ distclean: clean rm -f po/whois.pot clean: - rm -f as_del.h ip_del.h tld_serv.h whois mkpasswd + rm -f as_del.h ip_del.h ip6_del.h tld_serv.h whois mkpasswd rm -f po/*.mo test: diff --git a/README b/README index 0e38ef7..13f712d 100644 --- a/README +++ b/README @@ -1,12 +1,3 @@ -This version of whois is compiled without idn-support (means: it cannot -directly resolve domains with non-ascii characters). If you need a version -with idn-support, please use any of the floating backports. - - -Andreas Barth , 2004-12-23 - - - Why another whois client? Because the RIPE client is a mess of hacks and #ifdefs and more complex programs lack features or are bloated. diff --git a/config.h b/config.h index 28cf09c..c6af190 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,6 @@ /* Program version */ /* not for the inetutils version */ -#define VERSION "4.6.25" +#define VERSION "4.7.0" /* Configurable features */ diff --git a/data.h b/data.h index c056445..68b2cde 100644 --- a/data.h +++ b/data.h @@ -93,94 +93,14 @@ const struct ip_del ip_assign[] = { }; struct ip6_del { - const unsigned char net; /* bits 16-21 of the address */ - const char *serv; -}; - -/* http://www.ripe.net/ripe/draft-documents/ipv6.html */ -/* address bits 0-6 */ -const struct ip6_del ip6_assign_rirs[] = { - { 0x24, "whois.apnic.net" }, - { 0x28, "whois.afrinic.net" }, - { 0x2A, "whois.arin.net" }, - { 0x30, "whois.lacnic.net" }, - { 0x34, "whois.ripe.net" }, - { 0, NULL } + const unsigned long net; + const unsigned short masklen; + const char *serv; }; -/* http://www.iana.org./assignments/ipv6-tla-assignments */ -/* address bits 16 + 0-7 */ -const struct ip6_del ip6_assign_misc[] = { - { 0x02, "whois.apnic.net" }, - { 0x04, "whois.arin.net" }, - { 0x06, "whois.ripe.net" }, - { 0x08, "whois.ripe.net" }, - { 0x0A, "whois.ripe.net" }, - { 0x0C, "whois.apnic.net" }, - { 0x0E, "whois.apnic.net" }, -/* { 0x10, "" }, */ - { 0x12, "whois.lacnic.net" }, - { 0x14, "whois.ripe.net" }, - { 0x16, "whois.ripe.net" }, - { 0x18, "whois.arin.net" }, - { 0x1A, "whois.ripe.net" }, - { 0x1C, "whois.ripe.net" }, - { 0x1E, "whois.ripe.net" }, - { 0x20, "whois.ripe.net" }, - { 0x22, "whois.ripe.net" }, - { 0x24, "whois.ripe.net" }, - { 0x26, "whois.ripe.net" }, - { 0x28, "whois.ripe.net" }, - { 0x2A, "whois.ripe.net" }, - { 0x2C, "whois.ripe.net" }, - { 0x2E, "whois.ripe.net" }, - { 0x30, "whois.ripe.net" }, - { 0x32, "whois.ripe.net" }, - { 0x34, "whois.ripe.net" }, - { 0x36, "whois.ripe.net" }, - { 0x38, "whois.ripe.net" }, - { 0x3A, "whois.ripe.net" }, - { 0x40, "whois.ripe.net" }, - { 0x42, "whois.arin.net" }, - { 0x44, "whois.apnic.net" }, - { 0x46, "whois.ripe.net" }, - { 0x48, "whois.arin.net" }, - { 0x4A, "whois.ripe.net" }, - - { 0x50, "whois.ripe.net" }, - { 0x52, "whois.ripe.net" }, - { 0x54, "whois.ripe.net" }, - { 0x56, "whois.ripe.net" }, - { 0x58, "whois.ripe.net" }, - { 0x5A, "whois.ripe.net" }, - { 0x5C, "whois.ripe.net" }, - { 0x5E, "whois.ripe.net" }, - - { 0x80, "whois.apnic.net" }, - { 0x82, "whois.apnic.net" }, - { 0x84, "whois.apnic.net" }, - { 0x86, "whois.apnic.net" }, - { 0x88, "whois.apnic.net" }, - { 0x8A, "whois.apnic.net" }, - { 0x8C, "whois.apnic.net" }, - { 0x8E, "whois.apnic.net" }, - { 0x90, "whois.apnic.net" }, - { 0x92, "whois.apnic.net" }, - { 0x94, "whois.apnic.net" }, - { 0x96, "whois.apnic.net" }, - { 0x98, "whois.apnic.net" }, - { 0x9A, "whois.apnic.net" }, - { 0x9C, "whois.apnic.net" }, - { 0x9E, "whois.apnic.net" }, - { 0xA0, "whois.apnic.net" }, - { 0xA2, "whois.apnic.net" }, - { 0xA4, "whois.apnic.net" }, - { 0xA6, "whois.apnic.net" }, - { 0xA8, "whois.apnic.net" }, - { 0xAA, "whois.apnic.net" }, - { 0xAC, "whois.apnic.net" }, - { 0xAE, "whois.apnic.net" }, - { 0, NULL } +const struct ip6_del ip6_assign[] = { +#include "ip6_del.h" + { 0, 0, NULL } }; struct as_del { diff --git a/debian/changelog b/debian/changelog index 403e894..812c721 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +whois (4.7.0) unstable; urgency=medium + + * Updated the .af, .ar, .cf, .dm, .ec, .es, .ga, .gu, .ky, .lt, .sb, .wf + and .yt TLD servers. + * Updated the IPv6 allocations and added support for a generic list of + IPv6 prefixes. + * Updated the IPv4 allocations. + + -- Marco d'Itri Sun, 30 Jan 2005 13:51:30 +0100 + +whois (4.6.26) unstable; urgency=medium + + * Fixed switch -d. (Closes: #287487) + * Fixed RPSL hierarchical objects. + * Updated the IPv6 allocations. + + -- Marco d'Itri Tue, 28 Dec 2004 10:42:12 +0100 + whois (4.6.25) unstable; urgency=medium * Added the .fi TLD server. (Closes: #283714) diff --git a/debian/control b/debian/control index d10a0a9..36af6bb 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Package: whois Architecture: any Depends: ${shlibs:Depends} Replaces: bsdmainutils (<= 4.5.1), bsdutils (<< 3.0-0) -Description: The GNU whois client +Description: the GNU whois client This is a new whois (RFC 3912) client rewritten from scratch. It is inspired from and compatible with the usual BSD and RIPE whois(1) programs. diff --git a/debian/rules b/debian/rules index 2306f07..6d684a0 100755 --- a/debian/rules +++ b/debian/rules @@ -41,4 +41,4 @@ binary: binary-arch checkroot: test root = "`whoami`" -.PHONY: binary binary-arch binary-indep clean checkroot +.PHONY: binary binary-arch binary-indep build clean checkroot diff --git a/ip6_del_list b/ip6_del_list new file mode 100644 index 0000000..9200d59 --- /dev/null +++ b/ip6_del_list @@ -0,0 +1,46 @@ +# http://www.iana.org./assignments/ipv6-tla-assignments +# The parser is very simple-minded and wants the two first components of +# addresses. It does not deal with networks == 0 or > 24 bit. + +2001:0200::/23 apnic +2001:0400::/23 arin +2001:0600::/23 ripe +2001:0800::/22 ripe +2001:0C00::/22 apnic +# contains 2001:1000::/23, not allocated +2001:1000::/22 lacnic +2001:1400::/22 ripe +2001:1800::/23 arin +2001:1A00::/23 ripe +2001:1C00::/22 ripe +# contains 2001:3C00::/22, reserved for RIPE but not allocated +2001:2000::/19 ripe +2001:4000::/23 ripe +2001:4200::/23 arin +2001:4400::/23 apnic +2001:4600::/23 ripe +2001:4800::/23 arin +2001:4A00::/23 ripe +# contains 2001:4E00::/23, not allocated +2001:4C00::/22 ripe + +2001:5000::/20 ripe + +2001:8000::/19 apnic +2001:A000::/20 apnic + +# 6to4 is special-cased +2002:0000::/16 6to4 + +2003:0000::/18 ripe + +# not yet formally accepted +# http://www.ripe.net/ripe/draft-documents/ipv6.html +2400:0000::/6 apnic +2800:0000::/6 afrinic +2A00:0000::/6 arin +3000:0000::/6 lacnic +3400:0000::/6 ripe + +3FFE:0000::/16 6bone + diff --git a/ip_del_list b/ip_del_list index d863a3e..a1e8f62 100644 --- a/ip_del_list +++ b/ip_del_list @@ -16,6 +16,9 @@ 62.0.0.0/8 ripe 80.0.0.0/5 ripe # => 87.255.255.254 88.0.0.0/8 ripe +124.0.0.0/8 apnic +125.0.0.0/8 apnic +126.0.0.0/8 apnic 96.0.0.0/3 UNALLOCATED # 96 -> 127 reserved 0.0.0.0/1 arin # all other A classes are managed by ARIN 133.0.0.0/8 whois.nic.ad.jp diff --git a/make_ip6_del.pl b/make_ip6_del.pl new file mode 100755 index 0000000..94b85b8 --- /dev/null +++ b/make_ip6_del.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl -w + +use strict; + +while (<>) { + chomp; + s/^\s*(.*)\s*$/$1/; + s/\s*#.*$//; + next if /^$/; + + die "invalid line:\n$_\n" + if not m#^([\da-fA-F]{4}):([\da-fA-F]{1,4})::/(\d+)\s+([\w\.]+)$#; + my $len = $3; my $s = $4; + my $i1 = $1; my $i2 = $2; + my $net = (hex($i1) << 16) + hex $i2; + + if (0) { # just some code to help me visually aggregate networks + my $bs = unpack('B32', pack('N', $net)); + $bs =~ s/(.{8})/$1 /g; + print "${i1}:${i2}::/$len\t$bs $s\n"; + next; + } + + print qq|{ ${net}UL, $len, "|; + if ($s =~ /\./) { + print $s; + } elsif ($s eq '6to4') { + print "\\x0A"; + } elsif ($s eq 'UNALLOCATED') { + print "\\006"; + } else { + print $s =~ /\./ ? $s : "whois.$s.net"; + } + print qq|" },\n|; +} + diff --git a/tld_serv_list b/tld_serv_list index bb7f3b8..49ea309 100644 --- a/tld_serv_list +++ b/tld_serv_list @@ -39,7 +39,7 @@ .ac whois.nic.ac .ad NONE # www.nic.ad .ae whois.uaenic.ae -.af NONE # whois.nic.af +.af whois.nic.af # whois.nic.cx .ag whois.nic.ag .ai WEB http://whois.offshore.ai/ .al NONE # http://www.inima.al/Domains.html @@ -48,7 +48,7 @@ .an NONE # http://www.una.net/an_domreg/ .ao NONE # www.dns.ao .aq NONE # 2day.com -.ar WEB http://www.nic.ar/consultas/consdom.html +.ar WEB http://www.nic.ar/ .as whois.nic.as .at whois.nic.at .au whois.ausregistry.net.au @@ -76,13 +76,13 @@ .ca whois.cira.ca .cc NICCC .cd whois.nic.cd -.cf WEB http://www.nic.cf/whois.php3 -.cg WEB http://www.nic.cg/cgi-bin/whoiscg.pl +.cf NONE # was: WEB http://www.nic.cf/whois.php3 +.cg WEB http://www.nic.cg/cgi-bin/whois.pl .ch whois.nic.ch .ci www.nic.ci .ck whois.nic.ck .cl whois.nic.cl -.cm NONE # http://info.intelcam.cm +.cm NONE # http://info.intelcam.cm http://www.camnet.cm/ .edu.cn whois.edu.cn .cn whois.cnnic.net.cn .uk.co whois.uk.co @@ -96,15 +96,15 @@ .de whois.denic.de .dj whois.domain.dj .dk whois.dk-hostmaster.dk -.dm NONE # www.domains.dm +.dm WEB https://secure.domains.dm/tools/whois.jsp .do WEB http://www.nic.do/whois-h.php3 .dz WEB http://www.nic.dz/anglais/dom-attr-eng.htm -.ec WEB http://www.nic.ec/consulta/whois.asp +.ec WEB http://www.nic.ec/eng/nicec.htm .ee whois.eenet.ee .eg NONE # http://www.ise.org.eg/domain.htm http://www.frcu.eun.eg/docs/e/dns.php #.eh .er NONE # http://www.afridns.org/er/tld_er.txt -.es WEB https://www.nic.es/esnic/jsp/whois_ctos.jsp +.es WEB https://www.nic.es/ingles/ #.et NONE # NIC? www.telecom.net.et .fi whois.ficora.fi .fj whois.usp.ac.fj @@ -113,7 +113,7 @@ .fo whois.ripe.net # www.nic.fo .fr whois.nic.fr #.fx -#.ga # NIC? www.inet.ga +.ga NONE # www.nic.ga .gb NONE #.gd # NO NIC (UPR) .ge WEB http://whois.sanet.ge/ @@ -129,7 +129,7 @@ .gr WEB https://grweb.ics.forth.gr/Whois?lang=en .gs whois.adamsnames.tc .gt WEB http://www.gt/whois.htm -.gu WEB http://gadao.gov.gu/Scripts/wwsquery/wwsquery.dll?hois=guamquery +.gu WEB http://gadao.gov.gu/domainsearch.htm #.gw # no NIC? #.gy # NIC? (UPR) .hk whois.hkdnr.net.hk @@ -154,14 +154,14 @@ .jp whois.nic.ad.jp .ke whois.kenic.or.ke .kg whois.domain.kg -.kh NONE # http://www.mptc.gov.kh/Reculation/DNS.htm +.kh NONE # http://www.mptc.gov.kh/ http://www.nic.net.kh/ .ki WEB http://www.ki/dns/ .km NONE # NO NIC #.kn # NO NIC (UPR) #.kp .kr whois.nic.or.kr .kw WEB http://www.domainname.net.kw -.ky WEB http://146.115.157.215/whoisfrontend.asp +.ky NONE # http://www.icta.ky/dev/da_ky_reg_dom.php www.nic.ky .kz whois.domain.kz .la whois.nic.la .lb WEB http://www.aub.edu.lb/lbdr/search.html @@ -169,8 +169,8 @@ .li whois.nic.li .lk whois.nic.lk .lr NONE # http://www.psg.com/dns/lr/ -.ls NONE # NIC? http://www.co.ls/ -.lt whois.ripe.net +.ls NONE # http://www.co.ls/ +.lt whois.domreg.lt .lu whois.dns.lu .lv whois.nic.lv .ly WEB http://www.lydomains.com/ @@ -190,7 +190,7 @@ .ms whois.adamsnames.tc .mt WEB http://www.nic.org.mt/dir/home.html .mu WEB http://www.nic.mu/mauritius/domain.whois.php -#.mv # NIC? dhiraagu.com.mv +#.mv # NIC? www.dhiraagu.com.mv .mw WEB http://www.registrar.mw/ .mx whois.nic.mx .my whois.mynic.net.my @@ -211,14 +211,14 @@ .pa WEB http://www.nic.pa/ .pe whois.nic.pe #.pf # NIC? mana.pf -.pg NONE # http://www.unitech.ac.pg/Unitech_General/ITS/ITS_Dns.htm +.pg NONE # http://www.npi.gov.pg/DNS/DNS-Application-form.htm .ph WEB http://www.domains.ph/DomainSearch.asp .pk WEB http://www.pknic.net.pk/ .pl whois.dns.pl .pm whois.nic.fr .pn WEB http://www.pitcairn.pn/PnRegistry/CheckAvailability.html .pr WEB http://www.nic.pr/domain/whois.asp -.ps WEB http://www.nic.ps/whois/ +.ps WEB http://www.nic.ps/whois/whois.html .pt whois.dns.pt .pw whois.nic.pw .py WEB http://www.nic.py/consultas/ @@ -229,7 +229,7 @@ .ru whois.ripn.net .rw WEB http://www.nic.rw/cgi-bin/whoisrw.pl .sa saudinic.net.sa -.sb WEB http://www.nic.net.sb/search.htm +.sb WEB http://whois.nic.net.sb/ .sc NONE # www.nic.sc .sd NONE # http://www.isoc.sd/sd.php .se whois.nic-se.se @@ -258,7 +258,9 @@ .tm whois.nic.tm .tn NONE # http://www.ati.tn/Nic/ .to whois.tonic.to -.tp WEB http://cgi.connect.ie/cgi-bin/tplookup.cgi +#.tp WEB http://cgi.connect.ie/cgi-bin/tplookup.cgi +# also see whois.cocca.cx ALSO RELEVANT FOR .tl +.tp WEB http://www.nic.tp/whois.jsp .tr whois.metu.edu.tr .tt WEB http://www.nic.tt/cgi-bin/search.pl .tv whois.tv @@ -277,23 +279,22 @@ .uz WEB http://www.noc.uz/dom_01.htm .va whois.ripe.net .vc whois.opensrs.net -.ve WEB http://www.nic.ve/nicwho01.html # rwhois.reacciun.ve:4321 +.ve WEB http://www.nic.ve/ # rwhois.reacciun.ve:4321 .vg whois.adamsnames.tc .vi WEB http://www.nic.vi/whoisform.htm .vn WEB http://www.vnnic.net.vn/english/reg_domain/ .vu WEB http://www.vunic.vu/whois.htm -#.wf # NIC-FR! +.wf whois.nic.wf .ws whois.samoanic.ws #.ye # NIC? www.y.net.ye -#.yt # NIC-FR! +.yt whois.nic.yt .yu NONE # www.nic.yu .ac.za whois.ac.za -#.bourse.za whois.bourse.za # broken .co.za WEB http://whois.co.za/ .net.za whois.net.za .org.za WEB http://www.org.za/ # rwhois.org.za:4321 -.za NONE # http://www2.frd.ac.za/uninet/zadomains.html -.zm NONE # http://www.zamnet.zm/domain.shtml +.za NONE # http://www2.frd.ac.za/uninet/zadomains.html whois.frd.ac.za +.zm NONE # NIC? http://www.zamnet.zm/domain.shtml #.zw # NIC? zptc.co.zw http://www.zispa.co.zw/ -dom whois.networksolutions.com -org whois.networksolutions.com diff --git a/whois.c b/whois.c index 6167e43..a8c5829 100644 --- a/whois.c +++ b/whois.c @@ -341,36 +341,28 @@ const char *whichwhois(const char *s) { unsigned long ip; unsigned int i; + char *colon; /* IPv6 address */ - if (strchr(s, ':')) { + if ((colon = strchr(s, ':'))) { unsigned long v6prefix, v6net; - const struct ip6_del *ip6_assign; + + /* RPSL hierarchical objects like AS8627:fltr-TRANSIT-OUT */ + if (strncasecmp(s, "as", 2) == 0 && isasciidigit(s[2])) + return whereas(atoi(s + 2)); v6prefix = strtol(s, NULL, 16); - if (v6prefix == 0) { - /* RPSL hierarchical object like AS8627:fltr-TRANSIT-OUT */ - if (strncasecmp(s, "as", 2) == 0 && isasciidigit(s[2])) - return whereas(atoi(s + 2)); - return "\x05"; - } else if (v6prefix == 0x3FFE) { - return "whois.6bone.net"; - } else if (v6prefix == 0x2002) { - return "\x0A"; - } else if (v6prefix == 0x2001) { - v6net = strtol(s + 5, NULL, 16); /* second u16 */ - v6net = (v6net & 0xFE00) >> 8; /* first 7 bits */ - ip6_assign = ip6_assign_misc; - } else if (v6prefix >= 0x2400 && v6prefix <= 0x3A00) { - v6net = (v6prefix & 0xFC00) >> 8; /* first 6 bits */ - ip6_assign = ip6_assign_rirs; - } else - return "\x06"; - - for (i = 0; ip6_assign[i].serv; i++) - if (v6net == ip6_assign[i].net) + if (v6prefix == 0) + return "\x05"; /* unknown */ + + v6net = (v6prefix << 16) + strtol(colon + 1, NULL, 16);/* second u16 */ + + for (i = 0; ip6_assign[i].serv; i++) { + if ((v6net & (~0UL << (32 - ip6_assign[i].masklen))) + == ip6_assign[i].net) return ip6_assign[i].serv; + } return "\x06"; /* unknown allocation */ } diff --git a/whois.h b/whois.h index 4897b5e..5f8c012 100644 --- a/whois.h +++ b/whois.h @@ -1,9 +1,9 @@ /* 6bone referto: extension */ #define REFERTO_FORMAT "%% referto: whois -h %255s -p %15s %1021[^\n\r]" -/* String sent to RIPE servers - ONLY FIVE CHARACTERS! */ +/* String sent to RIPE servers - MUST NOT BE LONGER THAN FIVE CHARACTERS! */ /* Do *NOT* change it if you don't know what you are doing! */ -#define IDSTRING "Md4.6" +#define IDSTRING "Md4.7" #define HIDE_DISABLED -2 #define HIDE_UNSTARTED -1 @@ -37,6 +37,6 @@ void err_sys(const char *,...); /* flags for RIPE-like servers */ -const char *ripeflags="acFKlLmMrRSx"; +const char *ripeflags="acdFKlLmMrRSx"; const char *ripeflagsp="gisTtvq"; diff --git a/whois.spec b/whois.spec index 5bee55f..b101d7f 100644 --- a/whois.spec +++ b/whois.spec @@ -1,6 +1,6 @@ Summary: Enhanced WHOIS client Name: whois -Version: 4.6.25 +Version: 4.7.0 Release: 1 License: GPL Vendor: Marco d'Itri -- cgit v1.2.3