pgsql: Fix md5_password_warnings for role and database settings

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix md5_password_warnings for role and database settings
Date: 2026-06-11 23:33:57
Message-ID: E1wXouL-0024al-14@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix md5_password_warnings for role and database settings

MD5 authentication warnings are queued during authentication, before
startup options and role/database settings have been applied. The code
checked md5_password_warnings at queue time, so settings such as
ALTER ROLE ... SET md5_password_warnings = off did not suppress the
warning, even though the established session showed the GUC as off.

Keep the connection-warning infrastructure generic by allowing each
queued warning to carry an optional filter callback. Evaluate that
callback when warnings are emitted, after startup options and
role/database settings have been processed.

Use this for MD5 authentication warnings, while leaving password
expiration warnings unchanged. Add test coverage for an MD5-authenticated
role with md5_password_warnings disabled.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Japin Li <japinli(at)hotmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/AE46E42D-5966-4D76-9E64-95EAB01B9FB5@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/44196fd4f378d776c4cd7282256f4d6df03b5734

Modified Files
--------------
src/backend/libpq/crypt.c | 31 ++++++++++--------
src/backend/utils/init/postinit.c | 52 ++++++++++++++++++++-----------
src/include/miscadmin.h | 4 ++-
src/test/authentication/t/001_password.pl | 17 ++++++++++
src/tools/pgindent/typedefs.list | 1 +
5 files changed, 72 insertions(+), 33 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-06-12 00:40:16 pgsql: amcheck: Fix missing allequalimage corruption report
Previous Message Robert Haas 2026-06-11 21:18:09 pgsql: Fix type confusion in AddRelsyncInvalidationMessage