From 537d0c0cbc849498f1a43f557cb40459dbc30cc2 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sat, 13 Aug 2016 08:31:03 +0200 Subject: [PATCH] Changing TLS configuration resets TLS session resumption --- lib/TLS_UI/include/TLS_UI.h | 3 +++ lib/TLS_UI/src/TLS_UI.cpp | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/TLS_UI/include/TLS_UI.h b/lib/TLS_UI/include/TLS_UI.h index 4349235..f1db3fd 100644 --- a/lib/TLS_UI/include/TLS_UI.h +++ b/lib/TLS_UI/include/TLS_UI.h @@ -331,9 +331,12 @@ public: protected: /// \cond internal virtual void OnInitDialog(wxInitDialogEvent& event); + virtual bool TransferDataFromWindow(); /// \endcond protected: + const eap::config_provider &m_prov; ///< EAP provider + eap::config_method_tls &m_cfg; ///< TLS configuration wxTLSServerTrustPanel *m_server_trust; ///< Server trust configuration panel wxTLSCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel }; diff --git a/lib/TLS_UI/src/TLS_UI.cpp b/lib/TLS_UI/src/TLS_UI.cpp index 1079db8..135cbd0 100644 --- a/lib/TLS_UI/src/TLS_UI.cpp +++ b/lib/TLS_UI/src/TLS_UI.cpp @@ -566,7 +566,10 @@ bool wxTLSServerTrustPanel::AddRootCA(PCCERT_CONTEXT cert) // wxTLSConfigPanel ////////////////////////////////////////////////////////////////////// -wxTLSConfigPanel::wxTLSConfigPanel(const eap::config_provider &prov, eap::config_method_tls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : wxPanel(parent) +wxTLSConfigPanel::wxTLSConfigPanel(const eap::config_provider &prov, eap::config_method_tls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : + m_prov(prov), + m_cfg(cfg), + wxPanel(parent) { wxBoxSizer* sb_content; sb_content = new wxBoxSizer( wxVERTICAL ); @@ -599,3 +602,21 @@ void wxTLSConfigPanel::OnInitDialog(wxInitDialogEvent& event) if (m_credentials) m_credentials->GetEventHandler()->ProcessEvent(event); } + + +bool wxTLSConfigPanel::TransferDataFromWindow() +{ + wxCHECK(wxPanel::TransferDataFromWindow(), false); + + if (!m_prov.m_read_only) { + // This is not a provider-locked configuration. The data will get saved. + + // Reset session ID and master secret to force clean connect next time. + m_cfg.m_session_id.clear(); + m_cfg.m_master_secret.clear(); + } + + return true; +} + +