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".
This commit is contained in:
Tony Finch 2016-03-31 12:13:01 +00:00
parent 055dba6df1
commit 8efb5aa133
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297449

View file

@ -431,9 +431,13 @@ whois(const char *query, const char *hostname, int flags)
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);