Skip site navigation (1) Skip section navigation (2)

Re: libpq not reentrant

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Mario Lorenz <ml(at)vdazone(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: libpq not reentrant
Date: 2002-01-25 02:20:00
Message-ID: 200201250220.g0P2K0210883@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
This has been saved for the 7.3 release:

	http://candle.pha.pa.us/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Mario Lorenz wrote:
> Tom, 
> 
> I originally worked with Federico to get the garbled passwords issue
> resolved which hit us (we use Psycopg, and Zope at work).
> 
> Federico's suggestion to use the crypt from libssl is incomplete,
> and slightly wrong. The replacement function to use is des_fcrypt()
> and it takes an additional argument, a pointer to a buffer to store
> the crypted password in. This makes it threadsafe. The OpenSSL 
> des_fcrypt() should be portable and available on all platforms where
> OpenSSL is supported. 
> 
> Since you already check for OpenSSL elsewhere, I would
> vote for that to go into 7.2, but not having contributed to PostgreSQL
> earlier I am not even in the position to articulate wishes :)
> 
> HOWEVER,
> 
> if you change the documentation about libpq regarding to thread-safeness,
> you might put a big warning in there that it may not be that thread-safe at
> all. A short grep through libpq shows the usage of
> gethostbyname(), strerror(), getpwuid() and strtok(), which according to
> glibc info pages are NOT thread-safe either, and probably should be worked
> around using the _r versions on linux/glibc and verified on the other
> platforms.
> 
> Preferably, this should be fixed before 7.2 - but thats not my call.
> 
> Note: I personally do not like threads. I am not knowledgeable in the area.
> My first threaded program I wrote last week, it was for debugging libpq as
> we had those problems. This check of libpq is based uppon grepping libc
> info pages for _r functions, and then grepping for the hits in libpq, in
> other words its more crystall ball gazing than knowledgeable debugging.
> 
> YMMV.
> 
> Have a nice weekend,
> 
> Mario
> 
> -- 
> Mario Lorenz                            Internet:    <ml(at)vdazone(dot)org>
>                                         Ham Radio:   DL5MLO(at)OK0PKL(dot)#BOH(dot)CZE(dot)EU
> * This virus needs Windows95 to run!
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2002-01-25 02:20:15
Subject: Re: libpq not reentrant
Previous:From: Bruce MomjianDate: 2002-01-25 02:04:55
Subject: Re: COPY when 'filename' is a directory

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group