Avoid masking EOF (no-password-supplied) conditions in auth.c.
commitfb464a1ae3c9cafffe18bb921c8f7bff7597305e
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 3 Jan 2024 22:40:38 +0000 (3 17:40 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 3 Jan 2024 22:40:38 +0000 (3 17:40 -0500)
tree3f4b7aa52c9fa7699cd44ad895b254b1656cf4ac
parent65218693d0c7a78cd00840c00cc00edd6afb3076
Avoid masking EOF (no-password-supplied) conditions in auth.c.

CheckPWChallengeAuth() would return STATUS_ERROR if the user does not
exist or has no password assigned, even if the client disconnected
without responding to the password challenge (as libpq often will,
for example).  We should return STATUS_EOF in that case, and the
lower-level functions do, but this code level got it wrong since the
refactoring done in 7ac955b34.  This breaks the intent of not logging
anything for EOF cases (cf. comments in auth_failed()) and might
also confuse users of ClientAuthentication_hook.

Per report from Liu Lang.  Back-patch to all supported versions.

Discussion: https://postgr.es/m/b725238c-539d-cb09-2bff-b5e6cb2c069c@esgyn.cn
src/backend/libpq/auth.c