* Copyright (C) 2005 Martin Koegler
* Copyright (C) 2010 TigerVNC Team
* Copyright (C) 2010 m-privacy GmbH
+ * 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
X509CRL.setDefaultStr(crlDefault.buf);
}
-void CSecurityTLS::shutdown(bool needbye)
+void CSecurityTLS::shutdown()
{
- if (session && needbye)
- if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS)
- vlog.error("gnutls_bye failed");
+ if (session) {
+ 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 (anon_cred) {
gnutls_anon_free_client_credentials(anon_cred);
CSecurityTLS::~CSecurityTLS()
{
- shutdown(true);
+ shutdown();
delete[] cafile;
delete[] crlfile;
}
vlog.error("TLS Handshake failed: %s\n", gnutls_strerror (err));
- shutdown(false);
+ shutdown();
throw AuthFailureException("TLS Handshake failed");
}
* 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
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) {