Re: BUG #13741: vacuumdb does not accept valid password

Haribabu Kommi <kommi.haribabu@gmail.com>

From: Haribabu Kommi <kommi.haribabu@gmail.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: brown@fastmail.com, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Date: 2015-11-02T11:10:59Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

On Mon, Nov 2, 2015 at 6:53 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Mon, Nov 2, 2015 at 3:56 PM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Thu, Oct 29, 2015 at 9:13 AM, Haribabu Kommi
>> <kommi.haribabu@gmail.com> wrote:
>>> On Wed, Oct 28, 2015 at 4:07 PM, Haribabu Kommi
>>> <kommi.haribabu@gmail.com> wrote:
>>>> Here I attached a patch that saves the password provided by the user
>>>> from the connectDatabase function and reuse it for connecting all clients
>>>> to the same database.
>>>
>>> Attached a wrong patch, it is having some compilation problems,
>>> Here is the new version with the fixed problems.
>>
>> I have added an entry in this CF:
>> https://commitfest.postgresql.org/7/417/
>> Let's not lose track of this patch.

Thanks for adding the patch to commitfest.

> Regarding this patch, wouldn't it be clearer to pass the password as a
> variable of connectDatabase()? Then we could use NULL at the first
> call of connectDatabase so as we enforce the prompt if requested by
> the user. For successive calls of connectDatabase for each worker, we
> then fetch the password from the parent connection using that:
> if (PQconnectionUsedPassword(con))
>     password = PQpass(conn);
> And pass it as an argument of connectDatabase. In short, I think that
> this approach would make a more portable routine because one could
> enforce a password at the first call of connectDatabase() without
> having to save it once.

Thanks for the review.
Here I attached modified patch that gets the password from parent connection
if exists and use it for the child connection also.


Regards,
Hari Babu
Fujitsu Australia

Commits

  1. vacuumdb: don't prompt for passwords over and over