Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbcd713a

Browse files
committed
If SSL negotiation fails and SSLMODE is 'prefer', then retry without SSL.
Negotiation failure is only likely to happen if one side or the other ismisconfigured, eg. bad client certificate. I'm not 100% convinced thata retry is really the best thing, hence not back-patching this fix for now.Per gripe from Sergio Cinos.
1 parentcc6c10a commitbcd713a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.338 2006/10/06 17:14:00petere Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.339 2006/11/21 16:28:00tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1400,6 +1400,25 @@ PQconnectPoll(PGconn *conn)
14001400
conn->status=CONNECTION_MADE;
14011401
returnPGRES_POLLING_WRITING;
14021402
}
1403+
if (pollres==PGRES_POLLING_FAILED)
1404+
{
1405+
/*
1406+
* Failed ... if sslmode is "prefer" then do a non-SSL
1407+
* retry
1408+
*/
1409+
if (conn->sslmode[0]=='p'/* "prefer" */
1410+
&&conn->allow_ssl_try/* redundant? */
1411+
&& !conn->wait_ssl_try)/* redundant? */
1412+
{
1413+
/* only retry once */
1414+
conn->allow_ssl_try= false;
1415+
/* Must drop the old connection */
1416+
closesocket(conn->sock);
1417+
conn->sock=-1;
1418+
conn->status=CONNECTION_NEEDED;
1419+
gotokeep_going;
1420+
}
1421+
}
14031422
returnpollres;
14041423
#else/* !USE_SSL */
14051424
/* can't get here */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp