Skip to content

Commit b93827c

Browse files
committed
Treat clean shutdown of an SSL connection same as the non-SSL case.
If the client closes an SSL connection, treat it the same as EOF on a non-SSL connection. In particular, don't write a message in the log about that. Michael Paquier. Discussion: https://www.postgresql.org/message-id/CAB7nPqSfyVV42Q2acFo%3DvrvF2gxoZAMJLAPq3S3KkjhZAYi7aw@mail.gmail.com
1 parent bf723a2 commit b93827c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,13 @@ be_tls_read(Port *port, void *ptr, size_t len, int *waitfor)
688688
ereport(COMMERROR,
689689
(errcode(ERRCODE_PROTOCOL_VIOLATION),
690690
errmsg("SSL error: %s", SSLerrmessage(ecode))));
691-
/* fall through */
692-
case SSL_ERROR_ZERO_RETURN:
693691
errno = ECONNRESET;
694692
n = -1;
695693
break;
694+
case SSL_ERROR_ZERO_RETURN:
695+
/* connection was cleanly shut down by peer */
696+
n = 0;
697+
break;
696698
default:
697699
ereport(COMMERROR,
698700
(errcode(ERRCODE_PROTOCOL_VIOLATION),
@@ -748,8 +750,14 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
748750
ereport(COMMERROR,
749751
(errcode(ERRCODE_PROTOCOL_VIOLATION),
750752
errmsg("SSL error: %s", SSLerrmessage(ecode))));
751-
/* fall through */
753+
errno = ECONNRESET;
754+
n = -1;
755+
break;
752756
case SSL_ERROR_ZERO_RETURN:
757+
/*
758+
* the SSL connnection was closed, leave it to the caller
759+
* to ereport it
760+
*/
753761
errno = ECONNRESET;
754762
n = -1;
755763
break;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy