diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-08-11 11:54:19 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-08-11 11:54:19 +0300 |
commit | 680513ab79c7e12e402a2aad7921b95a25a4bcc8 (patch) | |
tree | c2a5b1debb5599ae4a3522be921a78a6f1cf35c3 /src/backend/utils/init/postinit.c | |
parent | 6aa61580e08d58909b2a8845a4087b7699335ee0 (diff) | |
download | postgresql-680513ab79c7e12e402a2aad7921b95a25a4bcc8.tar.gz postgresql-680513ab79c7e12e402a2aad7921b95a25a4bcc8.zip |
Break out OpenSSL-specific code to separate files.
This refactoring is in preparation for adding support for other SSL
implementations, with no user-visible effects. There are now two #defines,
USE_OPENSSL which is defined when building with OpenSSL, and USE_SSL which
is defined when building with any SSL implementation. Currently, OpenSSL is
the only implementation so the two #defines go together, but USE_SSL is
supposed to be used for implementation-independent code.
The libpq SSL code is changed to use a custom BIO, which does all the raw
I/O, like we've been doing in the backend for a long time. That makes it
possible to use MSG_NOSIGNAL to block SIGPIPE when using SSL, which avoids
a couple of syscall for each send(). Probably doesn't make much performance
difference in practice - the SSL encryption is expensive enough to mask the
effect - but it was a natural result of this refactoring.
Based on a patch by Martijn van Oosterhout from 2006. Briefly reviewed by
Alvaro Herrera, Andreas Karlsson, Jeff Janes.
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r-- | src/backend/utils/init/postinit.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 28243ad58f9..a5b98217739 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -231,8 +231,8 @@ PerformAuthentication(Port *port) { if (am_walsender) { -#ifdef USE_SSL - if (port->ssl) +#ifdef USE_OPENSSL + if (port->ssl_in_use) ereport(LOG, (errmsg("replication connection authorized: user=%s SSL enabled (protocol=%s, cipher=%s, compression=%s)", port->user_name, SSL_get_version(port->ssl), SSL_get_cipher(port->ssl), @@ -245,8 +245,8 @@ PerformAuthentication(Port *port) } else { -#ifdef USE_SSL - if (port->ssl) +#ifdef USE_OPENSSL + if (port->ssl_in_use) ereport(LOG, (errmsg("connection authorized: user=%s database=%s SSL enabled (protocol=%s, cipher=%s, compression=%s)", port->user_name, port->database_name, SSL_get_version(port->ssl), SSL_get_cipher(port->ssl), |