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

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, brown(at)fastmail(dot)com, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13741: vacuumdb does not accept valid password
Date: 2015-11-02 21:10:12
Message-ID: CAJrrPGe6+q7V8mssFV5nHXpisZqTLOwd=434hF3q1tyDjoGmew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, Nov 3, 2015 at 6:26 AM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

Attachment Content-Type Size
reuse_vacuumdb_all_password.patch application/octet-stream 5.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2015-11-03 03:06:55 Re: [BUGS] BUG #12989: pg_size_pretty with negative values
Previous Message Peter Eisentraut 2015-11-02 21:03:51 Re: BUG #13733: ~/.psql_history* corrupted

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-11-02 21:13:14 Re: ParallelContexts can get confused about which worker is which
Previous Message Robert Haas 2015-11-02 21:08:13 Re: ALTER SYSTEM vs symlink