diff --git a/EventMonitor/ETWLog.cpp b/EventMonitor/ETWLog.cpp index ee7d021..aa28dbe 100644 --- a/EventMonitor/ETWLog.cpp +++ b/EventMonitor/ETWLog.cpp @@ -1,5 +1,5 @@ /* - Copyright 2015-2016 Amebis + Copyright 2015-2018 Amebis Copyright 2016 GÉANT This file is part of GÉANTLink. @@ -204,11 +204,11 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos ULONG ulResult; for (unsigned int i = 0; ; i++) { //tstring log_file(tstring_printf(i ? _T("test.etl") : _T("test %u.etl"), i)); - tstring name(tstring_printf(i ? _T(PRODUCT_NAME_STR) _T(" Event Monitor Session %u") : _T(PRODUCT_NAME_STR) _T(" Event Monitor Session"), i)); + tstring session_name(tstring_printf(i ? _T(PRODUCT_NAME_STR) _T(" Event Monitor Session %u") : _T(PRODUCT_NAME_STR) _T(" Event Monitor Session"), i)); // Allocate session properties. ULONG - ulSizeName = (ULONG)((name .length() + 1)*sizeof(TCHAR)), + ulSizeName = (ULONG)((session_name.length() + 1)*sizeof(TCHAR)), //ulSizeLogFile = (ULONG)((log_file.length() + 1)*sizeof(TCHAR)), ulSize = sizeof(EVENT_TRACE_PROPERTIES) + ulSizeName /*+ ulSizeLogFile*/; unique_ptr properties(reinterpret_cast(new char[ulSize])); @@ -226,13 +226,13 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos //properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + ulSizeName; //memcpy(reinterpret_cast(properties.get()) + properties->LogFileNameOffset, log_file.c_str(), ulSizeLogFile); - if ((ulResult = m_session.create(name.c_str(), properties.get())) == ERROR_SUCCESS) { + if ((ulResult = m_session.create(session_name.c_str(), properties.get())) == ERROR_SUCCESS) { break; } else if (ulResult == ERROR_ACCESS_DENIED) { wxLogError(_("Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session.")); return; } else if (ulResult == ERROR_ALREADY_EXISTS) { - wxLogDebug(_("The %s event session already exists."), name); + wxLogDebug(_("The %s event session already exists."), session_name); // Do not despair... Retry with a new session name and ID. continue; } else { diff --git a/lib/EAPBase_UI/src/EAP_UI.cpp b/lib/EAPBase_UI/src/EAP_UI.cpp index f7a437f..4debe20 100644 --- a/lib/EAPBase_UI/src/EAP_UI.cpp +++ b/lib/EAPBase_UI/src/EAP_UI.cpp @@ -1,5 +1,5 @@ /* - Copyright 2015-2016 Amebis + Copyright 2015-2018 Amebis Copyright 2016 GÉANT This file is part of GÉANTLink. @@ -480,7 +480,7 @@ eap::monitor_ui::monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid) : m_hwnd_popup(NULL) { // Verify if the monitor is already running. - const WNDCLASSEX wnd_class_desc = { + const WNDCLASSEX wnd_class_desc_master = { sizeof(WNDCLASSEX), // cbSize 0, // style winproc, // lpfnWndProc @@ -494,7 +494,7 @@ eap::monitor_ui::monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid) : _T(__FUNCTION__), // lpszClassName NULL // hIconSm }; - ATOM wnd_class = RegisterClassEx(&wnd_class_desc); + ATOM wnd_class = RegisterClassEx(&wnd_class_desc_master); if (!wnd_class) throw win_runtime_error(__FUNCTION__ " Error registering master monitor window class."); tstring_guid guid_str(guid); @@ -504,7 +504,7 @@ eap::monitor_ui::monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid) : m_is_master = false; // Register slave windows class slightly different, not to include slaves in FindWindowEx(). - const WNDCLASSEX wnd_class_desc = { + const WNDCLASSEX wnd_class_desc_slave = { sizeof(WNDCLASSEX), // cbSize 0, // style winproc, // lpfnWndProc @@ -518,7 +518,7 @@ eap::monitor_ui::monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid) : _T(__FUNCTION__) _T("-Slave"), // lpszClassName NULL // hIconSm }; - wnd_class = RegisterClassEx(&wnd_class_desc); + wnd_class = RegisterClassEx(&wnd_class_desc_slave); if (!wnd_class) throw win_runtime_error(__FUNCTION__ " Error registering slave monitor window class."); } else { diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index b4b2646..2e3f048 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -1,5 +1,5 @@ /* - Copyright 2015-2016 Amebis + Copyright 2015-2018 Amebis Copyright 2016 GÉANT This file is part of GÉANTLink. @@ -92,15 +92,17 @@ void eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode HRESULT hr; - // - com_obj pXmlElClientSideCredential; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), namespace_eapmetadata, pXmlElClientSideCredential))) - throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); + { + // + com_obj pXmlElClientSideCredential; + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), namespace_eapmetadata, pXmlElClientSideCredential))) + throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); - // / - if (!m_anonymous_identity.empty()) - if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, bstr(L"AnonymousIdentity"), namespace_eapmetadata, bstr(m_anonymous_identity)))) - throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); + // / + if (!m_anonymous_identity.empty()) + if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, bstr(L"AnonymousIdentity"), namespace_eapmetadata, bstr(m_anonymous_identity)))) + throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); + } // com_obj pXmlElInnerAuthenticationMethod; @@ -165,8 +167,8 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) } } else { // Nonexisting means: use blank configured credentials. - com_obj pXmlElClientCertificate; - hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, pXmlElClientCertificate); + com_obj pXmlElClientCertificate_blank; + hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, pXmlElClientCertificate_blank); } } } @@ -178,14 +180,16 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) m_anonymous_identity.clear(); - // - com_obj pXmlElClientSideCredential; - if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { - wstring xpathClientSideCredential(xpath + L"/ClientSideCredential"); + { + // + com_obj pXmlElClientSideCredential; + if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { + wstring xpathClientSideCredential(xpath + L"/ClientSideCredential"); - // - eapxml::get_element_value(pXmlElClientSideCredential, bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity); - m_module.log_config((xpathClientSideCredential + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str()); + // + eapxml::get_element_value(pXmlElClientSideCredential, bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity); + m_module.log_config((xpathClientSideCredential + L"/AnonymousIdentity").c_str(), m_anonymous_identity.c_str()); + } } // diff --git a/lib/TTLS/src/Method.cpp b/lib/TTLS/src/Method.cpp index 42bafb7..386d9f9 100644 --- a/lib/TTLS/src/Method.cpp +++ b/lib/TTLS/src/Method.cpp @@ -1,5 +1,5 @@ /* - Copyright 2015-2016 Amebis + Copyright 2015-2018 Amebis Copyright 2016 GÉANT This file is part of GÉANTLink. @@ -553,8 +553,7 @@ EapPeerMethodResponseAction eap::method_ttls::process_request_packet( if (status == SEC_E_OK) { // Get server certificate. - SECURITY_STATUS status = QueryContextAttributes(m_sc_ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (PVOID)&m_sc_cert); - if (FAILED(status)) + if (FAILED(status = QueryContextAttributes(m_sc_ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (PVOID)&m_sc_cert))) throw sec_runtime_error(status, __FUNCTION__ " Error retrieving server certificate from Schannel."); // Add all trusted root CAs to server certificate's store. This allows CertGetIssuerCertificateFromStore() in the following CRL check to test the root CA for revocation too. @@ -637,13 +636,11 @@ EapPeerMethodResponseAction eap::method_ttls::process_request_packet( // Push keying material to inner MSCHAPv2 method. static const DWORD s_key_id = 0x02; // EAP-TTLSv0 Challenge Data static const SecPkgContext_EapPrfInfo s_prf_info = { 0, sizeof(s_key_id), (PBYTE)&s_key_id }; - SECURITY_STATUS status = SetContextAttributes(m_sc_ctx, SECPKG_ATTR_EAP_PRF_INFO, (void*)&s_prf_info, sizeof(s_prf_info)); - if (FAILED(status)) + if (FAILED(status = SetContextAttributes(m_sc_ctx, SECPKG_ATTR_EAP_PRF_INFO, (void*)&s_prf_info, sizeof(s_prf_info)))) throw sec_runtime_error(status, __FUNCTION__ " Error setting TTLS PRF in Schannel."); SecPkgContext_EapKeyBlock key_block; - status = QueryContextAttributes(m_sc_ctx, SECPKG_ATTR_EAP_KEY_BLOCK, &key_block); - if (FAILED(status)) + if (FAILED(status = QueryContextAttributes(m_sc_ctx, SECPKG_ATTR_EAP_KEY_BLOCK, &key_block))) throw sec_runtime_error(status, __FUNCTION__ " Error generating PRF in Schannel."); inner_mschapv2->m_challenge_server.assign(key_block.rgbKeys, key_block.rgbKeys + sizeof(challenge_mschapv2)); @@ -671,7 +668,7 @@ EapPeerMethodResponseAction eap::method_ttls::process_request_packet( { 0, SECBUFFER_EMPTY, NULL }, }; SecBufferDesc buf_desc = { SECBUFFER_VERSION, _countof(buf), buf }; - SECURITY_STATUS status = DecryptMessage(m_sc_ctx, &buf_desc, 0, NULL); + status = DecryptMessage(m_sc_ctx, &buf_desc, 0, NULL); if (status == SEC_E_OK) { // Process data (only the first SECBUFFER_DATA found). for (size_t i = 0; i < _countof(buf); i++) diff --git a/lib/WinStd b/lib/WinStd index f2f62d5..7f2515f 160000 --- a/lib/WinStd +++ b/lib/WinStd @@ -1 +1 @@ -Subproject commit f2f62d5cacb71d60626274bfb45daae9c086f620 +Subproject commit 7f2515f54aab4fe1a4c0cec3542efc72cacf9e9d diff --git a/lib/wxExtend b/lib/wxExtend index 321e1c3..b161059 160000 --- a/lib/wxExtend +++ b/lib/wxExtend @@ -1 +1 @@ -Subproject commit 321e1c389e2be356f34ba5712cd833a182b88467 +Subproject commit b16105985577ab3485d860926c5dcd7e6b32be2e