• Tom Lane's avatar
    Log a detail message for auth failures due to missing or expired password. · 64e43c59
    Tom Lane authored
    It's worth distinguishing these cases from run-of-the-mill wrong-password
    problems, since users have been known to waste lots of time pursuing the
    wrong theory about what's failing.  Now, our longstanding policy about how
    to report authentication failures is that we don't really want to tell the
    *client* such things, since that might be giving information to a bad guy.
    But there's nothing wrong with reporting the details to the postmaster log,
    and indeed the comments in this area of the code contemplate that
    interesting details should be so reported.  We just weren't handling these
    particular interesting cases usefully.
    
    To fix, add infrastructure allowing subroutines of ClientAuthentication()
    to return a string to be added to the errdetail_log field of the main
    authentication-failed error report.  We might later want to use this to
    report other subcases of authentication failure the same way, but for the
    moment I just dealt with password cases.
    
    Per discussion of a patch from Josh Drake, though this is not what
    he proposed.
    64e43c59
crypt.c 4.35 KB