diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | config.h | 5 | ||||
-rw-r--r-- | data.h | 5 | ||||
-rw-r--r-- | debian/changelog | 31 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | ip_del_list | 4 | ||||
-rwxr-xr-x | make_ip_del.pl | 17 | ||||
-rw-r--r-- | po/el.po | 211 | ||||
-rw-r--r-- | po/pl.po | 11 | ||||
-rw-r--r-- | whois.1 | 5 | ||||
-rw-r--r-- | whois.c | 371 | ||||
-rw-r--r-- | whois.h | 10 | ||||
-rw-r--r-- | whois.spec | 2 |
13 files changed, 398 insertions, 284 deletions
@@ -20,6 +20,8 @@ LIBIDN += -lidn CFLAGS += -DHAVE_LIBIDN endif +PERL=perl + all: whois #pos whois: whois.c whois.h config.h data.h as_del.h ip_del.h tld_serv.h @@ -29,13 +31,13 @@ mkpasswd: mkpasswd.c $(CC) $(CFLAGS) $(OPTS) mkpasswd.c -o mkpasswd -lcrypt as_del.h: as_del_list make_as_del.pl - perl make_as_del.pl < as_del_list > as_del.h + $(PERL) -w make_as_del.pl < as_del_list > as_del.h ip_del.h: ip_del_list make_ip_del.pl - perl make_ip_del.pl < ip_del_list > ip_del.h + $(PERL) -w make_ip_del.pl < ip_del_list > ip_del.h tld_serv.h: tld_serv_list make_tld_serv.pl - perl make_tld_serv.pl < tld_serv_list > tld_serv.h + $(PERL) -w make_tld_serv.pl < tld_serv_list > tld_serv.h install: whois install -m 0755 whois $(BASEDIR)$(prefix)/bin/ @@ -1,12 +1,9 @@ /* Program version */ /* not for the inetutils version */ -#define VERSION "4.6.9" +#define VERSION "4.6.11" /* Configurable features */ -/* 6bone referto: support */ -#define EXT_6BONE - /* Always hide legal disclaimers */ #undef ALWAYS_HIDE_DISCL @@ -40,7 +40,8 @@ const char *ripe_servers_old[] = { }; const char *hide_strings[] = { - "NOTICE AND TERMS OF USE: You", "Network Solutions reserves",/* VERISIGN */ + "NOTICE AND TERMS OF USE: You", "Network Solutions reserves",/* Verisign */ + "NOTICE: The expiration date", "Registrars.", /* crsnic */ "NOTICE: Access to .ORG WHOIS", "time. By submitting", /* org */ "NOTICE: Access to .INFO WHOIS", "time. By submitting", /* info */ "This Registry database contains ONLY .EDU", "type: help", /* edu */ @@ -65,6 +66,7 @@ const char *hide_strings[] = { "The Data in OnlineNIC", "\tBy starting this query", /* OnlineNIC */ "The data in Bulkregister.com", "you agree to abide", /* bulkregister */ "The Data in Alldomains.com's", "By submitting this query,",/*alldomains*/ + "Interdomain's WHOIS", "DOES NOT SIGNIFY", NULL, NULL }; @@ -118,6 +120,7 @@ struct ip6_del ip6_assign[] = { { 0x1400, "whois.ripe.net" }, { 0x1600, "whois.ripe.net" }, { 0x1800, "whois.arin.net" }, + { 0x1A00, "whois.ripe.net" }, { 0, NULL } }; diff --git a/debian/changelog b/debian/changelog index 64038c8..004695b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,34 @@ +whois (4.6.13) unstable; urgency=medium + + * Fix the DENIC code. (Closes: #242424) + + -- Marco d'Itri <md@linux.it> Thu, 8 Apr 2004 13:16:58 +0200 + +whois (4.6.12) unstable; urgency=medium + + * Added a workaround for DENIC brokeness. (Closes: #242424) + * Added the new IPv4 networks allocated to RIPE. + + -- Marco d'Itri <md@linux.it> Tue, 6 Apr 2004 19:25:20 +0200 + +whois (4.6.11) unstable; urgency=medium + + * Fix parsing of IPv4 addresses on 64 bit architectures, spotted by + Paul Slootman. (Closes: #229809) + * Add support for ARIN whois referrals. (Closes: #229810, #231694) + * Cleaned up some code and added support for ARIN referrals, based + on a patch by Kees Cook. + + -- Marco d'Itri <md@linux.it> Sat, 31 Jan 2004 17:41:39 +0100 + +whois (4.6.10) unstable; urgency=high + + * Compiled with libidn11. (Closes: #227350) + * Fixed a disclaimer. (Closes: #226949) + * Updated Greek .po file from Velonis Petros. + + -- Marco d'Itri <md@linux.it> Tue, 13 Jan 2004 12:55:51 +0100 + whois (4.6.9) unstable; urgency=medium * Removed .ac.cn SLD. (Closes: #219883) diff --git a/debian/control b/debian/control index 54aa4d4..237c54b 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: standard Maintainer: Marco d'Itri <md@linux.it> Standards-Version: 3.6.1 -Build-Depends: debhelper, gettext, libidn9-dev +Build-Depends: debhelper, gettext, libidn11-dev Package: whois Architecture: any diff --git a/ip_del_list b/ip_del_list index b7eea55..becd934 100644 --- a/ip_del_list +++ b/ip_del_list @@ -14,8 +14,8 @@ 61.208.0.0/13 whois.nic.ad.jp # => 61.215.255.255 60.0.0.0/7 apnic 62.0.0.0/8 ripe -80.0.0.0/7 ripe -82.0.0.0/8 ripe +80.0.0.0/5 ripe # => 87.255.255.254 +88.0.0.0/8 ripe 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_ip_del.pl b/make_ip_del.pl index c452492..84e4dcf 100755 --- a/make_ip_del.pl +++ b/make_ip_del.pl @@ -7,18 +7,19 @@ while (<>) { s/^\s*(.*)\s*$/$1/; s/\s*#.*$//; next if /^$/; - die "format error: $_" unless (/^([\d\.]+)\/(\d+)\s+([\w\.]+)$/); - my $m=$2; my $s=$3; - my ($i1, $i2, $i3, $i4)=split(/\./, $1); - print "{ ".(($i1<<24)+($i2<<16)+($i3<<8)+$i4)."UL, ". - (~(0xffffffff>>$m))."UL, \""; + + die "format error: $_" if not /^([\d\.]+)\/(\d+)\s+([\w\.]+)$/; + my $m = $2; my $s = $3; + my ($i1, $i2, $i3, $i4) = split(/\./, $1); + print '{ ' . (($i1 << 24) + ($i2 << 16) + ($i3 << 8) + $i4) . 'UL, '. + ((~(0xffffffff >> $m)) & 0xffffffff) . 'UL, "'; if ($s =~ /\./) { - print "$s"; + print $s; } elsif ($s eq 'UNALLOCATED') { - print "\006"; + print "\\006"; } else { print "whois.$s.net"; } - print "\" },\n"; + print '" },' . "\n"; } @@ -1,17 +1,16 @@ -# Greek translation of the whois command. -# Copyright (C) 1999-2000 Simos Xenitellis -# Simos Xenitellis <simos@hellug.gr>\n" -# +# Greek translation of the whois 4.6.9 command. +# Copyright (C) 1999-2003 Simos Xenitellis, Velonis Petros +# Simos Xenitellis <simos@hellug.gr> +# Velonis Petros <velonis@freemail.gr> msgid "" msgstr "" -"Project-Id-Version: whois 4.5.3\n" -"Report-Msgid-Bugs-To: \n" +"Project-Id-Version: whois 4.6.9\n" "POT-Creation-Date: 2003-12-01 18:31+0100\n" -"PO-Revision-Date: 2001-02-23 16:07:57+0900\n" -"Last-Translator: Simos Xenitellis <simos@hellug.gr>\n" -"Language-Team: Greek <nls@tux.hellug.gr>\n" +"PO-Revision-Date: 2003-12-10 08:51+0200\n" +"Last-Translator: Velonis Petros <velonis@freemail.gr>\n" +"Language-Team: Greek <velonis@freemail.gr>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-7\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../whois.c:108 @@ -21,75 +20,71 @@ msgid "" "\n" "Report bugs to %s.\n" msgstr "" -" %s.\n" +"Έκδοση %s.\n" "\n" -" %s.\n" +"Αναφέρατε σφάλματα στο %s.\n" -#: ../whois.c:151 ../whois.c:240 +#: ../whois.c:151 +#: ../whois.c:240 #, c-format msgid "Using server %s.\n" -msgstr " %s.\n" +msgstr "Γίνεται χρήση του εξυπηρετητή %s.\n" #: ../whois.c:173 #, c-format msgid "Using default server %s.\n" -msgstr " ' %s.\n" +msgstr "Χρήση εξ' ορισμού εξυπηρετητή %s.\n" #: ../whois.c:176 msgid "This TLD has no whois server, but you can access the whois database at" -msgstr "" -" TLD whois, " -" whois " +msgstr "Αυτό το TLD δεν έχει εξυπηρετητή whois, ωστόσο μπορείτε να προσπελάσετε την βάση whois στο" #: ../whois.c:182 msgid "This TLD has no whois server." -msgstr " TLD whois." +msgstr "Αυτό το TLD δεν έχει εξυπηρετητή whois." #: ../whois.c:186 -#, fuzzy msgid "Connecting to whois.crsnic.net." -msgstr " whois.internic.net." +msgstr "Γίνεται σύνδεση στο whois.crsnic.net." -#: ../whois.c:192 ../whois.c:203 -#, fuzzy, c-format +#: ../whois.c:192 +#: ../whois.c:203 +#, c-format msgid "" "\n" "Found a referral to %s.\n" "\n" msgstr "" "\n" -" InterNIC %s.\n" +"Βρέθηκε αναφορά στο %s.\n" "\n" #: ../whois.c:197 -#, fuzzy msgid "Connecting to whois.nic.cc." -msgstr " whois.internic.net." +msgstr "Γίνεται σύνδεση στο whois.nic.cc." #: ../whois.c:208 -#, fuzzy msgid "Connecting to whois.publicinterestregistry.net." -msgstr " whois.internic.net." +msgstr "Γίνεται σύνδεση στο whois.publicinterestregistry.net." #: ../whois.c:214 -#, fuzzy, c-format +#, c-format msgid "" "\n" "Found referral to %s.\n" "\n" msgstr "" "\n" -" InterNIC %s.\n" +"Βρέθηκε αναφορά στο %s.\n" "\n" #: ../whois.c:218 msgid "No whois server is known for this kind of object." -msgstr "" +msgstr "Κανένας εξυπηρετητής whois δεν είναι γνωστός για αυτού του είδους το αντικείμενο." #: ../whois.c:221 -#, fuzzy msgid "Unknown AS number or IP network. Please upgrade this program." -msgstr " AS. ." +msgstr "Άγνωστος αριθμός AS ή IP δικτύου. Παρακαλώ αναβαθμίστε αυτό το πρόγραμμα." #: ../whois.c:228 #, c-format @@ -98,6 +93,9 @@ msgid "" "Querying for the IPv4 endpoint %s of a 6to4 IPv6 address.\n" "\n" msgstr "" +"\n" +"Άντληση πληροφοριών για το σημείο τέλους IPv4 %s μιας διεύθυνσης 6to4 IPv6.\n" +"\n" #: ../whois.c:249 #, c-format @@ -105,54 +103,52 @@ msgid "" "Query string: \"%s\"\n" "\n" msgstr "" -" : \"%s\"\n" +"Αλφαριθμητικό ερώτησης: \"%s\"\n" "\n" -#: ../whois.c:302 ../whois.c:305 +#: ../whois.c:302 +#: ../whois.c:305 #, c-format msgid "Cannot parse this line: %s" -msgstr "" +msgstr "Αδύνατη η ανάλυση αυτής της γραμμής: %s" #: ../whois.c:446 -#, fuzzy msgid "Warning: RIPE flags used with a traditional server." -msgstr "" -": RIPE ." +msgstr "Προειδοποίηση: Η σημαίες του RIPE χρησιμοποιούνται σε έναν παραδοσιακό εξυπηρετητή." #: ../whois.c:503 #, c-format msgid "Detected referral to %s on %s.\n" -msgstr " %s %s.\n" +msgstr "Ανιχνεύθηκε αναφορά του %s στο %s.\n" #: ../whois.c:520 msgid "" "Catastrophic error: disclaimer text has been changed.\n" "Please upgrade this program.\n" msgstr "" -" : .\n" -" .\n" +"Καταστροφικό σφάλμα: το κείμενο της αποποίησης ευθυνών έχει τροποποιηθεί.\n" +"Παρακαλώ αναβαθμίστε το πρόγραμμα.\n" #: ../whois.c:639 #, c-format msgid "Host %s not found." -msgstr " %s ." +msgstr "Το σύστημα %s δε βρέθηκε." #: ../whois.c:649 #, c-format msgid "%s/tcp: unknown service" -msgstr "%s/tcp: " +msgstr "%s/tcp: άγνωστη υπηρεσία" #: ../whois.c:661 msgid "Timeout." -msgstr "" +msgstr "Διάλειμμα." #: ../whois.c:667 #, c-format msgid "Interrupted by signal %d..." -msgstr " %d..." +msgstr "Διακοπή από το σήμα %d..." #: ../whois.c:728 -#, fuzzy msgid "" "Usage: whois [OPTION]... OBJECT...\n" "\n" @@ -160,11 +156,9 @@ msgid "" "-L find all Less specific matches\n" "-m find first level more specific matches\n" "-M find all More specific matches\n" -"-c find the smallest match containing a mnt-irt " -"attribute\n" +"-c find the smallest match containing a mnt-irt attribute\n" "-x exact match [RPSL only]\n" -"-d return DNS reverse delegation objects too [RPSL " -"only]\n" +"-d return DNS reverse delegation objects too [RPSL only]\n" "-i ATTR[,ATTR]... do an inverse lookup for specified ATTRibutes\n" "-T TYPE[,TYPE]... only look for objects of TYPE\n" "-K only primary keys are returned [RPSL only]\n" @@ -174,8 +168,7 @@ msgid "" "-a search all databases\n" "-s SOURCE[,SOURCE]... search the database from SOURCE\n" "-g SOURCE:FIRST-LAST find updates from SOURCE from serial FIRST to LAST\n" -"-t TYPE request template for object of TYPE ('all' for a " -"list)\n" +"-t TYPE request template for object of TYPE ('all' for a list)\n" "-v TYPE request verbose template for object of TYPE\n" "-q [version|sources|types] query specified server info [RPSL only]\n" "-F fast raw output (implies -r)\n" @@ -186,81 +179,72 @@ msgid "" " --help display this help and exit\n" " --version output version information and exit\n" msgstr "" -"Uso: whois [ø]... ź...\n" +"Χρήση: whois [ΕΠΙΛΟΓΕΣ]... ΑΝΤΙΚΕΙΜΕΝΟ...\n" "\n" -"-a \n" -"-F ( -r)\n" -"-g ù:ѿ: ù " -" ѿ \n" -"-h Ӿ Ӿ\n" -"-H \n" -"-i [,]... " -" \n" -"-x [ RPSL]\n" -"-l [ " -"RPSL]\n" -"-L \n" -"-M " -" \n" -"-m " -" \n" -"-r \n" -"-p Ⱦ Ⱦ\n" -"-R " -" " -"\n" -"-S " -" \n" -"-s ù[,ù]... ù\n" -"-T ź[,ź]... ź\n" -"-t ź " -"ź ('all' )\n" -"-v ź " -" ź\n" -"-d DNS\n" -" [ RPSL]\n" -"-K [ RPSL]\n" -"-V --verbose \n" -" --help \n" -" --version \n" +"-l ένα επίπεδο λιγότερο συγκεκριμένη αναζήτηση [μόνο RPSL]\n" +"-L εύρεση όλων των Λιγότερο συγκεκριμένων ταιριασμάτων\n" +"-m εύρεση όλων των πρώτου επιπέδου περισσότερο συγκεκριμένων ταιριασμάτων\n" +"-M εύρεση όλων των Περισσότερο συγκεκριμένων ταιριασμάτων\n" +"-c εύρεση του μικρότερου ταιριάσματος που να περιέχει μια ένα χαρακτηριστικό mnt-irt \n" +"-x ακριβές ταίριασμα [μόνο RPSL]\n" +"-d επιστροφή και των αντίστροφων αντικειμένων DNS [μόνο RPSL]\n" +"-i ΧΑΡΑΚ[,ΧΑΡΑΚ]... να γίνει μια αντίστροφη αναζήτηση για τα καθορισμένα ΧΑΡΑΚτηριστικά\n" +"-T ΕΙΔΟΣ[,ΕΊΔΟΣ]... αναζήτηση μόνο αντικειμένου του ΕΙΔΟΥΣ\n" +"-K επιστροφή μόνο των πρωταρχικών κλειδιών [μόνο RPSL]\n" +"-r απενεργοποίηση των αναδρομικών αναζητήσεων για πληροφορίες επικοινωνίας\n" +"-R επιβολή εμφάνισης τοπικού αντιγράφου του αντικειμένου επιθήματος ακόμα και αν περιέχει αναφορές\n" +"-a αναζήτηση σε όλες τις βάσεις δεδομένων\n" +"-s ΠΗΓΗ[,ΠΗΓΉ]... αναζήτηση της βάσης δεδομένων από την ΠΗΓΗ\n" +"-g ΠΗΓΗ:ΠΡΩΤΟ:ΤΕΛΕΥΤΑΙΟ εμφάνιση αναβαθμίσεων από την ΠΗΓΗ από το σειριακό ΠΡΏΤΟ ως ΤΕΛΕΥΤΑΙΟ\n" +"-t ΕΙΔΟΣ αναζήτηση προτύπου για το αντικείμενο του ΕΊΔΟΥΣ ('all' για εμφάνιση λίστας)\n" +"-v ΕΙΔΟΣ αναζήτηση περιφραστικού προτύπου για το αντικείμενο του ΕΙΔΟΥΣ\n" +"-q [έκδοση|πηγές|τύποι] συγκεκριμένο ερώτημα πληροφοριών εξυπηρετητή [μόνο RPSL]\n" +"-F γρήγορη ακατέργαστη έξοδος (υπονοεί -r)\n" +"-h ΣΥΣΤΗΜΑ σύνδεση στον εξυπηρετητή ΣΎΣΤΗΜΑ\n" +"-p ΘΥΡΑ σύνδεση στη ΘΥΡΑ\n" +"-H απόκρυψη του νομικού εγγράφου αποποίησης ευθύνης\n" +" --verbose εξήγηση του τί συμβαίνει\n" +" --help εμφάνιση αυτής της βοήθειας και έξοδος\n" +" --version εμφάνιση της έκδοσης και έξοδος\n" #: ../mkpasswd.c:55 msgid "\tstandard 56 bit DES-based crypt(3)" -msgstr "" +msgstr "\tκαθεριερωμένη 56 bit με βάση το DES crypt(3)" #: ../mkpasswd.c:96 #, c-format msgid "Invalid hash type '%s'.\n" -msgstr "" +msgstr "Άκυρος τύπος hash '%s'.\n" #: ../mkpasswd.c:105 #, c-format msgid "Invalid number '%s'.\n" -msgstr "" +msgstr "Μη αποδεκτό νούμερο '%s'.\n" #: ../mkpasswd.c:123 #, c-format msgid "Try '%s --help' for more information.\n" -msgstr "" +msgstr "Προσπάθησε '%s --help' για περισσότερες πληροφορίες.\n" #: ../mkpasswd.c:152 #, c-format msgid "Wrong salt length: %d byte(s) when %d expected.\n" -msgstr "" +msgstr "Εσφαλμένο μήκος salt : %d byte(s) όταν αναμένεται %d .\n" #: ../mkpasswd.c:158 #, c-format msgid "Illegal salt character '%c'.\n" -msgstr "" +msgstr "Μη αποδεκτός χαρακτήρας salt '%c'.\n" -#: ../mkpasswd.c:172 ../mkpasswd.c:199 +#: ../mkpasswd.c:172 +#: ../mkpasswd.c:199 msgid "Password: " -msgstr "" +msgstr "Συνθηματικό: " #: ../mkpasswd.c:193 #, c-format msgid "Illegal password character '0x%hhx'.\n" -msgstr "" +msgstr "Μη αποδεκτός χαρακτήρας συνθηματικού '0x%hhx'.\n" #: ../mkpasswd.c:230 msgid "" @@ -268,6 +252,9 @@ msgid "" "Crypts the PASSWORD using crypt(3).\n" "\n" msgstr "" +"Χρήση: mkpasswd [ΕΠΙΛΟΓΕΣ]... [ΣΥΝΘΗΜΑΤΙΚΟ [SALT]]\n" +"Κρυπτογραφεί το ΣΥΝΘΗΜΑΤΙΚΟ χρησιμοποιώντας το crypt(3).\n" +"\n" #: ../mkpasswd.c:233 #, c-format @@ -286,21 +273,21 @@ msgid "" "\n" "Report bugs to %s.\n" msgstr "" +" -H, --hash=ΤΥΠΟΣ επιλογή hash ΤΥΠΟΣ\n" +" -S, --salt=SALT χρήση του συγκεκριμένου SALT\n" +" -P, --password-fd=NUM ανάγνωση του συνθηματικού από αρχείο περιγραφής NUM\n" +" αντί από το /dev/tty\n" +" -s, --stdin σαν το --password-fd=0\n" +" -h, --help εμφάνιση αυτής της βοήθειας και έξοδος\n" +" -V, --version εμφάνιση πληροφοριών έκδοσης και έξοδος\n" +"\n" +"Αν λείπει το ΣΥΝΘΗΜΑΤΙΚΟ τότε γίνεται αλληλεπιδραστική ερώτηση.\n" +"Αν κανένα SALT δεν έχει προσδιοριστεί, τότε δημιουργείται ένα τυχαίο.\n" +"Αν λείπει ο ΤΥΠΟΣ τότε τυπώνονται διαθέσιμοι αλγόριθμοι.\n" +"\n" +"Αναφέρατε σφάλματα στο %s.\n" #: ../mkpasswd.c:260 msgid "Available algorithms:\n" -msgstr "" - -#~ msgid "" -#~ "I don't know where this IP has been delegated.\n" -#~ "I'll try ARIN and hope for the best..." -#~ msgstr "" -#~ " IP.\n" -#~ " ARIN ..." - -#~ msgid "I guess it's a netblock name but I don't know where to look it up." -#~ msgstr "" -#~ " ." +msgstr "Διαθέσιμοι αλγόριθμοι:\n" -#~ msgid "I guess it's a domain but I don't know where to look it up." -#~ msgstr " ." @@ -1,17 +1,17 @@ # cokolwi3k. whois.pot. # Micha 'CeFeK' Nazarewicz <cefek@career.pl>, 1999 # Przemysaw Knycz <djrzulf@pld.org.pl>, 2003 -# Jakub Bogusz <qboosh@pld.org.pl>, 2003 +# Jakub Bogusz <qboosh@pld-linux.org>, 2003 # # BUG: xxx # msgid "" msgstr "" -"Project-Id-Version: whois 4.6.5\n" +"Project-Id-Version: whois 4.6.9\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2003-12-01 18:31+0100\n" -"PO-Revision-Date: 2003-05-10 08:40+0200\n" -"Last-Translator: Jakub Bogusz <qboosh@pld.org.pl>\n" +"PO-Revision-Date: 2003-12-02 20:41+0100\n" +"Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n" "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-2\n" @@ -96,6 +96,9 @@ msgid "" "Querying for the IPv4 endpoint %s of a 6to4 IPv6 address.\n" "\n" msgstr "" +"\n" +"Pytanie o zakoczenie IPv4 %s adresu IPv6 typu 6to4.\n" +"\n" #: ../whois.c:249 #, c-format @@ -54,7 +54,10 @@ server becomes \fIwhois.networksolutions.com\fP. .P When querying \fIwhois.nic.mil\fP for AS numbers, the program will automatically convert the request in the appropriate format, inserting -a space after the string "AS". +a space after the string \fIAS\fP. +.P +When querying \fIwhois.denic.de\fP for domain names, the program will +automatically add the flags \fI-T dn,ace -C US-ASCII\fP. .P When querying \fIwhois.corenic.net\fP, machine readable output is requested. .P @@ -37,9 +37,9 @@ int sockfd, verb = 0; #ifdef ALWAYS_HIDE_DISCL -int hide_discl = 0; +int hide_discl = HIDE_UNSTARTED; #else -int hide_discl = 2; +int hide_discl = HIDE_DISABLED; #endif char *client_tag = (char *)IDSTRING; @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) { int ch, nopar = 0; const char *server = NULL, *port = NULL; - char *p, *q, *qstring, fstring[64] = "\0"; + char *p, *qstring, fstring[64] = "\0"; #ifdef ENABLE_NLS setlocale(LC_ALL, ""); @@ -89,19 +89,15 @@ int main(int argc, char *argv[]) /* program flags */ switch (ch) { case 'h': - server = q = malloc(strlen(optarg) + 1); - for (p = optarg; *p && *p != ':'; *q++ = tolower(*p++)); - if (*p == ':') - port = p + 1; - *q = '\0'; + server = strdup(optarg); break; case 'V': client_tag = optarg; case 'H': - hide_discl = 0; /* enable disclaimers hiding */ + hide_discl = HIDE_UNSTARTED; /* enable disclaimers hiding */ break; case 'p': - port = optarg; + port = strdup(optarg); break; case 2: verb = 1; @@ -143,9 +139,16 @@ int main(int argc, char *argv[]) } } + signal(SIGTERM, sighandler); + signal(SIGINT, sighandler); + signal(SIGALRM, alarm_handler); + + if (getenv("WHOIS_HIDE")) + hide_discl = HIDE_UNSTARTED; + /* -v or -t has been used */ if (!server && !*qstring) - server = "whois.ripe.net"; + server = strdup("whois.ripe.net"); #ifdef CONFIG_FILE if (!server) { @@ -155,11 +158,6 @@ int main(int argc, char *argv[]) } #endif - signal(SIGTERM, sighandler); - signal(SIGINT, sighandler); - signal(SIGALRM, alarm_handler); - alarm(60); - if (!server) { char *tmp; @@ -168,101 +166,100 @@ int main(int argc, char *argv[]) qstring = tmp; server = whichwhois(qstring); -retry: - switch (server[0]) { - case 0: - if (!(server = getenv("WHOIS_SERVER"))) - server = DEFAULTSERVER; - if (verb) - printf(_("Using default server %s.\n"), server); - break; - case 1: - puts(_("This TLD has no whois server, but you can access the " - "whois database at")); - case 2: - puts(server + 1); - exit(0); - case 3: - puts(_("This TLD has no whois server.")); - exit(0); - case 4: - if (verb) - puts(_("Connecting to whois.crsnic.net.")); - sockfd = openconn("whois.crsnic.net", NULL); - server = query_crsnic(sockfd, qstring); - close(sockfd); - if (!server) - exit(0); - printf(_("\nFound a referral to %s.\n\n"), server); - alarm(60); - break; - case 9: - if (verb) - puts(_("Connecting to whois.nic.cc.")); - sockfd = openconn("whois.nic.cc", NULL); - server = query_crsnic(sockfd, qstring); - close(sockfd); - if (!server) - exit(0); - printf(_("\nFound a referral to %s.\n\n"), server); - alarm(60); - break; - case 7: - if (verb) - puts(_("Connecting to whois.publicinterestregistry.net.")); - sockfd = openconn("whois.publicinterestregistry.net", NULL); - server = query_pir(sockfd, qstring); - close(sockfd); - if (!server) - exit(0); - printf(_("\nFound referral to %s.\n\n"), server); - alarm(60); - break; - case 5: - puts(_("No whois server is known for this kind of object.")); - exit(0); - case 6: - puts(_("Unknown AS number or IP network. Please upgrade this program.")); - exit(0); - case 0x0A: - { - char *tmp6 = convert_6to4(qstring); - free(qstring); - qstring = tmp6; - printf(_("\nQuerying for the IPv4 endpoint %s of a 6to4 IPv6 address.\n\n"), qstring); - server = whichwhois(qstring); - /* - * This code sucks enough that I can afford to use goto... - * Some day whichwhois() and queryformat() will be merged - * and will return a struct with status code, server name - * and query string. - */ - goto retry; - } - default: - if (verb) - printf(_("Using server %s.\n"), server); - } } - if (getenv("WHOIS_HIDE")) - hide_discl = 0; + handle_query(server, port, qstring, fstring); + + exit(0); +} + +/* server may be a server name from the command line, a server name got + * from whichwhois or an encoded command/message from whichwhois. + * server and port are allocated with malloc. + */ +const char *handle_query(const char *hserver, const char *hport, + const char *qstring, const char *fstring) +{ + const char *server, *port = NULL; + char *p; + + if (hport) { + server = strdup(hserver); + port = strdup(hport); + } else + split_server_port(hserver, &server, &port); + + switch (server[0]) { + case 0: + if (!(server = getenv("WHOIS_SERVER"))) + server = DEFAULTSERVER; + break; + case 1: + puts(_("This TLD has no whois server, but you can access the " + "whois database at")); + puts(server + 1); + return NULL; + case 2: + puts(server + 1); + return NULL; + case 3: + puts(_("This TLD has no whois server.")); + return NULL; + case 5: + puts(_("No whois server is known for this kind of object.")); + return NULL; + case 6: + puts(_("Unknown AS number or IP network. Please upgrade this program.")); + return NULL; + case 4: + if (verb) + puts(_("Connecting to whois.crsnic.net.")); + sockfd = openconn("whois.crsnic.net", NULL); + server = query_crsnic(sockfd, qstring); + break; + case 7: + if (verb) + puts(_("Connecting to whois.publicinterestregistry.net.")); + sockfd = openconn("whois.publicinterestregistry.net", NULL); + server = query_pir(sockfd, qstring); + break; + case 9: + if (verb) + puts(_("Connecting to whois.nic.cc.")); + sockfd = openconn("whois.nic.cc", NULL); + server = query_crsnic(sockfd, qstring); + break; + case 0x0A: + p = convert_6to4(qstring); + printf(_("\nQuerying for the IPv4 endpoint %s of a 6to4 IPv6 address.\n\n"), p); + server = whichwhois(p); + qstring = p; /* XXX leak */ + break; + default: + break; + } + + if (!server) + return NULL; p = queryformat(server, fstring, qstring); - if (verb) + if (verb) { + printf(_("Using server %s.\n"), server); printf(_("Query string: \"%s\"\n\n"), p); - strcat(p, "\r\n"); + } sockfd = openconn(server, port); - /* - * Now we are connected and the query is supposed to complete quickly. - * This will help people who run whois ... | less - */ - alarm(0); - do_query(sockfd, p); + strcat(p, "\r\n"); + server = do_query(sockfd, p); - exit(0); + /* recursion is fun */ + if (server) { + printf(_("\n\nFound a referral to %s.\n\n"), server); + handle_query(server, NULL, qstring, fstring); + } + + return NULL; } #ifdef CONFIG_FILE @@ -271,9 +268,6 @@ const char *match_config_file(const char *s) FILE *fp; char buf[512]; static const char delim[] = " \t"; -#ifdef HAVE_REGEXEC - regex_t re; -#endif if ((fp = fopen(CONFIG_FILE, "r")) == NULL) { if (errno != ENOENT) @@ -286,6 +280,7 @@ const char *match_config_file(const char *s) const char *pattern, *server; #ifdef HAVE_REGEXEC int i; + regex_t re; #endif for (p = buf; *p; p++) @@ -336,6 +331,9 @@ const char *match_config_file(const char *s) } #endif +/* Parses an user-supplied string and tries to guess the right whois server. + * Returns a statically allocated buffer. + */ const char *whichwhois(const char *s) { unsigned long ip; @@ -424,9 +422,8 @@ char *queryformat(const char *server, const char *flags, const char *query) char *buf; int i, isripe = 0; - /* +2 for \r\n; +1 for NULL */ - buf = malloc(strlen(flags) + strlen(query) + strlen(client_tag) + 4 - + 2 + 1); + /* 64 bytes reserved for server-specific flags added later */ + buf = malloc(strlen(flags) + strlen(query) + strlen(client_tag) + 64); *buf = '\0'; for (i = 0; ripe_servers[i]; i++) if (strcmp(server, ripe_servers[i]) == 0) { @@ -450,10 +447,17 @@ char *queryformat(const char *server, const char *flags, const char *query) puts(_("Warning: RIPE flags used with a traditional server.")); strcat(buf, flags); } - /* FIXME: /e is not applied to .JP ASN */ - if (!isripe && (strcmp(server, "whois.nic.mil") == 0 || + + /* why, oh why DENIC had to make whois "user friendly"? + * I hope that adding -T dn,ace will not break some queries. + */ + if (isripe && strcmp(server, "whois.denic.de") == 0 && domcmp(query, ".de") + && !strchr(query, ' ')) + sprintf(buf, "-T dn,ace -C US-ASCII %s", query); + else if (!isripe && (strcmp(server, "whois.nic.mil") == 0 || strcmp(server, "whois.nic.ad.jp") == 0) && strncasecmp(query, "AS", 2) == 0 && isasciidigit(query[2])) + /* FIXME: /e is not applied to .JP ASN */ sprintf(buf, "AS %s", query + 2); /* fix query for DDN */ else if (!isripe && strcmp(server, "whois.nic.ad.jp") == 0) { char *lang = getenv("LANG"); /* not a perfect check, but... */ @@ -466,11 +470,50 @@ char *queryformat(const char *server, const char *flags, const char *query) return buf; } -void do_query(const int sock, const char *query) +/* the first parameter contains the state of this simple state machine: + * HIDE_DISABLED: hidden text finished + * HIDE_UNSTARTED: hidden text not seen yet + * >= 0: currently hiding message hide_strings[*hiding] + */ +int hide_line(int *hiding, const char *const line) +{ + int i; + + if (*hiding == HIDE_DISABLED) { + return 0; + } else if (*hiding == HIDE_UNSTARTED) { /* looking for smtng to hide */ + for (i = 0; hide_strings[i] != NULL; i += 2) { + if (strncmp(line, hide_strings[i], strlen(hide_strings[i])) == 0) { + *hiding = i; /* start hiding */ + return 1; /* and hide this line */ + } + } + return 0; /* don't hide this line */ + } else if (*hiding > HIDE_UNSTARTED) { /* hiding something */ + if (strncmp(line, hide_strings[*hiding + 1], + strlen(hide_strings[*hiding + 1])) == 0) { + *hiding = HIDE_DISABLED; /* stop hiding */ + return 1; /* but hide the last line */ + } + return 1; /* we are hiding, so do it */ + } +#if 0 + /* XXX */ + /* no match, the action depends on the state stored in *hiding */ + if (*hiding > HIDE_UNSTARTED) + return 1; + else +#endif + return 0; +} + +/* returns a string which should be freed by the caller, or NULL */ +const char *do_query(const int sock, const char *query) { char buf[2000], *p; FILE *fi; - int i = 0, hide = hide_discl; + int hide = hide_discl; + char *referral_server = NULL; fi = fdopen(sock, "r"); if (write(sock, query, strlen(query)) < 0) @@ -479,39 +522,43 @@ void do_query(const int sock, const char *query) if (shutdown(sock, 1) < 0) err_sys("shutdown"); */ + while (fgets(buf, sizeof(buf), fi)) { - if (hide == 1) { - if (strncmp(buf, hide_strings[i+1], strlen(hide_strings[i+1]))==0) - hide = 2; /* stop hiding */ - continue; /* hide this line */ - } - 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 */ - } -#ifdef EXT_6BONE - /* % referto: whois -h whois.arin.net -p 43 as 1 */ - if (strncmp(buf, "% referto:", 10) == 0) { + /* 6bone-style referral: + * % referto: whois -h whois.arin.net -p 43 as 1 + */ + if (!referral_server && strncmp(buf, "% referto:", 10) == 0) { char nh[256], np[16], nq[1024]; if (sscanf(buf, REFERTO_FORMAT, nh, np, nq) == 3) { - int fd; - - if (verb) - printf(_("Detected referral to %s on %s.\n"), nq, nh); - strcat(nq, "\r\n"); - fd = openconn(nh, np); - do_query(fd, nq); - continue; + /* XXX we are ignoring the new query string */ + referral_server = malloc(300); + sprintf(referral_server, "%s:%s", nh, np); } } -#endif + + /* ARIN referrals: + * ReferralServer: rwhois://rwhois.fuse.net:4321/ + * ReferralServer: whois://whois.ripe.net + */ + if (!referral_server && strncmp(buf, "ReferralServer:", 15) == 0) { + char *q; + + q = strstr(buf, "rwhois://"); + if ((q = strstr(buf, "rwhois://"))) + referral_server = strdup(q + 9); + else if ((q = strstr(buf, "whois://"))) + referral_server = strdup(q + 8); + if (referral_server) { + if ((q = strchr(referral_server, '/')) + || (q = strchr(referral_server, '\n'))) + *q = '\0'; + } + } + + if (hide_line(&hide, buf)) + continue; + for (p = buf; *p && *p != '\r' && *p != '\n'; p++); *p = '\0'; fprintf(stdout, "%s\n", buf); @@ -520,15 +567,18 @@ void do_query(const int sock, const char *query) err_sys("fgets"); fclose(fi); - if (hide == 1) + if (hide > HIDE_UNSTARTED) err_quit(_("Catastrophic error: disclaimer text has been changed.\n" "Please upgrade this program.\n")); + + return referral_server; } const char *query_crsnic(const int sock, const char *query) { char *temp, buf[2000], *ret = NULL; FILE *fi; + int hide = hide_discl; int state = 0; temp = malloc(strlen(query) + 1 + 2 + 1); @@ -557,8 +607,8 @@ const char *query_crsnic(const int sock, const char *query) } /* the output must not be hidden or no data will be shown for host records and not-existing domains */ - /* XXX feel free to send a patch to hide the long disclaimer */ - fputs(buf, stdout); + if (!hide_line(&hide, buf)) + fputs(buf, stdout); } if (ferror(fi)) err_sys("fgets"); @@ -571,6 +621,7 @@ const char *query_pir(const int sock, const char *query) { char *temp, buf[2000], *ret = NULL; FILE *fi; + int hide = hide_discl; int state = 0; temp = malloc(strlen(query) + 5 + 2 + 1); @@ -599,7 +650,8 @@ const char *query_pir(const int sock, const char *query) *q = '\0'; state = 2; } - fputs(buf, stdout); + if (!hide_line(&hide, buf)) + fputs(buf, stdout); } if (ferror(fi)) err_sys("fgets"); @@ -620,6 +672,8 @@ int openconn(const char *server, const char *port) struct sockaddr_in saddr; #endif + alarm(60); + #ifdef HAVE_GETADDRINFO memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; @@ -656,6 +710,13 @@ int openconn(const char *server, const char *port) if (connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) err_sys("connect"); #endif + + /* + * Now we are connected and the query is supposed to complete quickly. + * This will help people who run whois ... | less + */ + alarm(0); + return fd; } @@ -696,15 +757,31 @@ char *normalize_domain(const char *dom) *p = '\0'; #ifdef HAVE_LIBIDN - if (idna_to_ascii_from_locale(ret, &p, 0, 0) != IDNA_SUCCESS) + if (idna_to_ascii_lz(ret, &p, 0) != IDNA_SUCCESS) { + free(ret); return ret; + } free(ret); ret = p; #endif + return ret; } +/* server and port have to be freed by the caller */ +void split_server_port(const char *const input, + const char **server, const char **port) { + char *q, *p; + + *server = q = strdup(input); + + for (p = q; *p && *p != ':'; *q++ = tolower(*p++)); + if (*p == ':') + *port = strdup(p + 1); + *p = '\0'; +} + char *convert_6to4(const char *s) { char *new = malloc(sizeof("255.255.255.255")); @@ -719,11 +796,13 @@ char *convert_6to4(const char *s) unsigned long myinet_aton(const char *s) { - int a, b, c, d; + unsigned long a, b, c, d; if (!s) return 0; - if (sscanf(s, "%d.%d.%d.%d", &a, &b, &c, &d) != 4) + if (sscanf(s, "%lu.%lu.%lu.%lu", &a, &b, &c, &d) != 4) + return 0; + if (a > 255 || b > 255 || c > 255 || d > 255) return 0; return (a << 24) + (b << 16) + (c << 8) + d; } @@ -5,12 +5,16 @@ /* Do *NOT* change it if you don't know what you are doing! */ #define IDSTRING "Md4.6" +#define HIDE_DISABLED -2 +#define HIDE_UNSTARTED -1 + /* prototypes */ const char *whichwhois(const char *); const char *match_config_file(const char *); const char *whereas(const unsigned short); char *queryformat(const char *, const char *, const char *); -void do_query(const int, const char *); +int hide_line(int *hiding, const char *const line); +const char *do_query(const int, const char *); const char *query_crsnic(const int, const char *); const char *query_pir(const int, const char *); int openconn(const char *, const char *); @@ -23,6 +27,10 @@ int domcmp(const char *, const char *); int domfind(const char *, const char *[]); char *normalize_domain(const char *); char *convert_6to4(const char *); +const char *handle_query(const char *server, const char *port, + const char *qstring, const char *fstring); +void split_server_port(const char *const input, const char **server, + const char **port); void err_quit(const char *,...); void err_sys(const char *,...); @@ -1,6 +1,6 @@ Summary: Enhanced WHOIS client Name: whois -Version: 4.6.8 +Version: 4.6.11 Release: 1 License: GPL Vendor: Marco d'Itri <md@linux.it> |