]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4236: SSL negotiation error of 'success'
authorNathan Hoad <nathan@getoffmalawn.com>
Fri, 22 May 2015 04:45:06 +0000 (21:45 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 22 May 2015 04:45:06 +0000 (21:45 -0700)
src/client_side.cc

index e3d431e0368ba303173c08510e7b1ac4b50f54e5..a5189faedaa4de1c1d37c515670aae31cf7edfd2 100644 (file)
@@ -3664,7 +3664,9 @@ Squid_SSL_accept(ConnStateData *conn, PF *callback)
     SSL *ssl = fd_table[fd].ssl;
     int ret;
 
+    errno = 0;
     if ((ret = SSL_accept(ssl)) <= 0) {
+        int xerrno = errno;
         int ssl_error = SSL_get_error(ssl, ret);
 
         switch (ssl_error) {
@@ -3678,24 +3680,14 @@ Squid_SSL_accept(ConnStateData *conn, PF *callback)
             return false;
 
         case SSL_ERROR_SYSCALL:
-
             if (ret == 0) {
                 debugs(83, 2, "Error negotiating SSL connection on FD " << fd << ": Aborted by client: " << ssl_error);
-                comm_close(fd);
-                return false;
             } else {
-                int hard = 1;
-
-                if (errno == ECONNRESET)
-                    hard = 0;
-
-                debugs(83, hard ? 1 : 2, "Error negotiating SSL connection on FD " <<
-                       fd << ": " << strerror(errno) << " (" << errno << ")");
-
-                comm_close(fd);
-
-                return false;
+                debugs(83, (xerrno == ECONNRESET) ? 1 : 2, "Error negotiating SSL connection on FD " << fd << ": " <<
+                       (xerrno == 0 ? ERR_error_string(ssl_error, NULL) : xstrerr(xerrno)));
             }
+            comm_close(fd);
+            return false;
 
         case SSL_ERROR_ZERO_RETURN:
             debugs(83, DBG_IMPORTANT, "Error negotiating SSL connection on FD " << fd << ": Closed by client");