From 44cdb1352a8f246f1898cf458dba6f75c3ba4d37 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Wed, 9 Feb 2011 14:09:10 +0000 Subject: [Bugfix] Call gnutls_bye only when handshake is completed. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4275 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/CSecurityTLS.cxx | 10 +++++----- common/rfb/CSecurityTLS.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx index ed570ad4..c22fa2d9 100644 --- a/common/rfb/CSecurityTLS.cxx +++ b/common/rfb/CSecurityTLS.cxx @@ -116,11 +116,11 @@ void CSecurityTLS::setDefaults() x509crl.setDefaultStr(strdup(crlDefault.buf)); } -void CSecurityTLS::shutdown() +void CSecurityTLS::shutdown(bool needbye) { - if (session) + if (session && needbye) if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS) - throw Exception("gnutls_bye failed"); + vlog.error("gnutls_bye failed"); if (anon_cred) { gnutls_anon_free_client_credentials(anon_cred); @@ -143,7 +143,7 @@ void CSecurityTLS::shutdown() CSecurityTLS::~CSecurityTLS() { - shutdown(); + shutdown(true); if (fis) delete fis; @@ -191,7 +191,7 @@ bool CSecurityTLS::processMsg(CConnection* cc) if (err != GNUTLS_E_SUCCESS) { vlog.error("TLS Handshake failed: %s\n", gnutls_strerror (err)); - shutdown(); + shutdown(false); throw AuthFailureException("TLS Handshake failed"); } diff --git a/common/rfb/CSecurityTLS.h b/common/rfb/CSecurityTLS.h index bd6297d7..c19307e7 100644 --- a/common/rfb/CSecurityTLS.h +++ b/common/rfb/CSecurityTLS.h @@ -55,7 +55,7 @@ namespace rfb { static UserMsgBox *msg; protected: - void shutdown(); + void shutdown(bool needbye); void freeResources(); void setParam(); void checkSession(); -- cgit v1.2.3