pgsql: Fix sslkeylogfile error handling logging

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix sslkeylogfile error handling logging
Date: 2025-07-10 21:37:57
Message-ID: E1uZyxo-005eAo-2s@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix sslkeylogfile error handling logging

When sslkeylogfile has been set but the file fails to open in an
otherwise successful connection, the log entry added to the conn
object is never printed. Instead print the error on stderr for
increased visibility. This is a debugging tool so using stderr
for logging is appropriate. Also while there, remove the umask
call in the callback as it's not useful.

Issues noted by Peter Eisentraut in post-commit review, backpatch
down to 18 when support for sslkeylogfile was added

Author: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reported-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Discussion: https://postgr.es/m/70450bee-cfaa-48ce-8980-fc7efcfebb03@eisentraut.org
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a6c0bf93031dac8701b8d6c1093230dc5caf190d

Modified Files
--------------
src/interfaces/libpq/fe-secure-openssl.c | 20 ++++++++++++--------
src/test/ssl/t/001_ssltests.pl | 7 +++++++
2 files changed, 19 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-07-10 21:39:03 pgsql: Fix sslkeylogfile error handling logging
Previous Message Nathan Bossart 2025-07-10 20:54:13 pgsql: pg_dump: Fix object-type sort priority for large objects.