=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/whois/whois.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- src/usr.bin/whois/whois.c 2003/10/12 13:26:09 1.30 +++ src/usr.bin/whois/whois.c 2005/06/22 10:29:57 1.31 @@ -1,4 +1,4 @@ -/* $OpenBSD: whois.c,v 1.30 2003/10/12 13:26:09 jmc Exp $ */ +/* $OpenBSD: whois.c,v 1.31 2005/06/22 10:29:57 henning Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ #if 0 static const char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: whois.c,v 1.30 2003/10/12 13:26:09 jmc Exp $"; +static const char rcsid[] = "$OpenBSD: whois.c,v 1.31 2005/06/22 10:29:57 henning Exp $"; #endif #endif /* not lint */ @@ -164,7 +164,7 @@ whois(const char *query, const char *server, const char *port, int flags) { FILE *sfi, *sfo; - char *buf, *p, *nhost, *nbuf = NULL; + char *buf, *p, *nhost, *nbuf = NULL, *nquery; size_t len; int i, s, error; const char *reason = NULL; @@ -206,11 +206,20 @@ return (1); } + if (!strcmp(server, "whois.denic.de") || + !strcmp(server, "de.whois-servers.net")) { + if (asprintf(&nquery, "-T dn %s", query) == -1) + err(1, NULL); + } else { + if ((nquery = strdup(query)) == NULL) + err(1, NULL); + } + sfi = fdopen(s, "r"); sfo = fdopen(s, "w"); if (sfi == NULL || sfo == NULL) err(1, "fdopen"); - (void)fprintf(sfo, "%s\r\n", query); + (void)fprintf(sfo, "%s\r\n", nquery); (void)fflush(sfo); nhost = NULL; while ((buf = fgetln(sfi, &len)) != NULL) { @@ -254,8 +263,8 @@ } } } - if (nbuf != NULL) - free(nbuf); + free(nbuf); + free(nquery); if (nhost != NULL) { error = whois(query, nhost, port, 0);