Date: Mon, 16 Sep 2002 14:22:02 +0200 (CEST) From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/42834: [PATCH] for whois to find APNIC hosts again Message-ID: <200209161222.g8GCM241002371@curry.mchp.siemens.de>
next in thread | raw e-mail | index | archive | help
>Number: 42834
>Category: bin
>Synopsis: [PATCH] for whois to find APNIC hosts again
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 16 05:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Andre Albsmeier
>Release: FreeBSD 4.7-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD 4.7-PRERELEASE #1: Mon Sep 16 10:39:46 CEST 2002
>Description:
When doing a "whois IP-Address" the various whois servers should be
queried recursively for an answer. This is done by matching the
answer of a query to whois.arin.net (ANICHOST) against specific
keywords defined in { RNICHOST, PNICHOST, BNICHOST, NULL } to find
the next server for querying.
This doesn't work for PNICHOST anymore since PNICHOST is defined
with lowercase letters but the answer of whois.arin.net contains
uppercase letters:
% whois 211.172.193.100
...
Comment: This IP address range is not registered in the ARIN database.
For details, refer to the APNIC Whois Database via
WHOIS.APNIC.NET or http://www.apnic.net/apnic-bin/whois2.pl
^^^^^^^^^^^^^^^
** IMPORTANT NOTE: APNIC is the Regional Internet Registry
for the Asia Pacific region. APNIC does not operate networks
...
>How-To-Repeat:
whois 211.172.193.100
>Fix:
Ignore the case when matching the keywords. To see if it works, I use
the patch below. A nicer solution would be to create a new library
function: char *strncasestr(const char *big, const char *little, size_t len);
and use this one :-)
The patch converts the contents of the received buffer into lowercase
letters befor performing the match. This has no sideeffects since the
buffer is not used anymore:
--- usr.bin/whois/whois.c.ORI Mon Feb 18 08:42:29 2002
+++ usr.bin/whois/whois.c Mon Sep 16 14:04:15 2002
@@ -287,6 +287,8 @@
s_asprintf(&nhost, "%.*s",
(int)(buf + len - host), host);
} else if (strcmp(hostname, ANICHOST) == 0) {
+ for (i = 0; i <= (int)len; i++)
+ buf[i] = tolower(buf[i]);
for (i = 0; ip_whois[i] != NULL; i++) {
if (strnstr(buf, ip_whois[i], len) !=
NULL) {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209161222.g8GCM241002371>
