summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2007-09-13 03:28:21 +0200
committerMarco d'Itri <md@linux.it>2013-03-30 02:31:35 +0100
commitc3c46b20b8b1f7c5111daff0b45e56d8ba64ac7b (patch)
treecccdf580e6d7ffda2a646c80ec69e56baf9f2c58
parentb62995f67024549c4edcf5c39a1533ea289f6897 (diff)
downloadwhois-c3c46b20b8b1f7c5111daff0b45e56d8ba64ac7b.tar.gz
Imported Debian version 4.7.23v4.7.23
-rw-r--r--Makefile14
-rw-r--r--README4
-rw-r--r--as32_del.h5
-rw-r--r--as32_del_list10
-rw-r--r--config.h2
-rw-r--r--data.h11
-rw-r--r--debian/changelog8
-rwxr-xr-xdebian/rules2
-rwxr-xr-xmake_as32_del.pl21
-rw-r--r--tld_serv_list16
-rw-r--r--whois.c38
-rw-r--r--whois.h2
-rw-r--r--whois.spec2
13 files changed, 117 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 19b74e9..47cb17c 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,8 @@ PERL := perl
all: whois #pos
-whois: whois.c whois.h config.h data.h as_del.h ip_del.h ip6_del.h tld_serv.h
+whois: whois.c whois.h config.h data.h \
+ as_del.h as32_del.h ip_del.h ip6_del.h tld_serv.h
$(CC) $(CFLAGS) $(whois_CFLAGS) $(OPTS) whois.c -o whois \
$(LDFLAGS) $(whois_LDADD)
@@ -37,16 +38,19 @@ mkpasswd: mkpasswd.c
$(LDFLAGS) $(mkpasswd_LDADD)
as_del.h: as_del_list make_as_del.pl
- $(PERL) -w make_as_del.pl < as_del_list > as_del.h
+ $(PERL) -w make_as_del.pl < as_del_list > $@
+
+as32_del.h: as32_del_list make_as32_del.pl
+ $(PERL) -w make_as32_del.pl < as32_del_list > $@
ip_del.h: ip_del_list make_ip_del.pl
- $(PERL) -w make_ip_del.pl < ip_del_list > ip_del.h
+ $(PERL) -w make_ip_del.pl < ip_del_list > $@
ip6_del.h: ip6_del_list make_ip6_del.pl
- $(PERL) -w make_ip6_del.pl < ip6_del_list > ip6_del.h
+ $(PERL) -w make_ip6_del.pl < ip6_del_list > $@
tld_serv.h: tld_serv_list make_tld_serv.pl
- $(PERL) -w make_tld_serv.pl < tld_serv_list > tld_serv.h
+ $(PERL) -w make_tld_serv.pl < tld_serv_list > $@
install: whois
install -m 0755 whois $(BASEDIR)$(prefix)/bin/
diff --git a/README b/README
index 13f712d..05858f7 100644
--- a/README
+++ b/README
@@ -25,8 +25,8 @@ Other information sources:
- http://www.uninett.no/navn/domreg.html
- http://www.iahc.org/dns-refs/registry.html
- http://www.iana.org/root-whois/xx.htm
-- http://www.afrinic.org
-- http://www.aftld.org
+- http://www.afrinic.net/
+- http://www.aftld.org/
Marco d'Itri
<md@linux.it>
diff --git a/as32_del.h b/as32_del.h
new file mode 100644
index 0000000..1d8744f
--- /dev/null
+++ b/as32_del.h
@@ -0,0 +1,5 @@
+{ 131072, 196607, "whois.apnic.net" }, /* 2.0 2.65535 */
+{ 196608, 262143, "whois.ripe.net" }, /* 3.0 3.65535 */
+{ 262144, 327679, "whois.lacnic.net" }, /* 4.0 4.65535 */
+{ 327680, 393215, "whois.afrinic.net" }, /* 5.0 5.65535 */
+{ 393216, 458751, "whois.arin.net" }, /* 6.0 6.65535 */
diff --git a/as32_del_list b/as32_del_list
new file mode 100644
index 0000000..087e2e0
--- /dev/null
+++ b/as32_del_list
@@ -0,0 +1,10 @@
+# http://www.iana.org/assignments/as-numbers
+
+# actually I listed here also the unallocated space reserved for each RIR
+
+2.0 2.65535 apnic
+3.0 3.65535 ripe
+4.0 4.65535 lacnic
+5.0 5.65535 afrinic
+6.0 6.65535 arin
+
diff --git a/config.h b/config.h
index 952dda7..3560cce 100644
--- a/config.h
+++ b/config.h
@@ -1,6 +1,6 @@
/* Program version */
/* not for the inetutils version */
-#define VERSION "4.7.22"
+#define VERSION "4.7.23"
/* Configurable features */
diff --git a/data.h b/data.h
index 895251a..3d194be 100644
--- a/data.h
+++ b/data.h
@@ -117,6 +117,17 @@ const struct as_del as_assign[] = {
{ 0, 0, NULL }
};
+struct as32_del {
+ const unsigned long first;
+ const unsigned long last;
+ const char *serv;
+};
+
+const struct as32_del as32_assign[] = {
+#include "as32_del.h"
+ { 0, 0, NULL }
+};
+
const char *tld_serv[] = {
#include "tld_serv.h"
NULL, NULL
diff --git a/debian/changelog b/debian/changelog
index 353d5dc..8276b2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+whois (4.7.23) unstable; urgency=medium
+
+ * Fixed myinet_aton to not reject CIDR networks.
+ * Added support for ASN32.
+ * Added the za.net and za.org pseudo-TLD servers.
+
+ -- Marco d'Itri <md@linux.it> Thu, 13 Sep 2007 03:28:21 +0200
+
whois (4.7.22) unstable; urgency=medium
* Added new IPv4 allocations.
diff --git a/debian/rules b/debian/rules
index 4da7def..1d73746 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,7 @@ build:
clean:
dh_testdir
-rm -f build
- -$(MAKE) distclean
+ $(MAKE) distclean
dh_clean
binary-arch: checkroot build
diff --git a/make_as32_del.pl b/make_as32_del.pl
new file mode 100755
index 0000000..15bbdbb
--- /dev/null
+++ b/make_as32_del.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+while (<STDIN>) {
+ chomp;
+ s/^\s*(.+)\s*$/$1/;
+ s/\s*#.*$//;
+ next if /^$/;
+
+ my ($fh, $fl, $lh, $ll, $s) = /^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/;
+ die "format error: $_" unless $s;
+
+ my $f = ($fh << 16) + $fl;
+ my $l = ($lh << 16) + $ll;
+ my $server = ($s =~ /\./) ? $s : "whois.$s.net";
+
+ print qq({ $f, $l,\t"$server" },\t/* $fh.$fl $lh.$ll */\n);
+}
+
diff --git a/tld_serv_list b/tld_serv_list
index 5616e93..9481d94 100644
--- a/tld_serv_list
+++ b/tld_serv_list
@@ -1,6 +1,7 @@
# NIC? means I have not been able to find the registry
# UPR means the TLD is managed by UPR, but I could not find any info
#
+
.br.com whois.centralnic.net
.cn.com whois.centralnic.net
.de.com whois.centralnic.net
@@ -18,21 +19,28 @@
.uk.net whois.centralnic.net
.us.com whois.centralnic.net
.uy.com whois.centralnic.net
-.za.net whois.centralnic.net
.za.com whois.centralnic.net
.jpn.com whois.centralnic.net
.web.com whois.centralnic.net
-.eu.org whois.eu.org
+
.com CRSNIC
+
+.za.net whois.za.net
.net CRSNIC
+
+.eu.org whois.eu.org
+.za.org whois.za.org
.org PIR
+
.edu whois.educause.net
.gov whois.nic.gov
.int whois.iana.org
.mil NONE
-.aero whois.information.aero
+
e164.arpa whois.ripe.net
.arpa whois.iana.org
+
+.aero whois.information.aero
.biz whois.nic.biz
.cat whois.cat
.coop whois.nic.coop
@@ -43,6 +51,7 @@ e164.arpa whois.ripe.net
.name whois.nic.name
.pro whois.registrypro.pro
.travel whois.nic.travel
+
.ac whois.nic.ac
.ad NONE # www.nic.ad
.ae whois.uaenic.ae
@@ -308,6 +317,7 @@ e164.arpa whois.ripe.net
.za NONE # http://www.internet.org.za/slds.html many more SLD...
.zm NONE # NIC? http://www.zamnet.zm/
.zw NONE # http://www.zispa.co.zw/
+
-dom whois.networksolutions.com
-org whois.networksolutions.com
-hst whois.networksolutions.com
diff --git a/whois.c b/whois.c
index 9da2932..235f179 100644
--- a/whois.c
+++ b/whois.c
@@ -355,7 +355,7 @@ const char *match_config_file(const char *s)
*/
const char *whichwhois(const char *s)
{
- unsigned long ip;
+ unsigned long ip, as32;
unsigned int i;
char *colon;
@@ -393,9 +393,6 @@ const char *whichwhois(const char *s)
/* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
if (!strpbrk(s, ".-")) {
- const char *p;
-
- for (p = s; *p; p++); /* go to the end of s */
if (strncasecmp(s, "as", 2) == 0 && /* it's an AS */
(isasciidigit(s[2]) || s[2] == ' '))
return whereas(atoi(s + 2));
@@ -405,6 +402,11 @@ const char *whichwhois(const char *s)
return "\x05"; /* probably a unknown kind of nic handle */
}
+ /* ASN32? */
+ if (strncasecmp(s, "as", 2) == 0 && s[2] &&
+ (as32 = asn32_to_long(s + 2)) != 0)
+ return whereas32(as32);
+
/* smells like an IP? */
if ((ip = myinet_aton(s))) {
for (i = 0; ip_assign[i].serv; i++)
@@ -433,6 +435,16 @@ const char *whichwhois(const char *s)
return "\x05";
}
+const char *whereas32(const unsigned long asn)
+{
+ int i;
+
+ for (i = 0; as32_assign[i].serv; i++)
+ if (asn >= as32_assign[i].first && asn <= as32_assign[i].last)
+ return as32_assign[i].serv;
+ return "\x06";
+}
+
const char *whereas(const unsigned short asn)
{
int i;
@@ -895,17 +907,33 @@ char *convert_teredo(const char *s)
unsigned long myinet_aton(const char *s)
{
unsigned long a, b, c, d;
+ int elements;
char junk;
if (!s)
return 0;
- if (sscanf(s, "%lu.%lu.%lu.%lu%c", &a, &b, &c, &d, &junk) != 4)
+ elements = sscanf(s, "%lu.%lu.%lu.%lu%c", &a, &b, &c, &d, &junk);
+ if (!(elements == 4 || (elements == 5 && junk == '/')))
return 0;
if (a > 255 || b > 255 || c > 255 || d > 255)
return 0;
return (a << 24) + (b << 16) + (c << 8) + d;
}
+unsigned long asn32_to_long(const char *s)
+{
+ unsigned long a, b;
+ char junk;
+
+ if (!s)
+ return 0;
+ if (sscanf(s, "%lu.%lu%c", &a, &b, &junk) != 2)
+ return 0;
+ if (a > 65535 || b > 65535)
+ return 0;
+ return (a << 16) + b;
+}
+
int isasciidigit(const char c) {
return (c >= '0' && c <= '9') ? 1 : 0;
}
diff --git a/whois.h b/whois.h
index 7fe800b..64b1cec 100644
--- a/whois.h
+++ b/whois.h
@@ -12,6 +12,7 @@
const char *whichwhois(const char *);
const char *match_config_file(const char *);
const char *whereas(const unsigned short);
+const char *whereas32(const unsigned long);
char *queryformat(const char *, const char *, const char *);
int hide_line(int *hiding, const char *const line);
const char *do_query(const int, const char *);
@@ -22,6 +23,7 @@ void usage(void);
void alarm_handler(int);
void sighandler(int);
unsigned long myinet_aton(const char *);
+unsigned long asn32_to_long(const char *);
int isasciidigit(const char);
int domcmp(const char *, const char *);
int domfind(const char *, const char *[]);
diff --git a/whois.spec b/whois.spec
index a2f1713..4fca3f5 100644
--- a/whois.spec
+++ b/whois.spec
@@ -1,6 +1,6 @@
Summary: Enhanced WHOIS client
Name: whois
-Version: 4.7.22
+Version: 4.7.23
Release: 1
License: GPL
Vendor: Marco d'Itri <md@linux.it>