From 902ca3e2255411d709a1ffa28dea9eda92425f77 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 6 Oct 2004 09:35:23 +0000 Subject: Here is a patch to fix win32 ssl builds. Summary of changes: * Links with -leay32 and -lssleay32 instead of crypto and ssl. On win32, "crypto and ssl" is only used for static linking. * Initializes SSL in the backend and not just in the postmaster. We cannot pass the SSL context from the postmaster through the parameter file, because it contains function pointers. * Split one error check in be-secure.c. Previously we could not tell which of three calls actually failed. The previous code also returned incorrect error messages if SSL_accept() failed - that function needs to use SSL_get_error() on the return value, can't just use the error queue. * Since the win32 implementation uses non-blocking sockets "behind the scenes" in order to deliver signals correctly, implements a version of SSL_accept() that can handle this. Also, add a wait function in case SSL_read or SSL_write() needs more data. Magnus Hagander --- src/include/pg_config.h.in | 6 ++++++ src/include/port/win32.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 2fb4adf8fb..600f4229f0 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -227,6 +227,9 @@ /* Define to 1 if you have the `dld' library (-ldld). */ #undef HAVE_LIBDLD +/* Define to 1 if you have the `eay32' library (-leay32). */ +#undef HAVE_LIBEAY32 + /* Define to 1 if you have the `gen' library (-lgen). */ #undef HAVE_LIBGEN @@ -266,6 +269,9 @@ /* Define to 1 if you have the `ssl' library (-lssl). */ #undef HAVE_LIBSSL +/* Define to 1 if you have the `ssleay32' library (-lssleay32). */ +#undef HAVE_LIBSSLEAY32 + /* Define to 1 if you have the `unix' library (-lunix). */ #undef HAVE_LIBUNIX diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 1b79271719..d3ca1f20d8 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.36 2004/10/05 14:27:07 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.37 2004/10/06 09:35:23 momjian Exp $ */ /* undefine and redefine after #include */ #undef mkdir @@ -141,6 +141,7 @@ int pgwin32_recv(SOCKET s, char *buf, int len, int flags); int pgwin32_send(SOCKET s, char *buf, int len, int flags); const char *pgwin32_socket_strerror(int err); +int pgwin32_waitforsinglesocket(SOCKET s, int what); /* in backend/port/win32/security.c */ extern int pgwin32_is_admin(void); -- cgit v1.2.1