[freetds] Strange TODO

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

I readed in TODO:

. 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

there is no definition for getservbyname_r
getservbyname should be thread-safe, but looking at code
is not! _servent_data is a normal structure so accessing outside getservbyname is not
thread-safe !!
(consider two threads accessing getservbyname)
all use 4 parameter function

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


"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 ??


-------------- 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