diff options
author | fanf <fanf@FreeBSD.org> | 2016-03-31 12:13:01 +0000 |
---|---|---|
committer | fanf <fanf@FreeBSD.org> | 2016-03-31 12:13:01 +0000 |
commit | b951056e8c671838da09814f3930cc0008aecffb (patch) | |
tree | 7e36bc8fc0fbac03b39b8d7796a83b46ca4ab859 /usr.bin/whois | |
parent | aefd0bb44bb2178cfa820f770fd05856de4e94da (diff) | |
download | FreeBSD-src-b951056e8c671838da09814f3930cc0008aecffb.zip FreeBSD-src-b951056e8c671838da09814f3930cc0008aecffb.tar.gz |
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".
Diffstat (limited to 'usr.bin/whois')
-rw-r--r-- | usr.bin/whois/whois.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index 1630067..49b2005 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); |