8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.346 2007/07/08 17:11:51 joe Exp $
11
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.347 2007/07/08 18:28:55 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1641,10 +1641,6 @@ PQconnectPoll(PGconn *conn)
1641
1641
return PGRES_POLLING_READING ;
1642
1642
}
1643
1643
1644
- /* save the authentication request type */
1645
- if (conn -> areq == AUTH_REQ_UNK )
1646
- conn -> areq = areq ;
1647
-
1648
1644
/* Get the password salt if there is one. */
1649
1645
if (areq == AUTH_REQ_MD5 )
1650
1646
{
@@ -1670,6 +1666,10 @@ PQconnectPoll(PGconn *conn)
1670
1666
*/
1671
1667
conn -> inStart = conn -> inCursor ;
1672
1668
1669
+ /* Save the authentication request type, if first one. */
1670
+ if (conn -> areq == AUTH_REQ_OK )
1671
+ conn -> areq = areq ;
1672
+
1673
1673
/* Respond to the request if necessary. */
1674
1674
1675
1675
/*
@@ -1877,7 +1877,7 @@ makeEmptyPGconn(void)
1877
1877
conn -> std_strings = false; /* unless server says differently */
1878
1878
conn -> verbosity = PQERRORS_DEFAULT ;
1879
1879
conn -> sock = -1 ;
1880
- conn -> areq = AUTH_REQ_UNK ;
1880
+ conn -> areq = AUTH_REQ_OK ; /* until we receive something else */
1881
1881
#ifdef USE_SSL
1882
1882
conn -> allow_ssl_try = true;
1883
1883
conn -> wait_ssl_try = false;
@@ -3396,6 +3396,19 @@ PQbackendPID(const PGconn *conn)
3396
3396
return conn -> be_pid ;
3397
3397
}
3398
3398
3399
+ int
3400
+ PQconnectionUsedPassword (const PGconn * conn )
3401
+ {
3402
+ if (!conn )
3403
+ return false;
3404
+ if (conn -> areq == AUTH_REQ_MD5 ||
3405
+ conn -> areq == AUTH_REQ_CRYPT ||
3406
+ conn -> areq == AUTH_REQ_PASSWORD )
3407
+ return true;
3408
+ else
3409
+ return false;
3410
+ }
3411
+
3399
3412
int
3400
3413
PQclientEncoding (const PGconn * conn )
3401
3414
{
@@ -3446,17 +3459,6 @@ PQsetClientEncoding(PGconn *conn, const char *encoding)
3446
3459
return status ;
3447
3460
}
3448
3461
3449
- bool
3450
- PQconnectionUsedPassword (const PGconn * conn )
3451
- {
3452
- if (conn -> areq == AUTH_REQ_MD5 ||
3453
- conn -> areq == AUTH_REQ_CRYPT ||
3454
- conn -> areq == AUTH_REQ_PASSWORD )
3455
- return true;
3456
- else
3457
- return false;
3458
- }
3459
-
3460
3462
PGVerbosity
3461
3463
PQsetErrorVerbosity (PGconn * conn , PGVerbosity verbosity )
3462
3464
{
0 commit comments