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

Commit4847d59

Browse files
committed
Set errno to zero before invoking SSL_read or SSL_write. It appears that
at least in some Windows versions, these functions are capable of returninga failure indication without setting errno. That puts us into an infiniteloop if the previous value happened to be EINTR. Per report from BrendanHill.Back-patch to 8.2. We could take it further back, but since this is onlyknown to be an issue on Windows and we don't support Windows before 8.2,it does not seem worth the trouble.
1 parent3d4b0ab commit4847d59

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎src/backend/libpq/be-secure.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.93 2009/12/09 06:37:06 mha Exp $
14+
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.94 2009/12/30 03:45:46 tgl Exp $
1515
*
1616
* Since the server static private key ($DataDir/server.key)
1717
* will normally be stored unencrypted so that the database
@@ -245,6 +245,7 @@ secure_read(Port *port, void *ptr, size_t len)
245245
interr;
246246

247247
rloop:
248+
errno=0;
248249
n=SSL_read(port->ssl,ptr,len);
249250
err=SSL_get_error(port->ssl,n);
250251
switch (err)
@@ -339,6 +340,7 @@ secure_write(Port *port, void *ptr, size_t len)
339340
}
340341

341342
wloop:
343+
errno=0;
342344
n=SSL_write(port->ssl,ptr,len);
343345
err=SSL_get_error(port->ssl,n);
344346
switch (err)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.129 2009/12/09 06:37:06 mha Exp $
14+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.130 2009/12/30 03:45:46 tgl Exp $
1515
*
1616
* NOTES
1717
*
@@ -324,6 +324,7 @@ pqsecure_read(PGconn *conn, void *ptr, size_t len)
324324
DISABLE_SIGPIPE(conn,spinfo,return-1);
325325

326326
rloop:
327+
SOCK_ERRNO_SET(0);
327328
n=SSL_read(conn->ssl,ptr,len);
328329
err=SSL_get_error(conn->ssl,n);
329330
switch (err)
@@ -409,6 +410,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len)
409410

410411
DISABLE_SIGPIPE(conn,spinfo,return-1);
411412

413+
SOCK_ERRNO_SET(0);
412414
n=SSL_write(conn->ssl,ptr,len);
413415
err=SSL_get_error(conn->ssl,n);
414416
switch (err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp