summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2003-01-31 21:57:10 +0000
committerroberto <roberto@FreeBSD.org>2003-01-31 21:57:10 +0000
commit63438f7ba7bcb7289f87a6c5a37636d4ddaf7329 (patch)
tree0ed16a03c61a7067fc7818a10c865cce7ad5f77e /usr.bin
parentac892a92343b12afcb5039f4040af988c146ea43 (diff)
downloadFreeBSD-src-63438f7ba7bcb7289f87a6c5a37636d4ddaf7329.zip
FreeBSD-src-63438f7ba7bcb7289f87a6c5a37636d4ddaf7329.tar.gz
The newly appointed .org registrar has a pecular output format so
whois doesn't follow the link to the authoritative registrar. Fix it. PR: bin/47770 Submitted by: Alain Thivillon <at@rominet.net> MFC after: 7 days
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/whois/whois.c16
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++) {
OpenPOWER on IntegriCloud