diff options
| author | Tony Finch <fanf@FreeBSD.org> | 2016-01-23 01:20:58 +0000 |
|---|---|---|
| committer | Tony Finch <fanf@FreeBSD.org> | 2016-01-23 01:20:58 +0000 |
| commit | f537d420bf785ce2bdd4245ff9f556178ae4c62f (patch) | |
| tree | 866686b035e77c47e5d0b2b4e7c283a628223ce8 | |
| parent | 6f4d88df9f3f272c006118386a158bb2bf5a3c08 (diff) | |
Notes
| -rw-r--r-- | usr.bin/whois/whois.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index e7bf94fc81634..1630067f15ce0 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -61,7 +61,8 @@ __FBSDID("$FreeBSD$"); #define ABUSEHOST "whois.abuse.net" #define ANICHOST "whois.arin.net" -#define DENICHOST "de" QNICHOST_TAIL +#define DENICHOST "whois.denic.de" +#define DKNICHOST "whois.dk-hostmaster.dk" #define FNICHOST "whois.afrinic.net" #define GNICHOST "whois.nic.gov" #define IANAHOST "whois.iana.org" @@ -415,17 +416,24 @@ done: err(EX_OSERR, "fdopen()"); if (!(flags & WHOIS_SPAM_ME) && - strcmp(hostname, DENICHOST) == 0) - fprintf(fp, "-T dn,ace -C ISO-8859-1 %s\r\n", query); - else if (!(flags & WHOIS_SPAM_ME) && - strcmp(hostname, "dk" QNICHOST_TAIL) == 0) + (strcasecmp(hostname, DENICHOST) == 0 || + strcasecmp(hostname, "de" QNICHOST_TAIL) == 0)) { + const char *q; + int idn = 0; + for (q = query; *q != '\0'; q++) + if (!isascii(*q)) + idn = 1; + fprintf(fp, "-T dn%s %s\r\n", idn ? "" : ",ace", query); + } else if (!(flags & WHOIS_SPAM_ME) && + (strcasecmp(hostname, DKNICHOST) == 0 || + strcasecmp(hostname, "dk" QNICHOST_TAIL) == 0)) fprintf(fp, "--show-handles %s\r\n", query); else if ((flags & WHOIS_SPAM_ME) || strchr(query, ' ') != NULL) fprintf(fp, "%s\r\n", query); - else if (strcmp(hostname, ANICHOST) == 0) + else if (strcasecmp(hostname, ANICHOST) == 0) fprintf(fp, "+ %s\r\n", query); - else if (strcmp(hostres->ai_canonname, VNICHOST) == 0) + else if (strcasecmp(hostres->ai_canonname, VNICHOST) == 0) fprintf(fp, "domain %s\r\n", query); else fprintf(fp, "%s\r\n", query); |
