libpq not reentrant - Mailing list pgsql-bugs

From Federico Di Gregorio
Subject libpq not reentrant
Date
Msg-id 1011346135.2221.12.camel@nenya
Whole thread Raw
Responses Re: libpq not reentrant  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
hi,

this is my first post here and i don't know if there is a specific way
to report a postgresql bug apart from a 'plain' meil to this list.
anyway, here it is.

libpq claims to be reentrant; to put it shortly it isn't. the problem
arise when using crypt authentication. on the Linux/glibc2 arch, the
call to crypt() is not reentrant and crypt_r or DES/libcrypto crypt
should be used instead.

we discovered this one while investigating a problem of garbled
passwords in psycopg (the Posgresql/Python driver.) the problem
disappeared when we stopped the multithreading during PQconnectdb.
another way to solve the problem was to patch libpq to use crypt_r or
DES crypt and leaving psycopg run multithreaded.

another little note: crypt_r documentation says is enough to set to 0
the 'initialized' field of the crypt_data struct but then the crypted
strings are not the same generated by plain crypt (or DES crypt). to get
the same result a memset to 0 of the entire crypt_data struct is
required.

hope this help,
federico

--=20
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
INIT.D Developer                                           fog@initd.org
   Abandon the search for Truth; settle for a good fantasy. -- Anonymous

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #562: create plpgsql language failed
Next
From: Tom Lane
Date:
Subject: Re: libpq not reentrant