[freetds] Strange TODO

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Fri Jul 18 04:36:09 EDT 2008


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3129 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080718/36121d6b/attachment.bin 


More information about the FreeTDS mailing list