aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2020-05-16 16:20:43 -0400
committerAndrew Dunstan <andrew@dunslane.net>2020-05-16 16:20:43 -0400
commit36d1087611bf96b0cd716666fc8c4a2d168fa501 (patch)
treed7e1f264f4d9cb19fbff1f616385152ecb194d63 /src
parent1cbc143f06113cbd1b94790c0781aa4b410cffc2 (diff)
downloadpostgresql-36d1087611bf96b0cd716666fc8c4a2d168fa501.tar.gz
postgresql-36d1087611bf96b0cd716666fc8c4a2d168fa501.zip
Rename PQsetSSLKeyPassHook and friends
4dc6355210 provided a way for libraries and clients to modify how libpq handles client certificate passphrases, by installing a hook. However, these routines are quite specific to how OpenSSL works, so it's misleading and not future-proof to have these names not refer to OpenSSL. Change all the names to add "_OpenSSL" after "Hook", and fix the docs accordingly. Author: Daniel Gustafsson Discussion: https://postgr.es/m/981DE552-E399-45C2-9F60-3F0E3770CC61@yesql.se
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/fe-secure-openssl.c10
-rw-r--r--src/interfaces/libpq/fe-secure.c8
-rw-r--r--src/interfaces/libpq/libpq-fe.h10
3 files changed, 14 insertions, 14 deletions
diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 34634da1ede..7d45fbf86b9 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -95,7 +95,7 @@ static long win32_ssl_create_mutex = 0;
#endif
#endif /* ENABLE_THREAD_SAFETY */
-static PQsslKeyPassHook_type PQsslKeyPassHook = NULL;
+static PQsslKeyPassHook_OpenSSL_type PQsslKeyPassHook = NULL;
static int ssl_protocol_version_to_openssl(const char *protocol);
/* ------------------------------------------------------------ */
@@ -1669,7 +1669,7 @@ err:
* prevent openssl from ever prompting on stdin.
*/
int
-PQdefaultSSLKeyPassHook(char *buf, int size, PGconn *conn)
+PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
{
if (conn->sslpassword)
{
@@ -1686,14 +1686,14 @@ PQdefaultSSLKeyPassHook(char *buf, int size, PGconn *conn)
}
}
-PQsslKeyPassHook_type
+PQsslKeyPassHook_OpenSSL_type
PQgetSSLKeyPassHook(void)
{
return PQsslKeyPassHook;
}
void
-PQsetSSLKeyPassHook(PQsslKeyPassHook_type hook)
+PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook)
{
PQsslKeyPassHook = hook;
}
@@ -1711,7 +1711,7 @@ PQssl_passwd_cb(char *buf, int size, int rwflag, void *userdata)
if (PQsslKeyPassHook)
return PQsslKeyPassHook(buf, size, conn);
else
- return PQdefaultSSLKeyPassHook(buf, size, conn);
+ return PQdefaultSSLKeyPassHook_OpenSSL(buf, size, conn);
}
/*
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index b455b45e964..3311fd7a5bd 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -431,20 +431,20 @@ PQsslAttributeNames(PGconn *conn)
return result;
}
-PQsslKeyPassHook_type
-PQgetSSLKeyPassHook(void)
+PQsslKeyPassHook_OpenSSL_type
+PQgetSSLKeyPassHook_OpenSSL(void)
{
return NULL;
}
void
-PQsetSSLKeyPassHook(PQsslKeyPassHook_type hook)
+PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook)
{
return;
}
int
-PQdefaultSSLKeyPassHook(char *buf, int size, PGconn *conn)
+PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
{
return 0;
}
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index ea13f5afb8a..f104bbfa4a4 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -617,13 +617,13 @@ extern int pg_char_to_encoding(const char *name);
extern const char *pg_encoding_to_char(int encoding);
extern int pg_valid_server_encoding_id(int encoding);
-/* == in fe-secure-openssl.c === */
+/* === in fe-secure-openssl.c === */
/* Support for overriding sslpassword handling with a callback. */
-typedef int (*PQsslKeyPassHook_type) (char *buf, int size, PGconn *conn);
-extern PQsslKeyPassHook_type PQgetSSLKeyPassHook(void);
-extern void PQsetSSLKeyPassHook(PQsslKeyPassHook_type hook);
-extern int PQdefaultSSLKeyPassHook(char *buf, int size, PGconn *conn);
+typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn);
+extern PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook(void);
+extern void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook);
+extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn);
#ifdef __cplusplus
}