]> granicus.if.org Git - postgresql/blobdiff - src/interfaces/libpq/libpq-int.h
Properly initialize SSL engines when used from libpq. This is required for
[postgresql] / src / interfaces / libpq / libpq-int.h
index f4d6315a569b58d749f15dbbfcb70eb47780074f..51b7128b862c292bddf09c69a559ef28b13efeb8 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.142 2009/06/11 14:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.143 2009/06/23 18:13:23 mha Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,8 +76,13 @@ typedef struct
 #ifdef USE_SSL
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+
+#if (SSLEAY_VERSION_NUMBER >= 0x00907000L) && !defined(OPENSSL_NO_ENGINE)
+#define USE_SSL_ENGINE
 #endif
 
+#endif /* USE_SSL */
+
 /*
  * POSTGRES backend dependent Constants.
  */
@@ -383,7 +388,13 @@ struct pg_conn
        X509       *peer;                       /* X509 cert of server */
        char            peer_dn[256 + 1];               /* peer distinguished name */
        char            peer_cn[SM_USER + 1];   /* peer common name */
+#ifdef USE_SSL_ENGINE
+       ENGINE     *engine;                     /* SSL engine, if any */
+#else
+       void       *engine;                     /* dummy field to keep struct the same
+                                                                  if OpenSSL version changes */
 #endif
+#endif /* USE_SSL */
 
 #ifdef ENABLE_GSS
        gss_ctx_id_t gctx;                      /* GSS context */