pgsql: In pg_dump, remember connection passwords no matter how we got t

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: In pg_dump, remember connection passwords no matter how we got t
Date: 2015-12-23 19:26:05
Message-ID: E1aBp2z-0000bk-Vp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In pg_dump, remember connection passwords no matter how we got them.

When pg_dump prompts the user for a password, it remembers the password
for possible re-use by parallel worker processes. However, libpq might
have extracted the password from a connection string originally passed
as "dbname". Since we don't record the original form of dbname but
break it down to host/port/etc, the password gets lost. Fix that by
retrieving the actual password from the PGconn.

(It strikes me that this whole approach is rather broken, as it will also
lose other information such as options that might have been present in
the connection string. But we'll leave that problem for another day.)

In passing, get rid of rather silly use of malloc() for small fixed-size
arrays.

Back-patch to 9.3 where parallel pg_dump was introduced.

Report and fix by Zeus Kronion, adjusted a bit by Michael Paquier and me

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f56802a2d06f5f995c7eb1513d8ef5b978a8471c

Modified Files
--------------
src/bin/pg_dump/pg_backup_db.c | 52 +++++++++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-12-23 20:45:58 pgsql: Improve handling of password reuse in src/bin/scripts programs.
Previous Message Robert Haas 2015-12-23 19:12:38 pgsql: Read from the same worker repeatedly until it returns no tuple.