Re: md5_password_warnings for password auth with MD5-encrypted passwords

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: md5_password_warnings for password auth with MD5-encrypted passwords
Date: 2026-06-23 04:31:53
Message-ID: CAHGQGwG2ibToyAhhUKQjPwMEnDjC2vBkWkKQMdUToeSMFQvb2w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 23, 2026 at 12:17 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >> --
> >> Fujii Masao
> >> <v1-0001-Warn-on-password-auth-with-MD5-encrypted-password.patch>
> >
> > Given that the original warning emission was in md5_crypt_verify(), I
> > think it might be a bit better to keep the two private helpers in
> > crypt.c and add the warning emission in plain_crypt_verify(), because
> > that function has already determined the password type and
> > authentication result.
> >
> +1
>
> Placing it in plain_crypt_verify() leverages the already-determined type and
> result, while keeping the helpers internal to crypt.c is cleaner.

plain_crypt_verify() looks like a generic helper to me. It's used not
only for connection authentication, but also by CREATE/ALTER ROLE and
passwordcheck. So I'm not sure it's clearer to add a
connection-authentication-specific side effect there.

Also, plain_crypt_verify() can be called after
EmitConnectionWarnings(), for example, by CREATE/ALTER ROLE.
So if plain_crypt_verify() were updated to simply call
StoreConnectionWarning() for MD5 password warnings, it could end up
calling StoreConnectionWarning() after EmitConnectionWarnings(),
resulting in the unexpected error
"StoreConnectionWarning() called after EmitConnectionWarnings()".

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2026-06-23 04:49:09 Re: md5_password_warnings for password auth with MD5-encrypted passwords
Previous Message Bertrand Drouvot 2026-06-23 04:07:39 Re: [PATCH] doc: clarify pg_stat_lock.fastpath_exceeded scope