From aa224673e44ba1346884b48e621dd1c8987c6828 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 10 Jun 2021 16:31:24 +0200 Subject: Propagate errno to GnuTLS Give GnuTLS the correct errno from deeper layers, in the cases where we know it. In most cases GnuTLS doesn't care, but just in case... --- common/rdr/TLSInStream.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common/rdr/TLSInStream.cxx') diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index 2339956d..e6c9c906 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -1,6 +1,7 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright (C) 2005 Martin Koegler * Copyright (C) 2010 TigerVNC Team + * Copyright (C) 2012-2021 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +51,10 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size) in->readBytes(data, size); } catch (EndOfStream&) { return 0; + } catch (SystemException &e) { + vlog.error("Failure reading TLS data: %s", e.str()); + gnutls_transport_set_errno(self->session, e.err); + return -1; } catch (Exception& e) { vlog.error("Failure reading TLS data: %s", e.str()); gnutls_transport_set_errno(self->session, EINVAL); -- cgit v1.2.3