mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Enable SSL library detection via PQsslAttribute()
Currently, libpq client code must have a connection handle before it can query the "library" SSL attribute. This poses problems if the client needs to know what SSL library is in use before constructing a connection string. Allow PQsslAttribute(NULL, "library") to return the library in use -- currently, just "OpenSSL" or NULL. The new behavior is announced with the LIBPQ_HAS_SSL_LIBRARY_DETECTION feature macro, allowing clients to differentiate between a libpq that was compiled without SSL support and a libpq that's just too old to tell. Author: Jacob Champion <pchampion@vmware.com> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/4c8b76ef434a96627170a31c3acd33cbfd6e41f1.camel@vmware.com
This commit is contained in:
@ -1631,14 +1631,14 @@ PQsslAttributeNames(PGconn *conn)
|
||||
const char *
|
||||
PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
{
|
||||
if (strcmp(attribute_name, "library") == 0)
|
||||
return "OpenSSL";
|
||||
|
||||
if (!conn)
|
||||
return NULL;
|
||||
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