From e49b12c7cc5578d18d46cf578d3d8862a4e91f4d Mon Sep 17 00:00:00 2001 From: Nickolas Lapp Date: Wed, 11 Nov 2015 11:43:38 -0700 Subject: [PATCH] Make get_shutdown return correct results with stunnel --- src/ssl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index d3ed8a72c..bf94d35a7 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -9952,13 +9952,10 @@ void wolfSSL_set_connect_state(WOLFSSL* ssl) int wolfSSL_get_shutdown(const WOLFSSL* ssl) { WOLFSSL_ENTER("wolfSSL_get_shutdown"); -#ifdef HAVE_STUNNEL - return (ssl->options.sentNotify << 1) | (ssl->options.closeNotify); -#else - return (ssl->options.isClosed || - ssl->options.connReset || - ssl->options.sentNotify); -#endif + /* in OpenSSL, SSL_SENT_SHUTDOWN = 1, when closeNotifySent * + * SSL_RECEIVED_SHUTDOWN = 2, from close notify or fatal err */ + return ((ssl->options.closeNotify||ssl->options.connReset) << 1) + | (ssl->options.sentNotify); }