diff --git a/ChangeLog b/ChangeLog index 49916f7c..1b41b118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2014-07-26 Mats Erik Andersson + + whois: Cooperate with misbehaving servers. + Some servers, like "whois.ripe.net", "whois.arin.net", + and "whois.eu", partially abort communication when the + socket is closed for writing. Report by Alexander Zubkov: + . + + * whois/whois.c (gwhois_argp_options): Increase GRP + and insert a separating subheader. + (do_query): Remove call to shutdown(). The alternate + and much similar lookup call query_crsnic() did not + half-close the socket for writing. + + * doc/inetutils.texi (whois invocation): Add a section + about environment variables accessed by `whois'. + 2014-07-22 Mats Erik Andersson libls: Inconsistent options. diff --git a/doc/inetutils.texi b/doc/inetutils.texi index 9b72a973..81fd9ff3 100644 --- a/doc/inetutils.texi +++ b/doc/inetutils.texi @@ -1285,6 +1285,34 @@ Verbosely explain all actions taken. @opindex -x Search only for exact matches. Applicable only to RPSL. +@end table + +@section Environment variables +@anchor{whois environment} + +@command{whois} holds an internal list of information servers +and their assigned data bases. +Queries are examined against this list to select the most +plausible server, but the hint can always be overruled on +the command line by use of the option @option{-h}. +If neither of these have a say, then the default server to ask +is @samp{whois.internic.net}, but this name is in turn overruled +by a server name in the environment variable @env{WHOIS_SERVER}. + +@table @env +@item LANG +When the server @samp{whois.nic.ad.jp} is queried, and only then, +any non-Japanese locale in @env{LANG} will ask the server to reply +with English text, not Japanese. + +@item WHOIS_HIDE +When set, the effect on @command{whois} is as if the +option @option{-H} had been given. + +@item WHOIS_SERVER +Data base server to query when internal hinting is inconclusive. +When unset, @samp{whois.internic.net} is used as default server. + @end table diff --git a/whois/whois.c b/whois/whois.c index ec720b01..386ea8ed 100644 --- a/whois/whois.c +++ b/whois/whois.c @@ -126,7 +126,8 @@ static struct argp ripe_argp = { ripe_argp_options, ripe_argp_parser, NULL, NULL, NULL, NULL, NULL }; static struct argp_option gwhois_argp_options[] = { -#define GRP 10 +#define GRP 20 + { NULL, 0, NULL, 0, "General options", GRP }, { "verbose", 'V', NULL, 0, "explain what is being done", GRP }, { "server", 'h', "HOST", 0, @@ -470,8 +471,7 @@ do_query (const int sock, const char *query) fi = fdopen (sock, "r"); if (write (sock, query, strlen (query)) < 0) err_sys ("write"); - if (shutdown (sock, 1) < 0) - err_sys ("shutdown"); + while (fgets (buf, 200, fi)) { /* XXX errors? */ if (hide == 1) @@ -541,6 +541,7 @@ query_crsnic (const int sock, const char *query) fi = fdopen (sock, "r"); if (write (sock, temp, strlen (temp)) < 0) err_sys ("write"); + while (fgets (buf, 100, fi)) { /* If there are multiple matches only the server of the first record