1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

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
This commit is contained in:
Andrew Dunstan
2020-05-16 16:20:43 -04:00
parent 1cbc143f06
commit 36d1087611
4 changed files with 21 additions and 21 deletions

View File

@ -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);
}
/*