Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved. - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved.
Date
Msg-id 20081107201029.GF5507@alvh.no-ip.org
Whole thread Raw
In response to Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved.  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved.  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian wrote:

> Thanks for the review, Magnus.  I have adjusted the patch to use the
> same mutex every time the counter is accessed, and adjusted the
> pqsecure_destroy() call to properly decrement in the right place.
> 
> Also, I renamed the libpq global destroy function to be clearer
> (the function is not exported).

There's a problem in this patch which is that it is inconsistent in its
use of the ENABLE_THREAD_SAFETY symbol.  init_ssl_system() is only going
to keep the refcount in the threaded compile; but the safeguards are
needed even when threading is not enabled.  Moreover,
destroy_ssl_system() is locking thread mutexes outside
ENABLE_THREAD_SAFETY which is going to cause non-threaded builds to
fail.

As a suggestion, I'd recommend not fooling around with backend files
when you're only modifying libpq.  It enlarges the patch without
benefit.  I think that patch should be committed separately.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: [RRR] Tests citext casts
Next
From: "Robert Haas"
Date:
Subject: Re: Updates of SE-PostgreSQL 8.4devel patches (r1197)