summaryrefslogtreecommitdiff
path: root/usr.bin/whois
diff options
context:
space:
mode:
authorTony Finch <fanf@FreeBSD.org>2016-03-31 12:13:01 +0000
committerTony Finch <fanf@FreeBSD.org>2016-03-31 12:13:01 +0000
commit8efb5aa133377471301bad72273e7166cda36a71 (patch)
tree7e36bc8fc0fbac03b39b8d7796a83b46ca4ab859 /usr.bin/whois
parent055dba6df12480698e1d6f287fca51d848c6a26d (diff)
downloadsrc-test-8efb5aa133377471301bad72273e7166cda36a71.tar.gz
src-test-8efb5aa133377471301bad72273e7166cda36a71.zip
Fix whois queries for ARIN AS numbers.
The ARIN whois server likes AS number queries to be in the form "a 8075" rather than "as7085".
Notes
Notes: svn path=/head/; revision=297449
Diffstat (limited to 'usr.bin/whois')
-rw-r--r--usr.bin/whois/whois.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
index 1630067f15ce0..49b20057722bb 100644
--- a/usr.bin/whois/whois.c
+++ b/usr.bin/whois/whois.c
@@ -431,9 +431,13 @@ done:
else if ((flags & WHOIS_SPAM_ME) ||
strchr(query, ' ') != NULL)
fprintf(fp, "%s\r\n", query);
- else if (strcasecmp(hostname, ANICHOST) == 0)
- fprintf(fp, "+ %s\r\n", query);
- else if (strcasecmp(hostres->ai_canonname, VNICHOST) == 0)
+ else if (strcasecmp(hostname, ANICHOST) == 0) {
+ if (strncasecmp(query, "AS", 2) == 0 &&
+ strspn(query+2, "0123456789") == strlen(query+2))
+ fprintf(fp, "+ a %s\r\n", query+2);
+ else
+ fprintf(fp, "+ %s\r\n", query);
+ } else if (strcasecmp(hostres->ai_canonname, VNICHOST) == 0)
fprintf(fp, "domain %s\r\n", query);
else
fprintf(fp, "%s\r\n", query);