From owner-freebsd-bugs Mon Sep 16 5:30: 8 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C840437B400 for ; Mon, 16 Sep 2002 05:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CDFC43E6E for ; Mon, 16 Sep 2002 05:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g8GCU2JU094165 for ; Mon, 16 Sep 2002 05:30:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g8GCU2GG094164; Mon, 16 Sep 2002 05:30:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D729537B400 for ; Mon, 16 Sep 2002 05:22:11 -0700 (PDT) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id A184B43E4A for ; Mon, 16 Sep 2002 05:22:10 -0700 (PDT) (envelope-from andre.albsmeier@mchp.siemens.de) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.11.6/8.11.6) with ESMTP id g8GCM3d06994 for ; Mon, 16 Sep 2002 14:22:04 +0200 (MEST) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) by mail3.siemens.de (8.11.6/8.11.6) with ESMTP id g8GCM3407849 for ; Mon, 16 Sep 2002 14:22:03 +0200 (MEST) Received: (from localhost) by curry.mchp.siemens.de (8.12.5/8.12.5) id g8GCM3t7034049 for FreeBSD-gnats-submit@freebsd.org; Mon, 16 Sep 2002 14:22:03 +0200 (CEST) Message-Id: <200209161222.g8GCM241002371@curry.mchp.siemens.de> Date: Mon, 16 Sep 2002 14:22:02 +0200 (CEST) From: Andre Albsmeier To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/42834: [PATCH] for whois to find APNIC hosts again Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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