Fix up the PQconnectionUsedPassword mess: create a separate
authorTom Lane
Sun, 9 Dec 2007 19:01:40 +0000 (19:01 +0000)
committerTom Lane
Sun, 9 Dec 2007 19:01:40 +0000 (19:01 +0000)
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.

13 files changed:
doc/src/sgml/libpq.sgml
doc/src/sgml/release.sgml
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_dumpall.c
src/bin/psql/command.c
src/bin/psql/startup.c
src/bin/scripts/common.c
src/interfaces/libpq/exports.txt
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h

index 3acbe2c3d30eb32781993f7284fc44881c169a54..fec498c19a8536cdaff7c8a770dd6d0c46d0cd10 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
  <application>libpq</application> - C Library
@@ -1145,12 +1145,33 @@ typedef struct
      
     
 
+    
+     PQconnectionNeedsPasswordPQconnectionNeedsPassword
+     
+      
+       Returns true (1) if the connection authentication method
+       required a password, but none was available.
+       Returns false (0) if not.
+
+       
+        int PQconnectionNeedsPassword(const PGconn *conn);
+       
+
+      
+
+      
+       This function can be applied after a failed connection attempt
+       to decide whether to prompt the user for a password.
+      
+     
+    
+
     
      PQconnectionUsedPasswordPQconnectionUsedPassword
      
       
        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.
 
        
         int PQconnectionUsedPassword(const PGconn *conn);
@@ -1159,9 +1180,10 @@ typedef struct
       
 
       
-       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 .pgpass file) are not considered
+       caller-supplied.
       
      
     
index ef4373fe6d646665674a1e538e67547091bda51d..4bb10cbf61102cf43b17e1ffbad07981912f39ef 100644 (file)
@@ -1,4 +1,4 @@
-
+