1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +03:00

Introduce a psql "\connect -reuse-previous=on|off" option.

The decision to reuse values of parameters from a previous connection
has been based on whether the new target is a conninfo string.  Add this
means of overriding that default.  This feature arose as one component
of a fix for security vulnerabilities in pg_dump, pg_dumpall, and
pg_upgrade, so back-patch to 9.1 (all supported versions).  In 9.3 and
later, comment paragraphs that required update had already-incorrect
claims about behavior when no connection is open; fix those problems.

Security: CVE-2016-5424
This commit is contained in:
Noah Misch
2016-08-08 10:07:46 -04:00
parent aed766ab55
commit cf7e5f55bf
3 changed files with 89 additions and 44 deletions

View File

@ -748,7 +748,7 @@ testdb=>
</varlistentry>
<varlistentry>
<term><literal>\c</literal> or <literal>\connect</literal> <literal>[ <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">host</replaceable> ] [ <replaceable class="parameter">port</replaceable> ] ] | <replaceable class="parameter">conninfo</replaceable> </literal></term>
<term><literal>\c</literal> or <literal>\connect [ -reuse-previous=<replaceable class="parameter">on|off</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">host</replaceable> ] [ <replaceable class="parameter">port</replaceable> ] | <replaceable class="parameter">conninfo</replaceable> ]</literal></term>
<listitem>
<para>
Establishes a new connection to a <productname>PostgreSQL</>
@ -758,16 +758,19 @@ testdb=&gt;
</para>
<para>
When using positional parameters, if any of
<replaceable class="parameter">dbname</replaceable>,
Where the command omits database name, user, host, or port, the new
connection can reuse values from the previous connection. By default,
values from the previous connection are reused except when processing
a <literal>conninfo</> string. Passing a first argument
of <literal>-reuse-previous=on</>
or <literal>-reuse-previous=off</literal> overrides that default.
When the command neither specifies nor reuses a particular parameter,
the <application>libpq</application> default is used. Specifying any
of <replaceable class="parameter">dbname</replaceable>,
<replaceable class="parameter">username</replaceable>,
<replaceable class="parameter">host</replaceable> or
<replaceable class="parameter">port</replaceable> are omitted or
specified as <literal>-</literal>, the value of that parameter from
the previous connection is used; if there is no previous connection,
the <application>libpq</application> default for the parameter's value
is used. When using <literal>conninfo</> strings, no values from the
previous connection are used for the new connection.
<replaceable class="parameter">port</replaceable>
as <literal>-</literal> is equivalent to omitting that parameter.
</para>
<para>