diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | TODO | 13 | ||||
-rw-r--r-- | as_del_list | 4 | ||||
-rw-r--r-- | config.h | 13 | ||||
-rw-r--r-- | data.h | 50 | ||||
-rw-r--r-- | debian/changelog | 123 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | ip_del_list | 5 | ||||
-rwxr-xr-x | make_tld_serv.pl | 8 | ||||
-rw-r--r-- | mkpasswd.1 | 2 | ||||
-rw-r--r-- | mkpasswd.c | 2 | ||||
-rw-r--r-- | po/Makefile | 2 | ||||
-rw-r--r-- | po/it.po | 88 | ||||
-rw-r--r-- | po/no.po | 162 | ||||
-rw-r--r-- | tld_serv_list | 267 | ||||
-rw-r--r-- | whois.1 | 113 | ||||
-rw-r--r-- | whois.c | 257 | ||||
-rw-r--r-- | whois.h | 14 |
19 files changed, 847 insertions, 299 deletions
@@ -5,6 +5,9 @@ OPTS=-O2 # Solaris #LDFLAGS=-lnsl -lsocket +# linux (old libc) +#LDFLAGS=-lintl + all: whois #pos whois: whois.c whois.h config.h data.h as_del.h ip_del.h tld_serv.h @@ -23,8 +26,9 @@ tld_serv.h: tld_serv_list make_tld_serv.pl perl make_tld_serv.pl < tld_serv_list > tld_serv.h install: whois - install --strip -m 0755 whois $(BASEDIR)$(prefix)/bin/ - install --strip -m 0644 whois.1 $(BASEDIR)$(prefix)/man/man1/ + install -m 0755 whois $(BASEDIR)$(prefix)/bin/ + strip $(BASEDIR)$(prefix)/bin/whois + install -m 0644 whois.1 $(BASEDIR)$(prefix)/man/man1/ cd po && $(MAKE) $@ @@ -1,16 +1,11 @@ -Why another whois client? Because the ripe client is a mess of hacks and +Why another whois client? Because the RIPE client is a mess of hacks and #ifdefs and more complex programs lack features or are bloated. -Notes on the data files: +Notes about the data files: - domain names MUST be lowercase and MUST begin with "." or "-". - first match wins (for both domains and netblocks) - elements in tld_serv_list are matched against the end of the query - -Delegation data has been gathered by me. -TLD whois data has been borrowed from various sources, mostly the whois -proxy at www.geektools.org and the awhois script by Greg Woods. - Please send me any information you have regarding domains and netblocks not correctly handled by the program. @@ -28,6 +23,8 @@ Other information sources: - home of the 6bone client: http://www.ip.qwest.net/~david/software/ - http://www.apnic.net/db/RIRs.html and http://www.apnic.net/maps/tld-list.html +- http://www.uninett.no/navn/domreg.html +- http://www.iahc.org/dns-refs/registry.html Marco d'Itri <md@linux.it> @@ -1,7 +1,18 @@ Still to sort: -*NETBLK-RIPE* *NET-RIPE* *APNIC* *AUNIC-AU* [a-z][a-z][0-9][0-9][0-9]jp +*NETBLK-RIPE* *NET-RIPE* *APNIC* *AUNIC-AU* Is MNT-* a standard of some registry? What about rwhois? +Should support the refer attribute of RIPE-189 objects. + +I need a procedure for searching an IPv6 address in a list. +Will anybody contribute it? + +Can ARIN netblock names have a dash? + +Should "=" be prepended by default when an NSI-style NIC handle is detected? + +Add Exodus rwhois server (e.g. 216.35.0.0/16). + diff --git a/as_del_list b/as_del_list index c7d865a..2156dfa 100644 --- a/as_del_list +++ b/as_del_list @@ -1,15 +1,17 @@ 1877 1901 ripe 2043 2043 ripe 2047 2047 ripe -2107 2136 ripe +2057 2136 ripe 2585 2614 ripe 2773 2822 ripe 2830 2879 ripe 3154 3353 ripe 4608 4863 apnic 5377 5631 ripe +5800 5927 whois.nic.mil 6656 6911 ripe 7467 7722 apnic 8192 9215 ripe 9261 10239 apnic 12288 13311 ripe +15360 16383 ripe @@ -1,14 +1,17 @@ +/* Program version */ +#define VERSION "4.4.13" + /* Configurable features */ /* 6bone referto: support */ #define EXT_6BONE -/* Suppress lame Internic disclaimer */ +/* Suppress lame NSI disclaimer */ #define HIDE_DISCL -/* Program version */ -#define VERSION "4.4.1" +/* Always ask INTERNIC about gTLDs */ +#define FIRST_ASK_INTERNIC -/* String sent to RIPE servers - ONLY FIVE CHARACTERS! */ -#define IDSTRING "Md4.4" +/* Default server */ +#define DEFAULTSERVER "whois.internic.net" @@ -1,24 +1,38 @@ /* * RIPE-like servers. * All of them do not understand -V2.0Md with the exception of RA and RIPN. - * 6bone-like servers will accept the flag with a warning (the flag must + * 6bone-derived servers will accept the flag with a warning (the flag must * match /^V [a-zA-Z]{1,4}\d+[\d\.]{0,5}$/). */ + +/* servers which accept the new syntax (-V XXn.n) */ const char *ripe_servers[] = { - /* will accept the new syntax (-V wp3.0) */ "whois.ripe.net", "whois.apnic.net", + "whois.oleane.net", + "rr.arin.net", /* does not accept the old syntax */ "whois.6bone.net", /* 3.0.0b1 */ "whois.aunic.net", "whois.connect.com.au", /* 3.0.0b1 */ "whois.nic.fr", + "whois.telstra.net", "whois.nic.net.sg", "whois.metu.edu.tr", - /* end of servers accepting new syntax */ + "whois.restena.lu", + "rr.level3.net", /* 3.0.0a13 */ + "whois.arnes.si", + NULL +}; + +/* servers which do not accept the new syntax */ +const char *ripe_servers_old[] = { + "whois.ra.net", "whois.nic.it", "whois.ans.net", - "whois.ra.net", + "whois.cw.net", "whois.ripn.net", + "whois.nic.ck", + "whois.domain.kg", NULL }; @@ -40,11 +54,29 @@ const char *gtlds[] = { NULL }; -const char *arin_nets[] = { - "net-", - "netblk-", - "asn-", - NULL, +#ifdef HIDE_DISCL +const char *hide_strings[] = { + "The Data in Network", "this query", + "The data in Register", "By submitting", + "The data contained in Dotster", "to these terms of usage and", + "This whois service currently only", "top-level domains.", + "Signature Domains' Whois Service", "agree to abide by the above", + "Access to ASNIC", "by this policy.", + "* Copyright (C) 1998 by SGNIC", "* modification.", + NULL, NULL +}; +#endif + +const char *nic_handles[] = { + "net-", "whois.arin.net", + "netblk-", "whois.arin.net", + "asn-", "whois.arin.net", + "as-", "whois.ripe.net", + "lim-", "whois.ripe.net", + "coco-", "whois.corenic.net", + "coho-", "whois.corenic.net", + "core-", "whois.corenic.net", + NULL, NULL }; struct ip_del { diff --git a/debian/changelog b/debian/changelog index d7d1f6c..83c6ed5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,123 @@ +whois (4.4.14) frozen unstable; urgency=medium + + * !=> HIDE_DISCL has been disabled (VERY IMPORTANT!). + * !=> Fixed -h option for gTLDs (Closes: 65001). + * !=> Priority changed from important to standard (Closes: #64460). + * !=> Added server for net.au (Closes: #64574). + * Fixed longstanding bug in RIPE-style referrals handling. + * Added telstra netblocks, NIC handles and whois server. + * Added fed.us domain. + * Added nic.mil AS block. + * Added production IPv6 TLA. + + -- Marco d'Itri <md@linux.it> Sun, 4 Jun 2000 20:00:20 +0200 + +whois (4.4.13) frozen unstable; urgency=high + + * Fixed .dk and .nl servers (IMPORTANT!). + * Added many, many domains in tld_serv_list. + * A message is displayed if only a WWW gateway is available. + + -- Marco d'Itri <md@linux.it> Fri, 21 Apr 2000 17:59:19 +0200 + +whois (4.4.12) frozen unstable; urgency=medium + + * Fixed queries for *.jp domains (Closes: #60861). + * Will hide disclaimers of many registries. + * Added support for level3.net registry. + + -- Marco d'Itri <md@linux.it> Sat, 25 Mar 2000 11:51:01 +0100 + +whois (4.4.11) frozen unstable; urgency=low + + * Enlarged a buffer. This bug silently corrupted queries for some CORE + objects (Closes: #60612). + + -- Marco d'Itri <md@linux.it> Fri, 17 Mar 2000 23:33:38 +0100 + +whois (4.4.10) frozen unstable; urgency=low + + * RIPE-like flags are allowed for CORENIC too. + + -- Marco d'Itri <md@linux.it> Fri, 17 Mar 2000 23:30:46 +0100 + +whois (4.4.9) frozen unstable; urgency=low + + * Fixed segfault when requesting a RIPE template (Closes: #59030). + + -- Marco d'Itri <md@linux.it> Sat, 26 Feb 2000 14:53:32 +0100 + +whois (4.4.8) frozen unstable; urgency=low + + * Fixed two off-by-one in mallocs and a buffer overflow. + * Fixed ugly bug in parsing of multi argument command lines. + * Fixed domcmp() to deal with -au-dom, .uk.net and so on. + * Added support for corenic and GANDI handles. + * Now automatically request machine parseable output from corenic. + * rr.arin.net added to the list of RIPE-like servers. + + -- Marco d'Itri <md@linux.it> Wed, 23 Feb 2000 19:50:50 +0100 + +whois (4.4.7) frozen unstable; urgency=low + + * Updated .no ccTLD entry. + * Added RIPE as default server for limerick objects. + * Fixed $LANG parsing. + * Fixed false positive for netblock handles matching /^as/ and + another bug regarding parsing of AS queries. + (Dark, please allow this upload to go in frozen because users will + be bitten by these bug and will not understand what's happening.) + + -- Marco d'Itri <md@linux.it> Sun, 16 Jan 2000 14:45:00 +0100 + +whois (4.4.6) unstable; urgency=low + + * Fixed bug in parsing the argument of -h. + * Added new ccTLDs: cl, kg, lu. + * Added AS-* netblocks. I assume only RIPE uses this format. + * Some additions to ripe_servers[]. + + -- Marco d'Itri <md@linux.it> Thu, 13 Jan 2000 01:16:51 +0100 + +whois (4.4.5) unstable; urgency=low + + * The InterNIC server is always asked to return complete records when a + query matches more than one object. + * s/CRSNIC/InterNIC/. Oh, how much I hate NSI! + * Added support for *jp NIC handles and *-MNT RIPE handles. + * Norwegian translation. + + -- Marco d'Itri <md@linux.it> Sat, 18 Dec 1999 21:00:36 +0100 + +whois (4.4.4) unstable; urgency=low + + * The default server is read from $WHOIS_SERVER. + + -- Marco d'Itri <md@linux.it> Sun, 5 Dec 1999 11:36:52 +0100 + +whois (4.4.3) unstable; urgency=low + + * s/whois.internic.net/whois.networksolutions.com/ + * Added Oleane to ripe_servers[]. + + -- Marco d'Itri <md@linux.it> Thu, 2 Dec 1999 21:50:59 +0100 + +whois (4.4.2) unstable; urgency=low + + * Fixed the test for the use of RIPE-style options with non RIPE-like + servers. + * Cleanup of man page source. + * Fixed mkpasswd(1) header (closes: #51401). + + -- Marco d'Itri <md@linux.it> Sun, 28 Nov 1999 12:51:25 +0100 + whois (4.4.1) unstable; urgency=low - * A space is added after "AS" when querying ARIN. * Converted some strcmp to strcasecmp. + * A space is added after "AS" when querying ARIN. + * The "domain" command keyword is added by default when querying ERNET. - -- Marco d'Itri <md@linux.it> Mon, 15 Nov 1999 00:59:07 +0100 + -- Marco d'Itri <md@linux.it> Tue, 16 Nov 1999 11:57:55 +0100 whois (4.4.0) unstable; urgency=low @@ -58,8 +172,3 @@ whois (4.0) unstable; urgency=low * cryptpw become mkpasswd and now has a man page (closes: #46855). -- Marco d'Itri <md@linux.it> Sun, 3 Oct 1999 19:43:35 +0200 - -Local variables: -mode: debian-changelog -add-log-mailing-address: "md@linux.it" -End: diff --git a/debian/control b/debian/control index c991cf7..55605c8 100644 --- a/debian/control +++ b/debian/control @@ -1,8 +1,8 @@ Source: whois Section: net -Priority: important +Priority: standard Maintainer: Marco d'Itri <md@linux.it> -Standards-Version: 3.0.1 +Standards-Version: 3.1.0.0 Package: whois Architecture: any diff --git a/ip_del_list b/ip_del_list index 8b87882..89526d3 100644 --- a/ip_del_list +++ b/ip_del_list @@ -2,8 +2,9 @@ 24.132.0.0/14 ripe 61.0.0.0/8 apnic 62.0.0.0/8 ripe +63.208.0.0/13 rr.level3.net 0.0.0.0/2 arin # all other A classes are managed by ARIN -## The B class space is a mess :-( - something could be still missing +## The B class space is a mess :-( - something could still be missing 139.20.0.0/14 ripe 139.24.0.0/14 ripe 139.28.0.0/15 ripe @@ -62,6 +63,7 @@ 198.17.117.0/24 ripe 196.0.0.0/6 arin 200.0.0.0/7 arin +203.0.0.0/10 aunic 202.0.0.0/7 apnic 204.0.0.0/6 arin 208.0.0.0/7 arin @@ -69,4 +71,3 @@ 212.0.0.0/7 ripe 214.0.0.0/7 arin # DoD 216.0.0.0/8 arin -## Are class D networks listed somewhere? diff --git a/make_tld_serv.pl b/make_tld_serv.pl index 8c37060..d2735d6 100755 --- a/make_tld_serv.pl +++ b/make_tld_serv.pl @@ -7,7 +7,11 @@ while (<>) { s/^\s*(.*)\s*$/$1/; s/\s*#.*$//; next if /^$/; - die "format error: $_" unless (/^([\w\d\.-]+)\s+([\w\d\.:-]+)$/); - print " \"$1\",\t\"$2\",\n"; + die "format error: $_" unless + (my ($a, $b) = /^([\w\d\.-]+)\s+([\w\d\.:-]+|[A-Z]+\s+.*)$/); + $b =~ s/^W(?:EB)?\s+/\\001/; + $b =~ s/^M(?:SG)?\s+/\\002/; + $b = "\\003" if ($b eq 'NONE'); + print " \"$a\",\t\"$b\",\n"; } @@ -1,4 +1,4 @@ -.TH WHOIS 1 "7 October 1999" "Marco d'Itri" "Debian GNU/Linux" +.TH MKPASSWD 1 "7 October 1999" "Marco d'Itri" "Debian GNU/Linux" .SH NAME mkpasswd \- Very dumb front end to crypt(3) .SH SYNOPSIS @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) puts("Usage: mkpasswd PASSWORD SALT\n"); exit(1); } - printf("%s", crypt(argv[1], argv[2])); + printf("%s\n", crypt(argv[1], argv[2])); exit(0); } diff --git a/po/Makefile b/po/Makefile index b903022..34be5e0 100644 --- a/po/Makefile +++ b/po/Makefile @@ -3,7 +3,7 @@ INSTALLNLSDIR=$(BASEDIR)/usr/share/locale PACKAGE = whois -CATALOGS = it.mo +CATALOGS = it.mo no.mo POTFILES=../whois.c @@ -1,11 +1,11 @@ # Traduzione di whois.pot. -# Copyright (C) 1999 Marco d'Itri -# Marco d'Itri <md@linux.it>, 1999. +# Copyright (C) 1999-2000 Marco d'Itri +# Marco d'Itri <md@linux.it>, 2000. # msgid "" msgstr "" -"Project-Id-Version: whois 4.4.0\n" -"POT-Creation-Date: 1999-11-09 22:15+0100\n" +"Project-Id-Version: whois 4.4.13\n" +"POT-Creation-Date: 2000-05-03 01:25+0200\n" "PO-Revision-Date: 1999-10-26 12:19+02:00\n" "Last-Translator: Marco d'Itri <md@linux.it>\n" "Language-Team: Italian <it@li.org>\n" @@ -13,32 +13,42 @@ msgstr "" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -#: ../whois.c:93 -msgid "Connecting to whois.crsnic.net.\n" -msgstr "Mi sto connettendo a whois.crsnic.net.\n" +#: ../whois.c:108 +msgid "Connecting to whois.internic.net." +msgstr "Mi sto connettendo a whois.internic.net." -#: ../whois.c:97 +#: ../whois.c:114 #, c-format msgid "" "\n" -"Detected CRSNIC referral to %s.\n" +"Found InterNIC referral to %s.\n" "\n" msgstr "" "\n" -"Trovato un riferimento di CRSNIC a %s.\n" +"Trovato un riferimento di InterNIC a %s.\n" "\n" -#: ../whois.c:105 +#: ../whois.c:122 #, c-format msgid "Using default server %s.\n" msgstr "Uso il server predefinito %s.\n" -#: ../whois.c:107 +#: ../whois.c:124 +msgid "" +"This domain has no whois server, but you can access the whois database at" +msgstr "" +"Questo dominio non ha un server whois, ma si può accedere al database tramite" + +#: ../whois.c:132 +msgid "This domain has no whois server." +msgstr "Per questo dominio non esiste un server whois." + +#: ../whois.c:135 #, c-format msgid "Using server %s.\n" msgstr "Uso il server %s.\n" -#: ../whois.c:112 +#: ../whois.c:140 #, c-format msgid "" "Query string: \"%s\"\n" @@ -47,67 +57,68 @@ msgstr "" "Richiesta: \"%s\"\n" "\n" -#: ../whois.c:153 +#: ../whois.c:188 msgid "" "I don't know where this IP has been delegated.\n" -"I'll try ARIN and hope for the best...\n" +"I'll try ARIN and hope for the best..." msgstr "" "Non so a chi è stato delegato questo IP.\n" -"Proverò con ARIN sperando per il meglio...\n" +"Proverò con ARIN sperando per il meglio..." -#: ../whois.c:170 -msgid "I guess it's a netblock name but I don't know where to look it up.\n" -msgstr "Credo che sia il nome di un netblock ma non so dove cercarlo.\n" +#: ../whois.c:206 +msgid "I guess it's a netblock name but I don't know where to look it up." +msgstr "Credo che sia il nome di un netblock ma non so dove cercarlo." -#: ../whois.c:177 -msgid "I guess it's a domain but I don't know where to look it up.\n" -msgstr "Credo che sia un dominio ma non so dove cercarlo.\n" +#: ../whois.c:213 +msgid "I guess it's a domain but I don't know where to look it up." +msgstr "Credo che sia un dominio ma non so dove cercarlo." -#: ../whois.c:188 +#: ../whois.c:223 msgid "Unknown AS number. Please upgrade this program." -msgstr "" +msgstr "Numero dell'AS sconosciuto. Per favore aggiorna il programma." -#: ../whois.c:211 +#: ../whois.c:253 msgid "Warning: RIPE flags ignored for a traditional server." -msgstr "" +msgstr "Attenzione: i flag RIPE sono ignorati dai server tradizionali." -#: ../whois.c:254 +#: ../whois.c:317 #, c-format msgid "Detected referral to %s on %s.\n" msgstr "Trovato un riferimento a %s su %s.\n" -#: ../whois.c:267 +#: ../whois.c:333 msgid "" -"Catastrophic error: INTERNIC changed the disclaimer text.\n" +"Catastrophic error: disclaimer text has been changed.\n" "Please upgrade this program.\n" msgstr "" -"Errore catastrofico: INTERNIC ha cambiato il testo di avvertenze.\n" +"Errore catastrofico: il testo di avvertenze è cambiato.\n" "Aggiorna questo programma.\n" -#: ../whois.c:335 +#: ../whois.c:405 #, c-format msgid "Host %s not found." msgstr "Host %s non trovato." -#: ../whois.c:344 +#: ../whois.c:415 #, c-format msgid "%s/tcp: unknown service" msgstr "%s/tcp: servizio sconosciuto" -#: ../whois.c:361 +#: ../whois.c:432 #, c-format msgid "Interrupted by signal %d..." msgstr "Interrotto dal segnale %d..." -#: ../whois.c:403 +#: ../whois.c:475 +#, c-format msgid "" "Usage: whois [OPTION]... OBJECT...\n" "\n" "-a search all databases\n" -"-C first query CRSNIC to find GTLD registrar\n" "-F fast raw output (implies -r)\n" "-g SOURCE:FIRST-LAST find updates from SOURCE from serial FIRST to LAST\n" "-h HOST connect to server HOST\n" +"-H hide legal disclaimers\n" "-i ATTR[,ATTR]... do an inverse lookup for specified ATTRibutes\n" "-L find all Less specific matches\n" "-M find all More specific matches\n" @@ -124,16 +135,15 @@ msgid "" "-v TYPE requests verbose template for object of TYPE\n" "-V explain what is being done\n" "\n" -"Version " +"Version %s. Please report bugs to %s.\n" msgstr "" "Uso: whois [OPZIONE]... OGGETTO...\n" "\n" "-a cerca tutti i database\n" -"-C interroga prima CRSNIC per trovare il registro di " -"GTLD\n" "-F output grezzo veloce (implica -r)\n" "-g SOURCE:FIRST-LAST trova gli aggiornamenti di SOURCE dal seriale F a L\n" "-h HOST si connette al server HOST\n" +"-H nasconde le avvertenze legali\n" "-i ATTR[,ATTR]... fa una ricerca inversa per l'ATTRibuto specificato\n" "-L trova le corrispondenze meno specifiche\n" "-M trova le corrispondenze più specifiche\n" @@ -151,4 +161,4 @@ msgstr "" "-v TIPO chiede il template prolisso per un oggetto del TIPO\n" "-V spiega cosa sta facendo\n" "\n" -"Versione " +"Versione %s. Segnala i bug a %s.\n" diff --git a/po/no.po b/po/no.po new file mode 100644 index 0000000..0b7ac35 --- /dev/null +++ b/po/no.po @@ -0,0 +1,162 @@ +# Oversatt fra whois.pot. +# Egil Kvaleberg <egil@kvaleberg.no>, 1999. +# +# BUG: xxx +# +msgid "" +msgstr "" +"Project-Id-Version: whois 4.4.5\n" +"POT-Creation-Date: 2000-05-03 01:25+0200\n" +"PO-Revision-Date: 1999-12-18 14:00:00\n" +"Last-Translator: Egil Kvaleberg <egil@kvaleberg.no>\n" +"Language-Team: Norwegian <no@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../whois.c:108 +msgid "Connecting to whois.internic.net." +msgstr "Kobler opp mot whois.internic.net." + +#: ../whois.c:114 +#, c-format +msgid "" +"\n" +"Found InterNIC referral to %s.\n" +"\n" +msgstr "" +"\n" +"Fant InterNIC-referanse til %s.\n" +"\n" + +#: ../whois.c:122 +#, c-format +msgid "Using default server %s.\n" +msgstr "Bruker standardtjener %s.\n" + +#: ../whois.c:124 +msgid "" +"This domain has no whois server, but you can access the whois database at" +msgstr "" + +#: ../whois.c:132 +msgid "This domain has no whois server." +msgstr "" + +#: ../whois.c:135 +#, c-format +msgid "Using server %s.\n" +msgstr "Bruker tjener %s.\n" + +#: ../whois.c:140 +#, c-format +msgid "" +"Query string: \"%s\"\n" +"\n" +msgstr "" +"Forespørsel: \"%s\"\n" +"\n" + +#: ../whois.c:188 +msgid "" +"I don't know where this IP has been delegated.\n" +"I'll try ARIN and hope for the best..." +msgstr "" +"Vet ikke hvor denne IP-adressen har blitt delegert.\n" +"Prøver ARIN og håper det beste..." + +#: ../whois.c:206 +msgid "I guess it's a netblock name but I don't know where to look it up." +msgstr "Gjetter at det er et netblock-navn, men vet ikke hvor det finnes." + +#: ../whois.c:213 +msgid "I guess it's a domain but I don't know where to look it up." +msgstr "Gjetter at det er er domene, men vet ikke hvor det finnes." + +#: ../whois.c:223 +msgid "Unknown AS number. Please upgrade this program." +msgstr "Ukjent AS-nummer. Vennligst oppdater programmet." + +#: ../whois.c:253 +msgid "Warning: RIPE flags ignored for a traditional server." +msgstr "Merk: RIPE-flaggene ignoreres for en tradisjonell tjener." + +#: ../whois.c:317 +#, c-format +msgid "Detected referral to %s on %s.\n" +msgstr "Referanse til %s vedrørende %s.\n" + +#: ../whois.c:333 +#, fuzzy +msgid "" +"Catastrophic error: disclaimer text has been changed.\n" +"Please upgrade this program.\n" +msgstr "" +"Alvorlig feil: INTERNIC har endret standardtekst.\n" +"Vennligst oppdater programmet.\n" + +#: ../whois.c:405 +#, c-format +msgid "Host %s not found." +msgstr "Finner ikke verten %s." + +#: ../whois.c:415 +#, c-format +msgid "%s/tcp: unknown service" +msgstr "%s/tcp: ukjent port" + +#: ../whois.c:432 +#, c-format +msgid "Interrupted by signal %d..." +msgstr "Avbrudt av signal %d..." + +#: ../whois.c:475 +#, c-format +msgid "" +"Usage: whois [OPTION]... OBJECT...\n" +"\n" +"-a search all databases\n" +"-F fast raw output (implies -r)\n" +"-g SOURCE:FIRST-LAST find updates from SOURCE from serial FIRST to LAST\n" +"-h HOST connect to server HOST\n" +"-i ATTR[,ATTR]... do an inverse lookup for specified ATTRibutes\n" +"-L find all Less specific matches\n" +"-M find all More specific matches\n" +"-m find first level more specific matches\n" +"-r turn off recursive lookups\n" +"-p PORT connect to PORT\n" +"-R force to show local copy of the domain object even\n" +" if it contains referral\n" +"-S tell server to leave out syntactic sugar\n" +"-s SOURCE[,SOURCE]... search the database from SOURCE\n" +"-T TYPE[,TYPE]... only look for objects of TYPE\n" +"-t TYPE requests template for object of TYPE ('all' for a " +"list)\n" +"-v TYPE requests verbose template for object of TYPE\n" +"-V explain what is being done\n" +"\n" +"Version %s. Please report bugs to %s.\n" +msgstr "" +"Bruk: whois [OPSJONER]... OBJEKTER...\n" +"\n" +"-a søk i alle databaser\n" +"-F full utskrift (impliserer -r)\n" +"-g KILDE:FØRSTE-SISTE finn oppdateringer fra KILDE fra serie FØRSTE til " +"SISTE\n" +"-h VERT koble til tjener VERT\n" +"-i ATTR[,ATTR]... gjør reversoppslag for attributtene ATTR\n" +"-L finn alle mindre spesifike treff\n" +"-M finn alle mer spesifike treff\n" +"-m finn første nivå av mer spesifike treff\n" +"-r ikke foreta rekursive oppslag\n" +"-p PORT koble til PORT\n" +"-R vis lokal kopi av objektet selv om det inneholder\n" +" en referanse\n" +"-S be tjeneren utelate syntaktisk \"sukker\"\n" +"-s KILDE[,KILDE]... søk i databasen fra KILDE\n" +"-T TYPE[,TYPE]... se bare på objekttype TYPE\n" +"-t TYPE be om mal for objekttype TYPE ('all' gir en liste)\n" +"-v TYPE be om utførlig mal for objekttype TYPE\n" +"-V forklarer hva som skjer\n" +"\n" +"Versjon %s. Rapporter feil til %s.\n" diff --git a/tld_serv_list b/tld_serv_list index a83a91e..7b238c0 100644 --- a/tld_serv_list +++ b/tld_serv_list @@ -1,140 +1,291 @@ -# Servers in lines with a trailing hash mark have been tested and found -# not working at the time of my survey (19991109). -# Servers with the comment "wrong" have been tested as well but are wrong. +# NIC? means I have not been able to find the registry +# NIC-FR means the TLD is managed by AFNIC, but I could not find any info +# UPR means the TLD is managed by UPR, but I could not find any info +######## means I haven't checked yet this TLD +# .gb.com whois.nomination.net .gb.net whois.nomination.net +.uk.com whois.nomination.net .uk.net whois.nomination.net -.uk.net whois.nomination.net -.com whois.internic.net -.net whois.internic.net -.org whois.internic.net -.edu whois.internic.net +.se.com whois.centralnic.com +.se.net whois.centralnic.com +#.com whois.networksolutions.com +#.net whois.networksolutions.com +#.org whois.networksolutions.com +#.edu whois.networksolutions.com .gov whois.nic.gov .int whois.isi.edu .mil whois.nic.mil .ac whois.nic.ac -.ad whois.ripe.net -.af whois.nic.tm -#.al whois.ripe.net #wrong -.am whois.amnic.net +.ad NONE # http://www.nic.ad +.ae WEB http://cc.emirates.net.ae/Customer_care/cc_card/check_domains.choose_domains/ +.af whois.nic.af +.ag WEB http://www.nic.ag/domain_search.htm +.ai NONE # http://www.offshore.com.ai/domain_names/ +.al NONE # http://www.inima.al/Domains.html +.am whois.amnic.net # down? +.am WEB http://www.amnic.net/cgi/engine/db/whois.html +#.an # NIC? +#.ao NONE # NIC? diee.fe.uan.ao +.aq NONE # 2day.com +.ar WEB http://www.nic.ar/consultas/consdom.htm .as whois.nic.as -.at whois.univie.ac.at # CNAME whois.ripe.net -#.net.au whois.connect.com.au # obsolete? +.at whois.ripe.net +.net.au whois.connect.com.au .au whois.aunic.net -#.az whois.ripe.net #wrong -.ba whois.ripe.net +#.aw # NIC? www.setarnet.aw +#.az NONE # NIC? http://www.az/ www.domain.az +.ba NONE # http://www.utic.net.ba +.bb WEB http://domains.org.bb/regsearch/ +#.bd .be whois.ripe.net +.bf NONE # http://www.onatel.bf/domaine.htm .bg whois.ripe.net +#.bh NONE # NIC? http://www.batelco.com.bh +.bi WEB http://www.nic.cd/database/bi/ +#.bj # NIC? www.opt.bj #.bm rwhois.ibl.bm:4321 +.bm NONE # http://www.bermudanic.bm +#.bn NONE # NIC? http://jtb.brunet.bn/brunet/brunet.htm +.bo WEB http://www.nic.bo/listadom.phtml .br whois.nic.br +#.bs # NIC? (UPR) .bt whois.nic.tm -#.by whois.ripe.net #wrong +.bv NONE # http://www.uninett.no/navn/bv-sj.html +#.bw # NIC? www.botsnet.bw +#.by NONE # NIC? http://unibel.by www.open.by +.bz NONE # http://www.psg.com/dns/bz/ .ca whois.cdnnet.ca .cc whois.nic.cc +.cd WEB http://www.nic.cd/database/cd/ +#.cf NONE # NIC? http://www.socatel.intnet.cf +.cg WEB http://www.nic.cd/database/cg/ .ch whois.nic.ch -.ck whois.ck-nic.org.ck +.ci NONE # www.nic.ci +.ck whois.nic.ck +.cl whois.nic.cl +.cm NONE # http://info.intelcam.cm .ac.cn whois.cnc.ac.cn .cn whois.cnnic.net.cn .uk.co whois.uk.co -#.co whois.ripe.net #wrong -#.cx whois.nic.cx # +.co WEB http://daimon.uniandes.edu.co:8890/dominio/plsql/PConsulta.ConsultarDominio +.cr WEB http://www.nic.cr/consulta-dns.html +.cu WEB http://www.nic.cu/consultas/consult.html +#.cv # NIC? +.cx whois.nic.cx .cy whois.ripe.net .cz whois.ripe.net .de whois.ripe.net -.dk whois.ripe.net -#.dz whois.ripe.net #wrong -#.ee whois.ripe.net #wrong -#.eg whois.ripe.net #wrong -.es whois.ripe.net -#.fi whois.ripe.net #wrong +#.dj NONE # NIC? http://www.intnet.dj +.dk whois.dk-hostmaster.dk +#.dm # NIC? (UPR) +.do WEB http://www.nic.do +.dz NONE +.ec WEB http://www.nic.ec +.ee NONE # http://www.eenet.ee/services/subdomains.html +#.eg NONE # NIC? http://www.frcu.eun.eg +#.eh +#.er NONE # do they have internet there? +.es WEB http://www.nic.es/whois/ +#.et NONE # NIC? http://www.telecom.net.et +.fi WEB http://cgi.thk.fi/cgi-bin/domains.pl?language=eng +.fj whois.usp.ac.fj +.fk NONE # http://www.fidc.org.fk/domain-registration/home.htm +.fm WEB http://www.nic.fm/register.html .fo whois.ripe.net .fr whois.nic.fr -#.ga whois.ripe.net #wrong -#.gb whois.ripe.net #wrong -#.ge whois.ripe.net #wrong -#.gf whois.nplus.gf # -#.gi whois.nic.gi # +#.ga ######### www.inet.ga #broken +.gb NONE +#.gd # NIC? (UPR) +.ge WEB http://www.nic.net.ge +.gf whois.nplus.gf +.gg NONE # http://www.isles.net +.gh NONE # http://www.ghana.com/domreg.html +.gi NONE # http://www.gibnet.gi/nic/ .gl whois.ripe.net .gm whois.ripe.net -.gr whois.ripe.net +.gn NONE # http://www.psg.com/dns/gn/ +#.gp ######### http://www.nic.gp broken like mq +#.gq # NIC? http://www.getesa.gq +.gr whois.ripe.net # http://www.hostmaster.gr .gs whois.adamsnames.tc +#.gt ######### http://www.gt/cir/cir.htm # NIC? - broken URL +.gu WEB http://gadao.gov.gu/Scripts/wwsquery/wwsquery.dll?hois=guamquery +#.gw # no NIC? +#.gy # NIC? (UPR) .hk whois.hknic.net.hk .hm whois.nic.hm -.hr whois.ripe.net -.hu whois.ripe.net -.id whois.idnic.net.id # broken +.hn NONE # www.nic.hn +.hr WEB http://www.CARNet.hr/DNS/ +#.ht # NIC? http://www.haitiworld.com/ +.hu whois.nic.hu +.id whois.idnic.net.id # broken - WEB tukang.access.net.id/domain +.ie WEB http://www.domainregistry.ie/search/whois.html .ie whois.ripe.net .il whois.ripe.net -.in whois.ncst.ernet.in # empty? -#.io whois.io # +.im WEB http://www.nic.im/exist.html +.in whois.ncst.ernet.in +.io WEB http://www.io.io/whois.html +#.iq # NIC? +.ir WEB http://aria.nic.ir/forms/whois.html .is whois.ripe.net .it whois.nic.it -.jo whois.ripe.net +.je NONE # http://www.isles.net +#.jm # NIC? uwimona.edu.jm ns.jm +.jo NONE # www.nic.gov.jo .jp whois.nic.ad.jp +.ke NONE # http://www.nbnet.co.ke/domain.htm +.kg whois.domain.kg +#.kh # NIC? http://www.camnet.com.kh +#.ki # NIC? +#.km # NIC? +#.kn # NIC? (UPR) +#.kp .kr whois.krnic.net +.kw WEB http://www.domainname.net.kw +.ky NONE # http://www.nic.ky .kz whois.domain.kz +#.la # no IP connectivity +.lb WEB http://www.aub.edu.lb/lbdr/search.html +.lc NONE # http://www.isisworld.lc/domains/ .li whois.nic.li .lk whois.nic.lk +.lr NONE # http://www.psg.com/dns/lr/ +.ls NONE .lt whois.ripe.net -.lu whois.ripe.net +.lu whois.restena.lu .lv whois.ripe.net -#.ly whois.nic.ly # -#.ma whois.ripe.net #wrong +.ly WEB http://www.lydomains.com/whois.asp +#.ma ######### NIC? www.nic.ma .mc whois.ripe.net -.md whois.ripe.net -#.mk whois.ripe.net #wrong -#.mm whois.nic.mm # +.md WEB http://www.nic.md/search.html +.mg NONE # www.nic.mg +.mh NONE # http://www.nic.net.mh +#.mk # NIC? http://www.mpt.com.mk +#.ml # NIC? sotelma.ml +.mm whois.nic.mm +.mn WEB http://www.nic.mn +.mo NONE # http://www.umac.mo/other/ +.mp NONE # http://www.marketplace.mp +#.mq ######## http://www.nic.mq # broken +.mr NONE # http://www.univ-nkc.mr/nic_mr.html .ms whois.adamsnames.tc -#.mt whois.ripe.net #wrong +.mt WEB http://www.um.edu.mt/nic/dir/ +.mu NONE # http://www.posix.co.za/mu/ +#.mv # NIC? dhiraagu.com.mv +.mw WEB http://www.tarsus.net/whois/ .mx whois.nic.mx +.my NONE # http://www.mynic.net +#.mz # NIC? dzowo.uem.mz +.na WEB http://www.lisse.na/cgi-bin/whois.cgi +.nc NONE # http://www.orstom.nc/BASE/IRD_NOUMEA/TLD_NC/ +#.ne # NIC? http://www.intnet.ne +.nf NONE # http://www.names.nf .ng pgebrehiwot.iat.cnr.it -.nl www.domain-registry.nl -.no whois.ripe.net +.ni WEB http://ns.ni/whois.htm +.nl whois.domain-registry.nl +.no whois.norid.no +.np WEB http://202.52.255.47/search.htm # www.mos.com.np +#.nr ######### NIC? cenpac.net.nr .nu whois.nic.nu .nz tardis.patho.gen.nz +#.om NONE # NIC? http://www.gto.net.om +.pa WEB http://www.nic.pa .pe whois.rcp.net.pe -.pl whois.ripe.net -#.pr whois.uprr.pr # +#.pf # NIC? nic.pf +.pg NONE # http://www.unitech.ac.pg/Unitech_General/ITS/ITS_Dns.htm +.ph WEB http://www.names.ph/search.html .pk whois.pknic.net.pk -#.pt whois.dns.pt # disabled - use http://www.dns.pt/info/ +.pl whois.ripe.net +#.pm # NIC-FR! http://www.nic.pm +.pn NONE # http://www.nic.pn +.pr NONE # http://www.uprr.pr/main.html +.ps NONE # no NIC yet... www.gov.ps +.pt WEB http://www.dns.pt/dnsinfo.htm .pw whois.nic.pw +.py WEB http://www.nic.py/consultas/ +#.qa # NIC? http://www.qatar.net.qa +#.re # NIC-FR! .ro whois.ripe.net .ru whois.ripn.net +.rw WEB http://www.nic.cd/database/rw/ +.sa WEB http://www.saudinic.net.sa/domain/whois.htm +.sb WEB http://www.sbnic.net.sb/search.html +#.sc NONE # NIC? http://www.sc/ +#.sd # NIC? http://www.sudatel.sd .se whois.nic-se.se .sg whois.nic.net.sg .sh whois.nic.sh -#.si whois.ripe.net #wrong +.si whois.arnec.si +.sj NONE # http://www.uninett.no/navn/bv-sj.html .sk whois.ripe.net +#.sl # NIC? http://www.sierratel.sl/ .sm whois.ripe.net -#.so whois.nic.so # +.sn NONE # www.nic.sn +.so NONE # www.nic.so +#.sr # NIC? sr.net .st whois.nic.st .su whois.ripn.net +.sv WEB http://www.conacyt.gob.sv/dns/ +#.sy # NIC? syriatel.net +.sz NONE # http://www.iafrica.sz/domreg/ .tc whois.adamsnames.tc +#.td # NIC? http://www.tit.td .tf whois.adamsnames.tc +.tg WEB www.nic.tg .th whois.thnic.net .tj whois.nic.tj +.tk NONE # 2day.com .tm whois.nic.tm -.tn whois.ripe.net +.tn NONE # http://www.ati.tn/Nic/ .to whois.tonic.to +.tp NONE # http://www.nic.tp .tr whois.metu.edu.tr +.tt WEB http://www.nic.tt/cgi-bin/whois.cgi +.tv NONE # http://internet.tv .tw whois.twnic.net -.ua whois.ripe.net +.tz NONE # http://www.psg.com/dns/tz/ +.ua WEB http://nic.ua.net/botik.cgi +.ug NONE # http://www.nic.ug .ac.uk whois.ja.net .uk whois.nic.uk +.um whois.isi.edu # not checked +.fed.us whois.nic.gov .us whois.isi.edu +.uy WEB http://www.rau.edu.uy/rau/dom/reg.htm +#.uz # NIC? http://www.freenet.uz .va whois.ripe.net +#.vc # NIC? #.ve rwhois.reacciun.ve:4321 +.ve WEB http://www.nic.ve/nicwho01.html .vg whois.adamsnames.tc -.yu whois.ripe.net +#.vi # NIC? http://www.usvi.net/cobex/ +#.vn http://www.batin.com.vn/ # NIC? +.vu WEB http://www.vunic.vu/whois? +#.wf # NIC-FR! +.ws whois.samoanic.ws +#.ye # NIC? www.y.net.ye +#.yt # NIC-FR! +.yu NONE # whois.nic.yu .za whois.frd.ac.za --dom whois.internic.net --org whois.internic.net --hst whois.internic.net +.zm NONE # http://www.zamnet.zm/siteindex/Links/JoinZamnet.htm +.zr NONE # obsoleted by cd +#.zw # NIC? zptc.co.zw http://www.zispa.co.zw/ +-au-dom whois.aunic.net +-dom whois.networksolutions.com +-org whois.networksolutions.com +-hst whois.networksolutions.com -arin whois.arin.net -ripe whois.ripe.net +-mnt whois.ripe.net +-gandi whois.gandi.net -ap whois.apnic.net -au whois.aunic.net +-ti whois.telstra.net -6bone whois.6bone.net +-norid whois.norid.no -ripn whois.ripn.net -sgnic whois.nic.net.sg -metu whois.metu.edu.tr +-cknic whois.nic.ck +-kg whois.domain.kg @@ -1,93 +1,88 @@ -.TH WHOIS 1 "15 November 1999" "Marco d'Itri" "Debian GNU/Linux" +.TH WHOIS 1 "3 December 1999" "Marco d'Itri" "Debian GNU/Linux" .SH NAME whois \- client for the whois directory service .SH SYNOPSIS .B whois -[ -.BR \-h -.I HOST -] [ -.BR \-p -.I PORT -] [ -.BR -aCFLMmrRSV -] [ -.BR \-g -.I SOURCE:FIRST-LAST -] [ -.BR \-i -.I ATTR -] [ -.BR \-S -.I SOURCE -] [ -.BR \-T -.I TYPE -] +[\~\fB-h\fP\~\fIHOST\fP\~] +[\~\fB-p\fP\~ \fIPORT\fP\~] +[\~\fB-aCFLMmrRSV\fP\~] +[\~\fB-g\fP\~\fISOURCE:FIRST-LAST\fP\~] +[\~\fB-i\fP\~\fIATTR\fP\~] +[\~\fB-S\fP\~\fISOURCE\fP\~] +[\~\fB-T\fP\~\fITYPE\fP\~] .I object .B whois -[ -.I -t -| -.I -v -| -.I -i -] +[\~\fI-t\fP\~] +[\~\fI-v\fP\~] +[\~\fI-i\fP\~] .I template .PP .SH DESCRIPTION -.B whois -searches for an object in a -.I RFC-812 -database. +\fBwhois\fP searches for an object in a \fIRFC-812\fP database. This version of the whois client tries to guess the right server to ask for the specified object. If no guess can be made it will connect -to whois.internic.net for domains, whois.arin.net for IPv4 addresses -and whois.6bone.net for IPv6 addresses. +to whois.internic.net for domains, +.\" whois.networksolutions.com for nic handles, +whois.arin.net for IPv4 addresses and whois.6bone.net for +IPv6 addresses. .PP .SH OPTIONS .TP 8 .B \-h HOST Connect to HOST. .TP 8 +.B \-H +Do not display the legal disclaimers some registries like to show you. +.TP 8 .B \-p PORT Connect to PORT. -.TP 8 -.B \-C -First query -.I www.crsnic.net -to find the registrar for a GTLD subdomain. This option overrides -.I \-h. +.\" .TP 8 +.\" .B \-C +.\" First query \fIwhois.internic.net\fP to find the registrar for a GTLD subdomain. +.\" This option overrides \fB-h\fP. .TP 8 .B \-V Be verbose. .TP 8 Other options are flags understood by RIPE-like servers. -.SH FEATURES -When querying -.I whois.arin.net -for AS numbers, the program will automatically convert the request in -the appropriate format, inserting a space after the string "AS". +.SH NOTES +.\" The default server for gTLDs is \fIwhois.networksolutions.com\fP. +.\" Unless the \fB-C\fP option is used the CRSNIC shared whois server is +.\" \fBnot\fP queried and domains registered by other registrars will be +.\" reported as unknown. +.\" .P +Please remember that \fIwhois.networksolutions.com\fP by default will +only search in the domains database. If you want to search for hostnames, +NIC handles or people names you have to prepend the appropriate keyword +(\fIHO\fPst, \fIHA\fPndle or \fINA\fPme). +.P +When querying \fIwhois.arin.net\fP for AS numbers, the program will +automatically convert the request in the appropriate format, inserting +a space after the string "AS". +.P +When querying \fIwhois.ncst.ernet.in\fP for a string without spaces, the +\fIdomain\fP keyword is prepended. .P -When querying -.I whois.nic.ad.jp -english text is requested unless the -.I LANG -environment variable specifies a Japanese locale. +When querying \fIwhois.corenic.net\fP, machine readable output is requested. .P RIPE-specific options are ignored when querying non-RIPE servers. +.SH ENVIRONMENT +.IP LANG +When querying \fIwhois.nic.ad.jp\fP english text is requested unless the +\fILANG\fP environment variable specifies a Japanese locale. +.IP "WHOIS_SERVER" +This server will be queried if the program cannot guess where the object +is located. If the variable does not exist then +\fIwhois.internic.net\fP will be queried. .SH "SEE ALSO" -.I RFC 812: -NICNAME/WHOIS +\fIRFC 812:\fP NICNAME/WHOIS .PP -.I RIPE-157, RIPE-189: -RIPE NCC Database Documentation +\fIRIPE-157\fP, \fIRIPE-189\fP: RIPE NCC Database Documentation .PP -Detailed help on available flags can be found in -.I RIPE-157 -or in the help file, which can be obtained with the command: +Detailed help on available flags can be found in \fIRIPE-157\fP or in +the help file which can be obtained with the command: .IP .B whois -h whois.ripe.net HELP .SH HISTORY @@ -98,5 +93,5 @@ I also added support for the protocol extensions developed by David Kessens of QWest for the 6bone server. .SH AUTHOR .B Whois -and this man page were written by Marco d'Itri <md@linux.it> +and this man page were written by Marco d'Itri <\fImd@linux.it\fP> and are licensed under the GPL. @@ -25,14 +25,13 @@ #include "whois.h" /* Global variables */ -int sockfd, verb = 0; +int sockfd, verb = 0, hide_discl = 2; int main(int argc, char *argv[]) { int ch, nopar = 0, optC = 0; - const char *server = NULL; - char *p, *q, qstring[256] = "\0", fstring[64] = "\0", *port = NULL, - defaultserv[] = "whois.internic.net"; + const char *server = NULL, *port = NULL; + char *p, *q, *qstring = NULL, fstring[64] = "\0"; #ifdef ENABLE_NLS setlocale(LC_MESSAGES, ""); @@ -40,7 +39,7 @@ int main(int argc, char *argv[]) textdomain(NLS_CAT_NAME); #endif - while ((ch = getopt(argc, argv, "acCFg:h:i:LmMp:rRs:St:T:v:V")) > 0) { + while ((ch = getopt(argc, argv, "acCFg:h:Hi:LmMp:rRs:St:T:v:V")) > 0) { /* RIPE flags */ if (strchr(ripeflags, ch)) { for (p = fstring; *p != '\0'; p++); @@ -58,7 +57,13 @@ int main(int argc, char *argv[]) switch (ch) { case 'h': server = q = malloc(strlen(optarg) + 1); - for (p = optarg; *p != '\0'; *q++ = tolower(*p++)); + for (p = optarg; *p != '\0' && *p != ':'; *q++ = tolower(*p++)); + if (*p == ':') + port = p + 1; + *q = '\0'; + break; + case 'H': + hide_discl = 0; /* enable disclaimers hiding */ break; case 'p': port = optarg; @@ -79,31 +84,56 @@ int main(int argc, char *argv[]) if (argc == 0 && !nopar) /* there is no parameter */ usage(); - /* parse other parameters */ - if (!nopar) { - strcpy(qstring, *argv++); - argc--; - while (argc-- > 0) { + /* parse other parameters, if any */ + if (nopar) { + qstring = malloc(1); + *qstring = '\0'; + } else { + int qslen = 0; + + while (1) { + qslen += strlen(*argv) + 1; + qstring = realloc(qstring, qslen); + strcat(qstring, *argv++); + if (argc == 1) + break; strcat(qstring, " "); - strcat(qstring, *argv); + argc--; } } - if (optC && domfind(qstring, gtlds)) { + if (!server && +#ifndef FIRST_ASK_INTERNIC + optC && +#endif + domfind(qstring, gtlds)) { if (verb) - fputs(_("Connecting to whois.crsnic.net.\n"), stdout); - sockfd = openconn("whois.crsnic.net", "43"); + puts(_("Connecting to whois.internic.net.")); + sockfd = openconn("whois.internic.net", NULL); server = query_crsnic(sockfd, qstring); - if (verb && server) - printf(_("\nDetected CRSNIC referral to %s.\n\n"), server); closeconn(sockfd); + if (!server) + exit(0); + printf(_("\nFound InterNIC referral to %s.\n\n"), server); } if (!server) { if (!(server = whichwhois(qstring))) { - server = defaultserv; + if (!(server = getenv("WHOIS_SERVER"))) + server = DEFAULTSERVER; if (verb) printf(_("Using default server %s.\n"), server); + } else if (server[0] == '\001') { + puts(_("This domain has no whois server, but you can access the " + "whois database at")); + puts(server + 1); + exit(0); + } else if (server[0] == '\002') { + puts(server + 1); + exit(0); + } else if (server[0] == '\003') { + puts(_("This domain has no whois server.")); + exit(0); } else if (verb) printf(_("Using server %s.\n"), server); } @@ -133,26 +163,40 @@ const char *whichwhois(const char *s) if (*s == '\0') return "whois.ripe.net"; - /* no dot and no hyphen means it's a internic NIC handle or an AS (?) */ + /* IPv6 address */ + if (strchr(s, ':')) { + if (strncasecmp(s, "2001:2", 6) == 0) /* XXX ugly hack! */ + return "whois.apnic.net"; + if (strncasecmp(s, "2001:4", 6) == 0) + return "whois.arin.net"; + if (strncasecmp(s, "2001:6", 6) == 0) + return "whois.ripe.net"; + //if (strncasecmp(s, "3ffe", 4) == 0) + return "whois.6bone.net"; + } + + /* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */ if (!strpbrk(s, ".-")) { - if (strncasecmp(s, "AS", 2) == 0) { /* it's an AS */ + const char *p; + + for (p = s; *p != '\0'; p++); /* go to the end of s */ + if (strncasecmp(s, "as", 2) == 0 && /* it's an AS */ + ((s[2] >= '0' && s[2] <= '9') || s[2] == ' ')) return whereas(atoi(s + 2), as_assign); - } else /* it's an internic NIC handle (?) */ - return "whois.internic.net"; + else if (strncasecmp(p - 2, "jp", 2) == 0) /* JP NIC handle */ + return "whois.nic.ad.jp"; + else /* it's a NSI NIC handle or something we don't know about */ + return NULL; } - /* IPv6 address */ - if (strchr(s, ':')) - return "whois.6bone.net"; - /* smells like an IP? */ if ((ip = myinet_aton(s))) { for (i = 0; ip_assign[i].serv; i++) if ((ip & ip_assign[i].mask) == ip_assign[i].net) return ip_assign[i].serv; if (verb) - fputs(_("I don't know where this IP has been delegated.\n" - "I'll try ARIN and hope for the best...\n"), stdout); + puts(_("I don't know where this IP has been delegated.\n" + "I'll try ARIN and hope for the best...")); return "whois.arin.net"; } @@ -161,31 +205,30 @@ const char *whichwhois(const char *s) if (domcmp(s, tld_serv[i])) return tld_serv[i + 1]; - /* no dot but hyphen, check for ARIN netblock names */ + /* no dot but hyphen */ if (!strchr(s, '.')) { - for (i = 0; arin_nets[i]; i++) - if (!strncasecmp(s, arin_nets[i], strlen(arin_nets[i]))) - return "whois.arin.net"; - /* could be one of *NETBLK-RIPE* *NET-RIPE* *APNIC* *AUNIC-AU* */ + /* search for strings at the start of the word */ + for (i = 0; nic_handles[i]; i += 2) + if (strncasecmp(s, nic_handles[i], strlen(nic_handles[i])) == 0) + return nic_handles[i + 1]; if (verb) - fputs(_("I guess it's a netblock name but I don't know where to" - " look it up.\n"), stdout); + puts(_("I guess it's a netblock name but I don't know where to" + " look it up.")); return "whois.arin.net"; } /* has dot and hypen and it's not in tld_serv[], WTF is it? */ if (verb) - fputs(_("I guess it's a domain but I don't know where to look it" - " up.\n"), stdout); - + puts(_("I guess it's a domain but I don't know where to look it" + " up.")); return NULL; } -const char *whereas(unsigned short asn, struct as_del aslist[]) +const char *whereas(int asn, struct as_del aslist[]) { int i; - if (asn > 14335) + if (asn > 16383) puts(_("Unknown AS number. Please upgrade this program.")); for (i = 0; aslist[i].serv; i++) if (asn >= aslist[i].first && asn <= aslist[i].last) @@ -198,57 +241,79 @@ char *queryformat(const char *server, const char *flags, const char *query) char *buf; int i, isripe = 0; - buf = malloc(QUERYBUFSIZE + 1); /* +1 is for ARIN AS queries */ - //*buf = '\0'; + /* +10 for CORE; +2 for \r\n; +1 for NULL*/ + buf = malloc(strlen(flags) + strlen(query) + 10 + 2 + 1); + *buf = '\0'; for (i = 0; ripe_servers[i]; i++) if (strcmp(server, ripe_servers[i]) == 0) { - strcat(buf, "-V" IDSTRING " "); + strcat(buf, "-V " IDSTRING " "); isripe = 1; break; } + if (!isripe) + for (i = 0; ripe_servers_old[i]; i++) + if (strcmp(server, ripe_servers_old[i]) == 0) { + strcat(buf, "-V" IDSTRING " "); + isripe = 1; + break; + } if (*flags != '\0') { - if (isripe && *flags != '\0') + if (!isripe && strcmp(server, "whois.corenic.net") != 0) puts(_("Warning: RIPE flags ignored for a traditional server.")); else strcat(buf, flags); } - if (!isripe && strcmp(server, "whois.arin.net") == 0 && + if (!isripe && + (strcmp(server, "whois.arin.net") == 0 || + strcmp(server, "whois.nic.mil") == 0) && strncasecmp(query, "AS", 2) == 0 && - query[2] >= '0' && query[2] <= '9') { - sprintf(buf, "AS "); - strcat(buf, query + 2); + query[2] >= '0' && query[2] <= '9') + sprintf(buf, "AS %s", query + 2); /* fix query for ARIN */ + else if (!isripe && strcmp(server, "whois.corenic.net") == 0) + sprintf(buf, "--machine %s", query); /* machine readable output */ + else if (!isripe && strcmp(server, "whois.ncst.ernet.in") == 0 && + !strchr(query, ' ')) + sprintf(buf, "domain %s", query); /* ask for a domain */ + else if (!isripe && strcmp(server, "whois.nic.ad.jp") == 0) { + char *lang = getenv("LANG"); /* not a perfect check, but... */ + if (!lang || (strncmp(lang, "ja", 2) != 0)) + sprintf(buf, "%s/e", query); /* ask for english text */ + else + strcat(buf, query); } else strcat(buf, query); - if (!isripe && strcmp(server, "whois.nic.ad.jp") == 0) { - char *lang = getenv("LANG"); /* not a perfect check, but... */ - if (lang && (strncmp(getenv("LANG"), "ja", 2) != 0)) - strcat(buf, "/e"); /* ask for english text */ - } return buf; } void do_query(const int sock, const char *query) { - char buf[100]; + char buf[200]; FILE *fi; #ifdef HIDE_DISCL - int hide = 0; + int i = 0, hide = hide_discl; #endif fi = fdopen(sock, "r"); if (write(sock, query, strlen(query)) < 0) err_sys("write"); - while (fgets(buf, 100, fi)) { /* XXX errors? */ + if (shutdown(sock, 1) < 0) + err_sys("shutdown"); + while (fgets(buf, 200, fi)) { /* XXX errors? */ #ifdef HIDE_DISCL if (hide == 1) { - if (strncmp(buf, DISCL_END, sizeof(DISCL_END) - 1) == 0) + if (strncmp(buf, hide_strings[i+1], strlen(hide_strings[i+1]))==0) hide = 2; /* stop hiding */ - continue; + continue; /* hide this line */ } - if (hide == 0 && - strncmp(buf, DISCL_BEGIN, sizeof(DISCL_BEGIN) - 1) == 0) { - hide = 1; /* start hiding */ - continue; + if (hide == 0) { + for (i = 0; hide_strings[i] != NULL; i += 2) { + if (strncmp(buf, hide_strings[i], strlen(hide_strings[i]))==0){ + hide = 1; /* start hiding */ + break; + } + } + if (hide == 1) + continue; /* hide the first line */ } #endif #ifdef EXT_6BONE @@ -263,7 +328,7 @@ void do_query(const int sock, const char *query) printf(_("Detected referral to %s on %s.\n"), nq, nh); strcat(nq, "\r\n"); fd = openconn(nh, np); - do_query(sockfd, nq); + do_query(fd, nq); closeconn(fd); continue; } @@ -271,9 +336,12 @@ void do_query(const int sock, const char *query) #endif fputs(buf, stdout); } + if (ferror(fi)) + err_sys("fgets"); + #ifdef HIDE_DISCL if (hide == 1) - err_quit(_("Catastrophic error: INTERNIC changed the disclaimer text.\n" + err_quit(_("Catastrophic error: disclaimer text has been changed.\n" "Please upgrade this program.\n")); #endif } @@ -283,26 +351,30 @@ const char *query_crsnic(const int sock, const char *query) char *temp, buf[100], *ret = NULL; FILE *fi; - temp = malloc(strlen(query) + 5 + 2 + 1); - memcpy(temp, "dump ", 5); - strcpy(temp + 5, query); + temp = malloc(strlen(query) + 1 + 2 + 1); + *temp = '='; + strcpy(temp + 1, query); strcat(temp, "\r\n"); fi = fdopen(sock, "r"); if (write(sock, temp, strlen(temp)) < 0) err_sys("write"); while (fgets(buf, 100, fi)) { - if (strncmp(buf, " (2)", 6) == 0) { + /* If there are multiple matches only the server of the first record + is queried */ + if (strncmp(buf, " Whois Server:", 16) == 0 && !ret) { char *p, *q; for (p = buf; *p != ':'; p++); /* skip until colon */ for (p++; *p == ' '; p++); /* skip colon and spaces */ - q = ret = malloc(strlen(p)); - for (; *p != '\n' && *p != '\r'; *q++ = *p++); /* copy data */ + ret = malloc(strlen(p) + 1); + for (q = ret; *p != '\n' && *p != '\r'; *q++ = *p++); /*copy data*/ *q = '\0'; } fputs(buf, stdout); } + if (ferror(fi)) + err_sys("fgets"); free(temp); return ret; @@ -310,7 +382,7 @@ const char *query_crsnic(const int sock, const char *query) int openconn(const char *server, const char *port) { - int s; + int s, fd; #ifdef HAVE_GETADDRINFO struct addrinfo hints, *res, *ressave; #else @@ -326,15 +398,14 @@ int openconn(const char *server, const char *port) if ((s = getaddrinfo(server, port ? port : "whois", &hints, &res)) != 0) err_quit("getaddrinfo: %s", gai_strerror(s)); - ressave = res; - do { - if ((s = socket(res->ai_family, res->ai_socktype, res->ai_protocol))<0) + for (ressave = res; res; res = res->ai_next) { + if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol))<0) continue; /* ignore */ - if (connect(s, res->ai_addr, res->ai_addrlen) == 0) + if (connect(fd, res->ai_addr, res->ai_addrlen) == 0) break; /* success */ - close(s); - } while ((res = res->ai_next)); /* Thank you, W. Richard Stevens. */ + close(fd); + } if (!res) err_sys("connect"); @@ -342,9 +413,10 @@ int openconn(const char *server, const char *port) #else if ((hostinfo = gethostbyname(server)) == NULL) err_quit(_("Host %s not found."), server); - saddr.sin_addr = *(struct in_addr *) hostinfo->h_addr; - if ((s = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) < 0) + if ((fd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) < 0) err_sys("socket"); + memset(&saddr, 0, sizeof(saddr)); + saddr.sin_addr = *(struct in_addr *) hostinfo->h_addr; saddr.sin_family = AF_INET; if (!port) { saddr.sin_port = htons(43); @@ -353,10 +425,10 @@ int openconn(const char *server, const char *port) err_quit(_("%s/tcp: unknown service"), port); saddr.sin_port = servinfo->s_port; } - if (connect(s, &saddr, sizeof(saddr)) < 0) + if (connect(fd, &saddr, sizeof(saddr)) < 0) err_sys("connect"); #endif - return (s); + return (fd); } void closeconn(const int fd) @@ -375,12 +447,13 @@ int domcmp(const char *dom, const char *tld) { const char *p, *q; - if (!(p = strrchr(dom, *tld))) - return 0; - q = tld; - while (tolower(*p) == *q) - if (!(*p++ && *q++)) + for (p = dom; *p != '\0'; p++); p--; /* move to the last char */ + for (q = tld; *q != '\0'; q++); q--; + while (p >= dom && q >= tld && tolower(*p) == *q) { /* compare backwards */ + if (q == tld) /* start of the second word? */ return 1; + p--; q--; + } return 0; } @@ -408,13 +481,13 @@ unsigned long myinet_aton(const char *s) void usage(void) { - fputs(_( + fprintf(stderr, _( "Usage: whois [OPTION]... OBJECT...\n\n" "-a search all databases\n" -"-C first query CRSNIC to find GTLD registrar\n" "-F fast raw output (implies -r)\n" "-g SOURCE:FIRST-LAST find updates from SOURCE from serial FIRST to LAST\n" "-h HOST connect to server HOST\n" +"-H hide legal disclaimers\n" "-i ATTR[,ATTR]... do an inverse lookup for specified ATTRibutes\n" "-L find all Less specific matches\n" "-M find all More specific matches\n" @@ -429,14 +502,14 @@ void usage(void) "-t TYPE requests template for object of TYPE ('all' for a list)\n" "-v TYPE requests verbose template for object of TYPE\n" "-V explain what is being done\n\n" -"Version " VERSION ". Please report bugs to <md@linux.it>.\n" - ), stderr); +"Version %s. Please report bugs to %s.\n" + ), VERSION, "<md+whois@linux.it>"); exit(1); } /* Error routines */ -void err_sys(const char *fmt,...) +void err_sys(const char *fmt, ...) { va_list ap; @@ -447,7 +520,7 @@ void err_sys(const char *fmt,...) exit(2); } -void err_quit(const char *fmt,...) +void err_quit(const char *fmt, ...) { va_list ap; @@ -1,14 +1,8 @@ -/* Size of the buffer where the query is built */ -#define QUERYBUFSIZE 1024 - -/* Protocol data which could change */ -/* First and last lines of the Internic disclaimer */ -#define DISCL_BEGIN "The Data in" -#define DISCL_END "this query" - /* 6bone referto: extension */ -#define REFERTO_FORMAT "%% referto: whois -h %255s -p %15s %1023[^\n\r]" +#define REFERTO_FORMAT "%% referto: whois -h %255s -p %15s %1021[^\n\r]" +/* String sent to RIPE servers - ONLY FIVE CHARACTERS! */ +#define IDSTRING "Md4.4" /* system features */ #ifdef linux @@ -44,7 +38,7 @@ /* prototypes */ const char *whichwhois(const char *); -const char *whereas(unsigned short, struct as_del []); +const char *whereas(int, struct as_del []); char *queryformat(const char *, const char *, const char *); void do_query(const int, const char *); const char *query_crsnic(const int, const char *); |