aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/SSecurityTLS.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-06-10 16:40:28 +0200
committerPierre Ossman <ossman@cendio.se>2021-06-11 09:42:44 +0200
commit14d21d7b445107873166b528c66881bf736285f8 (patch)
tree7282807699449e11d5910bbd9ef57f46cbdbe179 /common/rfb/SSecurityTLS.cxx
parentfa2d8cd455a9f1ec632a493edc09e0c661ed9d51 (diff)
downloadtigervnc-14d21d7b445107873166b528c66881bf736285f8.tar.gz
tigervnc-14d21d7b445107873166b528c66881bf736285f8.zip
Handle GnuTLS shutdown on dead session
The session might have died, or failed to initialise properly, so be prepared for gnutls_bye() to be unable to do its job.
Diffstat (limited to 'common/rfb/SSecurityTLS.cxx')
-rw-r--r--common/rfb/SSecurityTLS.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/rfb/SSecurityTLS.cxx b/common/rfb/SSecurityTLS.cxx
index d5ef47e6..72262b9a 100644
--- a/common/rfb/SSecurityTLS.cxx
+++ b/common/rfb/SSecurityTLS.cxx
@@ -2,6 +2,7 @@
* Copyright (C) 2004 Red Hat Inc.
* 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
@@ -64,10 +65,10 @@ SSecurityTLS::SSecurityTLS(SConnection* sc, bool _anon)
void SSecurityTLS::shutdown()
{
if (session) {
- if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS) {
- /* FIXME: Treat as non-fatal error */
- vlog.error("TLS session wasn't terminated gracefully");
- }
+ int ret;
+ ret = gnutls_bye(session, GNUTLS_SHUT_RDWR);
+ if ((ret != GNUTLS_E_SUCCESS) && (ret != GNUTLS_E_INVALID_SESSION))
+ vlog.error("TLS shutdown failed: %s", gnutls_strerror(ret));
}
if (dh_params) {