Skip to Content.
Sympa Menu

freetds - [freetds] Strange TODO

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Strange TODO
  • Date: Fri, 18 Jul 2008 10:36:09 +0200

I readed in TODO:

Broken:
. HAVE_FUNC_GETSERVBYNAME_R_6 is defined by configure as 1 on
NetBSD 2.0 even though it's not defined by the OS.

I think that the problem is related on how test is done (see
m4/ac_raf_func_which_getservbyname_r.m4). Mainly test is done using
AC_LINK_IFELSE however
this just test that function is present but not the full declaration. I found
these
informations

http://osdir.com/ml/kde.devel.buildsystem/2006-03/msg00463.html
there is no definition for getservbyname_r
http://mail.kde.org/pipermail/kde-buildsystem/2006-March/001925.html
getservbyname should be thread-safe, but looking at code
http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/lib/libc/net/getservbyname.c?rev=1.13
is not! _servent_data is a normal structure so accessing outside
getservbyname is not
thread-safe !!
(consider two threads accessing getservbyname)
http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-3-1/src/lib/libc/net/getservbyname_r.c
http://ftp.nluug.nl/pub/os/NetBSD/NetBSD-release-4-0/src/lib/libc/net/getservbyname.c
all use 4 parameter function

servent_data should not be defined in netdb.h so compile (and link) should
fails...

Well..
http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/include/netdb.h.diff?r1=1.50;r2=1.51;f=
h

"Move the (at this time private) get{proto,serv}ent_r() prototypes and
data structures into the libc sources until the interface gets redone.
Approved by christos."

here they moved declaration to private header. Which version of netdb.h have
NetBSD 2.0 ??
I bet is > 1.50 so test link correctly testing for 6 parametesr (with 4 if
fails cause
servent_data is not defined).

So to sum up:
- AC_LINK_IFELSE is unable to test different versions
- first tests that compile just win

How to fix all these problems??
- we have no safe source for servent_data (private libc header is not
installed).
- we can implement a thread-safe getservbyname locking _servent_mutex
directly and call
getservbyname_r (not that clean) and endservent_r (avoid leaks).
- use getaddrinfo, is it thread-safe under NetBSD ??
- other solutions ??

freddy77

Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.24.

Top of Page