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@highgo.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.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(-)