Re: BUG #13741: vacuumdb does not accept valid password
Haribabu Kommi <kommi.haribabu@gmail.com>
From: Haribabu Kommi <kommi.haribabu@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Michael Paquier <michael.paquier@gmail.com>, brown@fastmail.com,
"pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Date: 2015-11-02T21:10:12Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- reuse_vacuumdb_all_password.patch (application/octet-stream) patch
On Tue, Nov 3, 2015 at 6:26 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote: > Michael Paquier wrote: >> On Mon, Nov 2, 2015 at 8:10 PM, Haribabu Kommi wrote: >> > Here I attached modified patch that gets the password from parent connection >> > if exists and use it for the child connection also. >> >> Meh? Why the parent connection? You could simply have the password as >> an argument of connectDatabase, per se the attached. That looks just >> more simple. > > Thanks! This is almost there, but there's an important missing piece -- > vacuumdb --all will ask you for a password for each database. I think > vacuum_one_database needs to receive a password from its caller too. Here I attached a separate patch to handle the reuse of password for vacuumdb -all case. The same behavior exists in all supported branches. > (Also, please use pg_strdup.) The simple_prompt function in connectDatabase allocates memory for password using malloc. Because of this reason he used strdup instead of pstrdup to avoid adding a separate code to handle both the cases. Regards, Hari Babu Fujitsu Australia
Commits
-
vacuumdb: don't prompt for passwords over and over
- 83dec5a712af 9.6.0 landed
- 5094da99b901 9.5.0 landed