summaryrefslogtreecommitdiff
path: root/src/backend/libpq/be-secure.c
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:10 +0300
commit543e00bc1f06247850d85b7382dc3e3db72ae833 (patch)
tree7dad573d7db7faa17aa78932451176d4fa0a3eac /src/backend/libpq/be-secure.c
parentcc154d9a0022102147ed85dc50766d95ee229bb1 (diff)
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/backend/libpq/be-secure.c')
-rw-r--r--src/backend/libpq/be-secure.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index 2579c7e419c..c6573b40e7b 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -289,11 +289,13 @@ rloop:
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),
@@ -414,8 +416,14 @@ wloop:
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;