bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] whois: Fix incorrect service name lookup


From: Shahab Vahedi
Subject: [PATCH] whois: Fix incorrect service name lookup
Date: Thu, 30 Jan 2020 09:36:51 +0100

Hello developer(s),

I have encountered the following issue in whois.c and came up with
the proposed patch afterwards.

Cheers,
Shahab

whois consults the /etc/services provided by IANA to determine the
port number for the "whois" service. However, the "whois" service is
not listed in that file and when you run whois you will end up with
the following error:

> whois 4.2.2.4
  getaddrinfo: Servname not supported for ai_socktype

This patch makes use of "nicname" port which is the current standard
name for "whois" service that is listed in /etc/services.

--- inetutils-1.9.4/whois/whois.c.orig  2015-03-31 17:40:50.000000000 +0200
+++ inetutils-1.9.4/whois/whois.c       2020-01-24 23:39:58.118057297 +0100
@@ -576,7 +576,7 @@ openconn (const char *server, const char
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
 
-  if ((i = getaddrinfo (server, port ? port : "whois", &hints, &res)) != 0)
+  if ((i = getaddrinfo (server, port ? port : "nicname", &hints, &res)) != 0)
     err_quit ("getaddrinfo: %s", gai_strerror (i));
 
   for (ressave = res; res; res = res->ai_next)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]