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:39:03
Message-ID: E1uZyyt-005eBv-1X@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
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39f01083facd0ddc0040662a71159e9987813c2c

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 Fujii Masao 2025-07-10 23:43:49 pgsql: Change unit of idle_replication_slot_timeout to seconds.
Previous Message Daniel Gustafsson 2025-07-10 21:37:57 pgsql: Fix sslkeylogfile error handling logging