diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-23 15:45:43 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-23 15:45:43 -0500 |
| commit | ff402ae11b4d33e0e46c2730f63033d3631b8010 (patch) | |
| tree | 0d5613733254659db835e97d8f0cd6a0df2e3f71 /src/bin/scripts/reindexdb.c | |
| parent | 1aa41e3eae3746e05d0e23286ac740a9a6cee7df (diff) | |
Improve handling of password reuse in src/bin/scripts programs.
This reverts most of commit 83dec5a71 in favor of having connectDatabase()
store the possibly-reusable password in a static variable, similar to the
coding we've had for a long time in pg_dump's version of that function.
To avoid possible problems with unwanted password reuse, make callers
specify whether it's reasonable to attempt to re-use the password.
This is a wash for cases where re-use isn't needed, but it is far simpler
for callers that do want that. Functionally there should be no difference.
Even though we're past RC1, it seems like a good idea to back-patch this
into 9.5, like the prior commit. Otherwise, if there are any third-party
users of connectDatabase(), they'll have to deal with an API change in
9.5 and then another one in 9.6.
Michael Paquier
Diffstat (limited to 'src/bin/scripts/reindexdb.c')
| -rw-r--r-- | src/bin/scripts/reindexdb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index fbf436c6d59..b6f3dcbca04 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -297,8 +297,8 @@ reindex_one_database(const char *name, const char *dbname, const char *type, appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name)); appendPQExpBufferChar(&sql, ';'); - conn = connectDatabase(dbname, host, port, username, NULL, - prompt_password, progname, false); + conn = connectDatabase(dbname, host, port, username, prompt_password, + progname, false, false); if (!executeMaintenanceCommand(conn, sql.data, echo)) { @@ -372,8 +372,8 @@ reindex_system_catalogs(const char *dbname, const char *host, const char *port, appendPQExpBuffer(&sql, " SYSTEM %s;", dbname); - conn = connectDatabase(dbname, host, port, username, NULL, - prompt_password, progname, false); + conn = connectDatabase(dbname, host, port, username, prompt_password, + progname, false, false); if (!executeMaintenanceCommand(conn, sql.data, echo)) { fprintf(stderr, _("%s: reindexing of system catalogs failed: %s"), |
