tls-socket: Don't fail reading if sending data failed
authorTobias Brunner <tobias@strongswan.org>
Wed, 26 Aug 2020 15:42:21 +0000 (17:42 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 12 Feb 2021 10:45:44 +0000 (11:45 +0100)
If data is processed that eventually includes a TLS close notify, build()
will fail after a close notify has been sent in turn.  However, propagating
that error immediately when reading prevented ever returning the data
already processed before the close notify was received.

src/libtls/tls_socket.c

index f29a369..7745988 100644 (file)
@@ -188,7 +188,11 @@ static bool exchange(private_tls_socket_t *this, bool wr, bool block)
                                case SUCCESS:
                                        return TRUE;
                                default:
-                                       return FALSE;
+                                       if (wr)
+                                       {
+                                               return FALSE;
+                                       }
+                                       break;
                        }
                        break;
                }