diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/whois/whois.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index c0473aa..94e898b 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #define BNICHOST "whois.registro.br" #define DEFAULT_PORT "whois" #define WHOIS_SERVER_ID "Whois Server: " +#define WHOIS_ORG_SERVER_ID "Registrant Street1:Whois Server:" #define WHOIS_RECURSE 0x01 #define WHOIS_QUICK 0x02 @@ -295,7 +296,20 @@ whois(const char *query, const char *hostname, int flags) } s_asprintf(&nhost, "%.*s", (int)(buf + len - host), host); - } else if (strcmp(hostname, ANICHOST) == 0) { + } + else if ((host = strnstr(buf, WHOIS_ORG_SERVER_ID, len)) + != NULL) { + host += sizeof(WHOIS_ORG_SERVER_ID) - 1; + for (p = host; p < buf + len; p++) { + if (!ishost(*p)) { + *p = '\0'; + break; + } + } + s_asprintf(&nhost, "%.*s", + (int)(buf + len - host), host); + } + else if (strcmp(hostname, ANICHOST) == 0) { for (c = 0; c <= len; c++) buf[c] = tolower((int)buf[c]); for (i = 0; ip_whois[i] != NULL; i++) { |