mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix bogus behavior of PQsslAttribute(conn, "library").
Commit ebc8b7d44
intended to change the behavior of
PQsslAttribute(NULL, "library"), but accidentally also changed
what happens with a non-NULL conn pointer. Undo that so that
only the intended behavior change happens. Clarify some
associated documentation.
Per bug #17625 from Heath Lord. Back-patch to v15.
Discussion: https://postgr.es/m/17625-fc47c78b7d71b534@postgresql.org
This commit is contained in:
@ -1745,14 +1745,21 @@ PQsslAttributeNames(PGconn *conn)
|
||||
const char *
|
||||
PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
{
|
||||
if (strcmp(attribute_name, "library") == 0)
|
||||
return "OpenSSL";
|
||||
|
||||
if (!conn)
|
||||
{
|
||||
/* PQsslAttribute(NULL, "library") reports the default SSL library */
|
||||
if (strcmp(attribute_name, "library") == 0)
|
||||
return "OpenSSL";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* All attributes read as NULL for a non-encrypted connection */
|
||||
if (conn->ssl == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp(attribute_name, "library") == 0)
|
||||
return "OpenSSL";
|
||||
|
||||
if (strcmp(attribute_name, "key_bits") == 0)
|
||||
{
|
||||
static char sslbits_str[12];
|
||||
|
Reference in New Issue
Block a user