Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix a bunch of issues around auth_user #393
When switching a pgbouncer configuration from using userlist.txt files to using auth_query/auth_user, I encountered several issues, all fixed in this PR.
Delay initialization of db->auth_user until it is really needed. This way, only the latest, really wanted cf_auth_user value is considered
…ord through auth_query This fixes the case where you are using a filled-in userlist.txt file, but want to switch to auth_query without restarting pgbouncer. Previous behavior: - cleaning userlist.txt removed the passwords (replaced by '\0') - the auth_query is not started because the users still existed - login failed New behavior: - if the password is empty, start the auth_query - when auth_query answer arrives, fill it back in user->passwd if it already exists
When using auth_user, the transition to the CL_WAITING_LOGIN state would not initialize the client->wait_start field. This would either lead to garbage values being recorded, or under assertions enabled it would crash in activate_client(). (test_auth_user was actually reproducing this problem, but a crash requires assertions enabled and new memory being all zero, so it was difficult to catch it.) Author: @pinaraf see #393