-
Notifications
You must be signed in to change notification settings - Fork 90
fix password handling in safeURI #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
when the passwords of source and target differ it will always fail on the first connection attempt because it tries to log in with the password for the other DB: WARN Failed to connect to "postgres://…", retrying until the server is ready INFO Successfully connected to "postgres://…" after 2 attempts in 125 ms.
Thanks for this contribution! After careful consideration I see that we rely on changing the environment internally within a process, without starting a new command, and that's undefined behavior / unsupported. We should just skip the PGPASSWORD environment processing altogether and use |
yes that sounds good, too - I think |
yes, I found PR #328 which might explain why there was some PGPASSWORD environment processing in the implemented first place:
so it makes sense having that in pgcmd.c but in pgsql.c it shouldn't be needed, or should it? there's actually a bit of a cleanup left that should be done now from PR#328, e.g. the comments for I'll change those, try it out and will update this PR if it works. |
instead use `pgsql->connectionString` containing the password and adjust related function comments and removed unused PASSWORD_MASK
Not needed in pgsql.c ; it's undefined behaviour and we'd rather not count on that and simply use |
PR updated - took a bit because I stumbled into another bug while testing 😆
why? because the
found out that |
when the passwords of source and target differ it will always fail on the first connection attempt because it tries to log in with the password for the other DB:
reproducible test case:
no output from grep = no issue, therefore this commit fixes the bug