1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Properly unregister OpenSSL callbacks when libpq is done with

it's connection. This is required for applications that unload
the libpq library (such as PHP) in which case we'd otherwise
have pointers to these functions when they no longer exist.

This needs a bit more testing before we can consider a backpatch,
so not doing that yet.

In passing, remove unused functions in backend/libpq.

Bruce Momjian and Magnus Hagander, per report and analysis
by Russell Smith.
This commit is contained in:
Magnus Hagander
2008-12-03 20:04:26 +00:00
parent c37951ebe9
commit 4e81628653
2 changed files with 125 additions and 72 deletions

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.86 2008/11/20 09:29:36 mha Exp $
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.87 2008/12/03 20:04:26 mha Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
@ -88,7 +88,6 @@ static DH *tmp_dh_cb(SSL *s, int is_export, int keylength);
static int verify_cb(int, X509_STORE_CTX *);
static void info_cb(const SSL *ssl, int type, int args);
static void initialize_SSL(void);
static void destroy_SSL(void);
static int open_server_SSL(Port *);
static void close_SSL(Port *);
static const char *SSLerrmessage(void);
@ -192,17 +191,6 @@ secure_initialize(void)
return 0;
}
/*
* Destroy global context
*/
void
secure_destroy(void)
{
#ifdef USE_SSL
destroy_SSL();
#endif
}
/*
* Indicate if we have loaded the root CA store to verify certificates
*/
@ -843,19 +831,6 @@ initialize_SSL(void)
}
}
/*
* Destroy global SSL context.
*/
static void
destroy_SSL(void)
{
if (SSL_context)
{
SSL_CTX_free(SSL_context);
SSL_context = NULL;
}
}
/*
* Attempt to negotiate SSL connection.
*/