Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved.

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Russell Smith <mr-russ(at)pws(dot)com(dot)au>, PoolSnoopy <tlatzelsberger(at)gmx(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Re: [BUGS] libpq does not manage SSL callbacks properly when other libraries are involved.
Date: 2008-11-07 23:21:53
Message-ID: 200811072321.mA7NLr020627@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Alvaro Herrera wrote:
> 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,

Actually, CRYPTO_set_locking_callback() and CRYPTO_set_id_callbac() are
needed only for threaded SSL programs; I have added a comments
mentioning that.

> destroy_ssl_system() is locking thread mutexes outside
> ENABLE_THREAD_SAFETY which is going to cause non-threaded builds to
> fail.

Yes, my defines were very messed up; updated version attached.

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

OK, I will do that, though the backend change is being made to be
consistent with the front end.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/pgpatches/ssl text/x-diff 9.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2008-11-10 10:13:03 Re: BUG #4516: FOUND variable does not work after RETURN QUERY
Previous Message Luiz K. Matsumura 2008-11-07 22:30:04 Bug fix request for 08.03.0400 ( was [BUGS] Behavior change of FK info query)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-07 23:24:12 Re: Updated backslash consistency patch
Previous Message Alvaro Herrera 2008-11-07 23:21:48 Re: Updated backslash consistency patch