aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/pg_config.h.in3
-rw-r--r--src/interfaces/libpq/fe-secure-openssl.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index f98f773ff02..ea3b2b6ce77 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -479,6 +479,9 @@
/* Define to 1 if you have the `srandom' function. */
#undef HAVE_SRANDOM
+/* Define to 1 if you have the `SSL_clear_options' function. */
+#undef HAVE_SSL_CLEAR_OPTIONS
+
/* Define to 1 if you have the `SSL_get_current_compression' function. */
#undef HAVE_SSL_GET_CURRENT_COMPRESSION
diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 1a35b30dbcd..2e2f1074fcb 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1194,9 +1194,17 @@ initialize_SSL(PGconn *conn)
#ifdef SSL_OP_NO_COMPRESSION
if (conn->sslcompression && conn->sslcompression[0] == '0')
SSL_set_options(conn->ssl, SSL_OP_NO_COMPRESSION);
+ /*
+ * Mainline OpenSSL introduced SSL_clear_options() before
+ * SSL_OP_NO_COMPRESSION, so this following #ifdef should not be
+ * necessary, but some old NetBSD version have a locally modified libssl
+ * that has SSL_OP_NO_COMPRESSION but not SSL_clear_options().
+ */
+#ifdef HAVE_SSL_CLEAR_OPTIONS
else
SSL_clear_options(conn->ssl, SSL_OP_NO_COMPRESSION);
#endif
+#endif
return 0;
}