libpq not reentrant

From: Federico Di Gregorio <fog(at)initd(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: libpq not reentrant
Date: 2002-01-18 09:28:54
Message-ID: 1011346135.2221.12.camel@nenya
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Samuele Brignoli 2002-01-18 11:45:19 odbc error
Previous Message Hasan Ahmed 2002-01-18 01:37:09 build problem with postgresql on AIX 4.3.3