Skip to content

Commit f733828

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 e9d4aa5 commit f733828

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
@@ -582,11 +582,13 @@ be_tls_read(Port *port, void *ptr, size_t len, int *waitfor)
582582
ereport(COMMERROR,
583583
(errcode(ERRCODE_PROTOCOL_VIOLATION),
584584
errmsg("SSL error: %s", SSLerrmessage(ecode))));
585-
/* fall through */
586-
case SSL_ERROR_ZERO_RETURN:
587585
errno = ECONNRESET;
588586
n = -1;
589587
break;
588+
case SSL_ERROR_ZERO_RETURN:
589+
/* connection was cleanly shut down by peer */
590+
n = 0;
591+
break;
590592
default:
591593
ereport(COMMERROR,
592594
(errcode(ERRCODE_PROTOCOL_VIOLATION),
@@ -642,8 +644,14 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
642644
ereport(COMMERROR,
643645
(errcode(ERRCODE_PROTOCOL_VIOLATION),
644646
errmsg("SSL error: %s", SSLerrmessage(ecode))));
645-
/* fall through */
647+
errno = ECONNRESET;
648+
n = -1;
649+
break;
646650
case SSL_ERROR_ZERO_RETURN:
651+
/*
652+
* the SSL connnection was closed, leave it to the caller
653+
* to ereport it
654+
*/
647655
errno = ECONNRESET;
648656
n = -1;
649657
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