]> granicus.if.org Git - postgresql/commit
Add locking around SSL_context usage in libpq
authorStephen Frost <sfrost@snowman.net>
Thu, 1 Aug 2013 05:15:45 +0000 (01:15 -0400)
committerStephen Frost <sfrost@snowman.net>
Thu, 1 Aug 2013 05:23:49 +0000 (01:23 -0400)
commit55754380f36d098551bd55dd49e27f64dd1c8d2f
treee2d117b80f33593822a458acc003a1dd2ac45fba
parent603c4a90c15f601ccf44cad3d3b04b39e4dc34eb
Add locking around SSL_context usage in libpq

I've been working with Nick Phillips on an issue he ran into when
trying to use threads with SSL client certificates.  As it turns out,
the call in initialize_SSL() to SSL_CTX_use_certificate_chain_file()
will modify our SSL_context without any protection from other threads
also calling that function or being at some other point and trying to
read from SSL_context.

To protect against this, I've written up the attached (based on an
initial patch from Nick and much subsequent discussion) which puts
locks around SSL_CTX_use_certificate_chain_file() and all of the other
users of SSL_context which weren't already protected.

Nick Phillips, much reworked by Stephen Frost

Back-patch to 9.0 where we started loading the cert directly instead of
using a callback.
src/interfaces/libpq/fe-secure.c