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

Commit7e31923

Browse files
committed
Fix inconsistent error handling for GSS encryption in PQconnectPoll()
The error cases for TLS and GSS encryption were inconsistent. After TLSfails, the connection is marked as dead and follow-up calls ofPQconnectPoll() would return immediately, but GSS encryption was notdoing that, so the connection would still have been allowed to enter theGSS handling code. This was handled incorrectly when gssencmode was setto "require". "prefer" was working correctly, and this could not happenunder "disable" as GSS encryption would not be attempted.This commit makes the error handling of GSS encryption on par with TLSportion, fixing the case of gssencmode=require.Reported-by: Jacob ChampionAuthor: Michael PaquierReviewed-by: Jacob Champion, Stephen FrostDiscussion:https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4713@timescale.comBackpatch-through: 12
1 parent4642c2b commit7e31923

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,17 +3235,22 @@ PQconnectPoll(PGconn *conn)
32353235
conn->status=CONNECTION_MADE;
32363236
returnPGRES_POLLING_WRITING;
32373237
}
3238-
elseif (pollres==PGRES_POLLING_FAILED&&
3239-
conn->gssencmode[0]=='p')
3238+
elseif (pollres==PGRES_POLLING_FAILED)
32403239
{
3241-
/*
3242-
* We failed, but we can retry on "prefer". Have to drop
3243-
* the current connection to do so, though.
3244-
*/
3245-
conn->try_gss= false;
3246-
need_new_connection= true;
3247-
gotokeep_going;
3240+
if (conn->gssencmode[0]=='p')
3241+
{
3242+
/*
3243+
* We failed, but we can retry on "prefer". Have to
3244+
* drop the current connection to do so, though.
3245+
*/
3246+
conn->try_gss= false;
3247+
need_new_connection= true;
3248+
gotokeep_going;
3249+
}
3250+
/* Else it's a hard failure */
3251+
gotoerror_return;
32483252
}
3253+
/* Else, return POLLING_READING or POLLING_WRITING status */
32493254
returnpollres;
32503255
#else/* !ENABLE_GSS */
32513256
/* unreachable */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp