summaryrefslogtreecommitdiff
path: root/net/ipw/patches/patch-ab
blob: f2414119b87cebc42d7e19bfb98e6b812f3f81cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$NetBSD: patch-ab,v 1.1 2003/12/15 17:02:22 agc Exp $

--- ipw.c.orig	1999-03-30 08:04:12.000000000 +0100
+++ ipw.c	2003-12-15 16:58:12.000000000 +0000
@@ -782,7 +782,7 @@
   if (!p)
     return NULL;
 
-  for (q = p + rwhois_prefix_len; *q && !isspace (*q); q++)
+  for (q = p + rwhois_prefix_len; *q && !isspace (*q) && *q != ':'; q++)
     continue;
   srvr_len = q - p;
   server = (char *) xmalloc (srvr_len + 1);
@@ -1745,14 +1745,14 @@
     {
       static char const ripe1[] = "European Regional Internet Registry/RIPE";
       static char const ripe2[] = "RIPE NCC (NET-RIPE-NCC-";
-      static char const apnic[] = "Asia Pacific Network Information Center";
+      static char const apnic[] = "Asia Pacific Network Information Centre";
       static char const nomatch[] = "No match";
       static char const updated[] = "Record last updated on ";
       static char const hostname[] = "Hostname:";
       auto char arin_query[200];
 
 try_next_addr:
-      strcpy (arin_query, "net ");
+      strcpy (arin_query, "n ");
       strcat (arin_query, dotted_blockname);
       whois_data = whois (arin_server, arin_query);
       if (whois_data == NULL)  /* Server must be down!  */
@@ -1760,8 +1760,15 @@
       if (strncmp (whois_data, nomatch, sizeof nomatch -1))
 	{
 	  register char const *rwhois_data;
+	  char const *orgname = strstr (whois_data, "OrgName:");
 
-          if (!strncmp (whois_data, ripe1, sizeof ripe1 - 1))
+	  if (orgname)
+	    {
+	      orgname += sizeof "OrgName:";
+	      while (isspace (*orgname))
+		orgname++;
+	    }
+          if (orgname && !strncmp (orgname, ripe1, sizeof ripe1 - 1))
 	    {
               if (try_ripe (dotted_quad))
                 break;
@@ -1769,7 +1776,7 @@
                 return 0;
 	    }
 
-          if (!strncmp (whois_data, ripe2, sizeof ripe2 - 1))
+          if (orgname && !strncmp (orgname, ripe2, sizeof ripe2 - 1))
 	    {
               if (try_ripe (dotted_quad))
                 break;
@@ -1777,7 +1784,7 @@
                 return 0;
 	    }
 
-          if (!strncmp (whois_data, apnic, sizeof apnic - 1))
+          if (orgname && !strncmp (orgname, apnic, sizeof apnic - 1))
 	    {
               if (try_apnic (dotted_quad))
                 break;
@@ -1802,6 +1809,7 @@
 	      goto try_next_addr;
 	    }
 
+#if 0	/* needs fixing */
           if (!substr (whois_data, updated))
             {
               /* Handle a special case.  ARIN has returned to us a list of
@@ -1813,6 +1821,7 @@
               if ((whois_data = arin_grunge (whois_data, addr)) == NULL)
 		return 1;
             }
+#endif
 	  if ((rwhois_data = fetch_rwhois_data (whois_data, dotted_quad)))
 	    return present_rwhois_style_results (rwhois_data, whois_data);
 	  else