summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane2007-12-09 19:01:40 +0000
committerTom Lane2007-12-09 19:01:40 +0000
commit4f9bf7fc5a1fcc3b1beac9b2e1d2e693ae7bd796 (patch)
treedbc4b337965401ee7fd8c9598f98e4e7e5ba2f8f /doc/src
parentcb1ab30fdc3b44a7d34ccf9cdaa82d46dd6427c1 (diff)
Fix up the PQconnectionUsedPassword mess: create a separate
PQconnectionNeedsPassword function that tells the right thing for whether to prompt for a password, and improve PQconnectionUsedPassword so that it checks whether the password used by the connection was actually supplied as a connection argument, instead of coming from environment or a password file. Per bug report from Mark Cave-Ayland and subsequent discussion.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/libpq.sgml32
-rw-r--r--doc/src/sgml/release.sgml20
2 files changed, 44 insertions, 8 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 3acbe2c3d30..fec498c19a8 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.247 2007/11/28 15:42:31 petere Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.248 2007/12/09 19:01:40 tgl Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
@@ -1146,11 +1146,32 @@ typedef struct
</varlistentry>
<varlistentry>
+ <term><function>PQconnectionNeedsPassword</function><indexterm><primary>PQconnectionNeedsPassword</></></term>
+ <listitem>
+ <para>
+ Returns true (1) if the connection authentication method
+ required a password, but none was available.
+ Returns false (0) if not.
+
+ <synopsis>
+ int PQconnectionNeedsPassword(const PGconn *conn);
+ </synopsis>
+
+ </para>
+
+ <para>
+ This function can be applied after a failed connection attempt
+ to decide whether to prompt the user for a password.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><function>PQconnectionUsedPassword</function><indexterm><primary>PQconnectionUsedPassword</></></term>
<listitem>
<para>
Returns true (1) if the connection authentication method
- required a password to be supplied. Returns false (0) if not.
+ used a caller-supplied password. Returns false (0) if not.
<synopsis>
int PQconnectionUsedPassword(const PGconn *conn);
@@ -1159,9 +1180,10 @@ typedef struct
</para>
<para>
- This function can be applied after either successful or failed
- connection attempts. In the case of failure, it can for example
- be used to decide whether to prompt the user for a password.
+ This function detects whether a password supplied to the connection
+ function was actually used. Passwords obtained from other
+ sources (such as the <filename>.pgpass</> file) are not considered
+ caller-supplied.
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml
index ef4373fe6d6..4bb10cbf611 100644
--- a/doc/src/sgml/release.sgml
+++ b/doc/src/sgml/release.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.563 2007/12/08 17:24:03 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.564 2007/12/09 19:01:40 tgl Exp $ -->
<!--
Typical markup:
@@ -2184,8 +2184,9 @@ current_date &lt; 2017-11-17
<listitem>
<para>
- Add <function>PQconnectionUsedPassword()</function> that returns
- true if the server required a password (Joe Conway)
+ Add <function>PQconnectionNeedsPassword()</function> that returns
+ true if the server required a password but none was supplied
+ (Joe Conway, Tom)
</para>
<para>
@@ -2197,6 +2198,19 @@ current_date &lt; 2017-11-17
</para>
</listitem>
+ <listitem>
+ <para>
+ Add <function>PQconnectionUsedPassword()</function> that returns
+ true if the supplied password was actually used
+ (Joe Conway, Tom)
+ </para>
+
+ <para>
+ This is useful in some security contexts where it is important
+ to know whether a user-supplied password is actually valid.
+ </para>
+ </listitem>
+
</itemizedlist>
</sect3>