Ticket #705 (closed defect: fixed)

Opened 4 years ago

Last modified 13 months ago

proxy name resolving

Reported by: pgrund Owned by:
Priority: normal Milestone: 1.3.4
Component: system Version: 1.3.0
Keywords: Cc:

Description (last modified by erijo) (diff)

licq seems not to be able to resolve a hostname that is defined in the /etc/hosts file. For example i added a host named "proxy" to my hosts file to ease the usage of my notebook within different networks. any other programs like firefox resolv proxy correctly, but licq doesn't. after a while of debugging, i found out, that licq uses the method gethostbyname_r, which returns HOST_NOT_FOUND event if the host should have been found in the hosts file. (my hosts.conf tells my system to lookup the hosts file too). so, i just commented out the lines 132 to 136 in proxy.cpp. needless to say, i works pretty good right now! btw, licq is really a very very nice messenger! great work!

regards, peter

Change History

Changed 4 years ago by emostar

Logged In: YES user_id=21415

What is your version of Glibc? We have to call the get..._r function so it will work properly with threading. If you use the other one, you may experience some problems. Sounds like a Glibc bug, as it should be working like the normal non-thread safe function.

Changed 4 years ago by pgrund

Logged In: YES user_id=364075

my glibc is of version 2.3.2.

Changed 4 years ago by hefe

Logged In: YES user_id=276828

the described scenario (alias in /etc/hosts pointing to an proxy ip) works under: gentoo linux glibc-2.3.4.20041102-r1 and cvs licq Compiled on: Apr 23 2005

Changed 3 years ago by errror

Logged In: YES user_id=137347

The reason is, that gethostbyname is not used correctly (at least on Linux, which I can test here). From the manual page: Glibc2 also has reentrant versions gethostbyname_r() and gethostbyname2_r(). These return 0 on success and nonzero on error. Thus, licq should not look herror always but only if the gethostbyname_r call returns nonzero. This patch for src/support.c fixes that. --- src/support.c 24 May 2003 12:26:43 -0000 1.10 +++ src/support.c 28 Oct 2005 12:47:35 -0000 @@ -237,8 +237,9 @@

#if defined(GLIBC)

struct hostent *h_buf; int herror = 0;

- gethostbyname_r(szHostName, h, buf, buflen, &h_buf, &herror); - return herror; + int retval = 0; + retval = gethostbyname_r(szHostName, h, buf, buflen, &h_buf, &herror); + return ((retval != 0) ? herror : 0);

// Solaris, Irix

#elif defined(sun) defined(sgi)

struct hostent *h_buf;

@all developers: Can you please include it into your code? Thanks.

Changed 3 years ago by errror

Logged In: YES user_id=137347

Sourceforge is unable to display small diffs correctly. You can find it in a readable form in http://www.mpi-inf.mpg.de/~pcernko/licq_src_support_c.diff .

Changed 2 years ago by erijo

  • status changed from new to closed
  • resolution changed from None to fixed
  • description modified (diff)
  • milestone set to 1.3.4

Fixed in [4489]. See commit message for more information.

Changed 13 months ago by anonymous

  • milestone 1.3.4 deleted

Milestone 1.3.4 deleted

Changed 13 months ago by erijo

  • milestone set to 1.3.4
Note: See TracTickets for help on using tickets.