summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index a19b444c593..5263099ba49 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.346 2007/07/08 17:11:51 joe Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.347 2007/07/08 18:28:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1641,10 +1641,6 @@ keep_going: /* We will come back to here until there is
return PGRES_POLLING_READING;
}
- /* save the authentication request type */
- if (conn->areq == AUTH_REQ_UNK)
- conn->areq = areq;
-
/* Get the password salt if there is one. */
if (areq == AUTH_REQ_MD5)
{
@@ -1670,6 +1666,10 @@ keep_going: /* We will come back to here until there is
*/
conn->inStart = conn->inCursor;
+ /* Save the authentication request type, if first one. */
+ if (conn->areq == AUTH_REQ_OK)
+ conn->areq = areq;
+
/* Respond to the request if necessary. */
/*
@@ -1877,7 +1877,7 @@ makeEmptyPGconn(void)
conn->std_strings = false; /* unless server says differently */
conn->verbosity = PQERRORS_DEFAULT;
conn->sock = -1;
- conn->areq = AUTH_REQ_UNK;
+ conn->areq = AUTH_REQ_OK; /* until we receive something else */
#ifdef USE_SSL
conn->allow_ssl_try = true;
conn->wait_ssl_try = false;
@@ -3397,6 +3397,19 @@ PQbackendPID(const PGconn *conn)
}
int
+PQconnectionUsedPassword(const PGconn *conn)
+{
+ if (!conn)
+ return false;
+ if (conn->areq == AUTH_REQ_MD5 ||
+ conn->areq == AUTH_REQ_CRYPT ||
+ conn->areq == AUTH_REQ_PASSWORD)
+ return true;
+ else
+ return false;
+}
+
+int
PQclientEncoding(const PGconn *conn)
{
if (!conn || conn->status != CONNECTION_OK)
@@ -3446,17 +3459,6 @@ PQsetClientEncoding(PGconn *conn, const char *encoding)
return status;
}
-bool
-PQconnectionUsedPassword(const PGconn *conn)
-{
- if (conn->areq == AUTH_REQ_MD5 ||
- conn->areq == AUTH_REQ_CRYPT ||
- conn->areq == AUTH_REQ_PASSWORD)
- return true;
- else
- return false;
-}
-
PGVerbosity
PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
{