Here's the tiny patch so libpq users don't have to include the openssl headers in their programs. -- Martijn van Oosterhout <[email protected]> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
? src/interfaces/libpq/libpq.so.4.1
? src/interfaces/libpq/libpq.so.4.2
Index: src/interfaces/libpq/fe-secure.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v
retrieving revision 1.75
diff -u -r1.75 fe-secure.c
--- src/interfaces/libpq/fe-secure.c 5 Mar 2006 15:59:09 -0000 1.75
+++ src/interfaces/libpq/fe-secure.c 15 Apr 2006 13:03:09 -0000
@@ -1220,9 +1220,9 @@
}
/*
- * Return pointer to SSL object.
+ * Return pointer to OpenSSL object.
*/
-SSL *
+void *
PQgetssl(PGconn *conn)
{
if (!conn)
Index: src/interfaces/libpq/libpq-fe.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/libpq-fe.h,v
retrieving revision 1.126
diff -u -r1.126 libpq-fe.h
--- src/interfaces/libpq/libpq-fe.h 20 Mar 2006 15:07:05 -0000 1.126
+++ src/interfaces/libpq/libpq-fe.h 15 Apr 2006 13:03:09 -0000
@@ -28,11 +28,6 @@
*/
#include "postgres_ext.h"
-/* SSL type is needed here only to declare PQgetssl() */
-#ifdef USE_SSL
-#include <openssl/ssl.h>
-#endif
-
/* Application-visible enum types */
typedef enum
@@ -271,12 +266,9 @@
extern int PQclientEncoding(const PGconn *conn);
extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
-#ifdef USE_SSL
-/* Get the SSL structure associated with a connection */
-extern SSL *PQgetssl(PGconn *conn);
-#else
+/* Get the OpenSSL structure associated with a connection. Returns NULL for
+ * unencrypted connections or if any other TLS library is in use. */
extern void *PQgetssl(PGconn *conn);
-#endif
/* Tell libpq whether it needs to initialize OpenSSL */
extern void PQinitSSL(int do_init);
signature.asc
Description: Digital signature
