Package: jwhois
Version: 4.0-1
Severity: normal
Tags: patch

With the current version of jwhois, I can't do IP address lookups. It fails
to connect to whois.arin.net, whois.ripe.net, and whois.apnic.net. These
lookups used to work with some older version (I'm not sure which).

The problem is in make_connect() in utils.c, the part that loops over the
list of results obtained from lookup_host_addrinfo(). After attempting to
make a connection, it does this:

      error = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &retval, &retlen);
      if (error < 0 || retval)
        {
          break;
        }

The intent was apparently to break out of the loop when a successful
connection occurs, but the retval test does the opposite, breaking out when a
connection fails.

With whois.arin.net for example, there are 2 IPv4 addresses and an IPv6
address. This loop connects to the first address successfully, so the
getsockopt results in error=0 retval=0, so it doesn't break. The next time
through the loop, it connects to the second address successfully, and doesn't
break. The third time, it fails to connect to the third address, because I
don't have IPv6. Now the loop ends and the function returns -1, failed to
connect, and the results look like this:

$ whois 199.232.41.10
[Querying whois.arin.net]
[Error creating socket]
[Unable to connect to remote host]

(Horrible error reporting, no strerror(errno) in it anywhere)

This patch gets it working again.

--- src/utils.c 2007-06-26 02:00:20.000000000 -0500
+++ src/utils.c 2009-08-17 23:35:09.000000000 -0500
@@ -288,7 +288,7 @@
 
       retlen = sizeof(retval);
       error = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &retval, &retlen);
-      if (error < 0 || retval)
+      if (error < 0 || !retval)
        {
          break;
        }

-- Syster Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.30.2
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages jwhois depends on:
ii  adduser                       3.110      add and remove users and groups
ii  dpkg                          1.14.25    Debian package management system
ii  libc6                         2.7-18     GNU C Library: Shared libraries
ii  libgdbm3                      1.8.3-3    GNU dbm database routines (runtime

Versions of packages jwhois recommends:
pn  lynx                          <none>     (no description available)

jwhois suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to