From: Tom Lane <tgl@sss.pgh.pa.us>
To: heath.lord@crunchydata.com
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Jacob Champion <jchampion@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17625: In PG15 PQsslAttribute returns different values than PG14 when SSL is not in use for the connection
Date: Thu, 29 Sep 2022 16:16:31 -0400
Message-ID: <360379.1664482591@sss.pgh.pa.us> (raw)
In-Reply-To: <346263.1664480998@sss.pgh.pa.us>
References: <17625-fc47c78b7d71b534@postgresql.org>
<346263.1664480998@sss.pgh.pa.us>
I wrote:
> AFAICS that behavioral change is deliberate: for the single case
> of inquiring about "library", PQsslAttribute now tells you which
> SSL implementation libpq *can* use, not which one it's actually
> using on a given connection. I'm not sure that this is a great
> definition, since it's so unlike the behavior for other attributes.
Actually, wait a minute: both the documentation and the commit
message claim the new behavior is something different than what it
actually is. The intention seems to have been to change the
behavior only for the conn == NULL case. So maybe we need to
fix it as attached. This'd still be broken for the
multiple-libraries scenario, but I admit that that's pretty
hypothetical.
regards, tom lane
Attachments:fix-broken-PQsslAttribute.patch (text/x-diff, 729B) downloaddiff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.cindex aea4661736..e2eace2bc6 100644--- a/src/interfaces/libpq/fe-secure-openssl.c+++ b/src/interfaces/libpq/fe-secure-openssl.c@@ -1745,14 +1745,18 @@ PQsslAttributeNames(PGconn *conn)
const char *
PQsslAttribute(PGconn *conn, const char *attribute_name)
{
- if (strcmp(attribute_name, "library") == 0)- return "OpenSSL";-
if (!conn)
+ {+ if (strcmp(attribute_name, "library") == 0)+ return "OpenSSL";
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];
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, heath.lord@crunchydata.com, daniel@yesql.se, jchampion@timescale.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17625: In PG15 PQsslAttribute returns different values than PG14 when SSL is not in use for the connection
In-Reply-To: <360379.1664482591@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox