aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-07-03 14:51:51 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-07-03 14:53:01 +0300
commitf73382877e3ec2ff4b3fcedfd2566ccd90ef3e1c (patch)
tree2da35b50c29956f2fb186a08d4e6ec4320866f16 /src
parente9d4aa594f2caa8c28d55c41c9926420b1efdb79 (diff)
downloadpostgresql-f73382877e3ec2ff4b3fcedfd2566ccd90ef3e1c.tar.gz
postgresql-f73382877e3ec2ff4b3fcedfd2566ccd90ef3e1c.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/be-secure-openssl.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 3a39cb7dc6b..2ff9d1cf857 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -582,11 +582,13 @@ be_tls_read(Port *port, void *ptr, size_t len, int *waitfor)
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("SSL error: %s", SSLerrmessage(ecode))));
- /* fall through */
- case SSL_ERROR_ZERO_RETURN:
errno = ECONNRESET;
n = -1;
break;
+ case SSL_ERROR_ZERO_RETURN:
+ /* connection was cleanly shut down by peer */
+ n = 0;
+ break;
default:
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
@@ -642,8 +644,14 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("SSL error: %s", SSLerrmessage(ecode))));
- /* fall through */
+ errno = ECONNRESET;
+ n = -1;
+ break;
case SSL_ERROR_ZERO_RETURN:
+ /*
+ * the SSL connnection was closed, leave it to the caller
+ * to ereport it
+ */
errno = ECONNRESET;
n = -1;
break;