From 5b02352f1a7c437ef1e3d4cfb768803484f21441 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 5 Feb 2020 10:14:14 +0100 Subject: [PATCH] Resolve the make_...() methods Signed-off-by: Simon Rozman --- lib/EAPBase/include/Module.h | 2 +- lib/EAPBase/src/Config.cpp | 4 ++-- lib/EAPBase/src/Module.cpp | 2 +- lib/EAPBase_UI/include/EAP_UI.h | 4 ++-- lib/EAPBase_UI/src/EAP_UI.cpp | 2 +- lib/TLS/include/Module.h | 14 +++++++------- lib/TLS/src/Module.cpp | 12 ++++++------ lib/TTLS/include/Config.h | 32 +++++++++++++------------------- lib/TTLS/include/Module.h | 18 ++++++++++-------- lib/TTLS/src/Config.cpp | 20 ++++++++++---------- lib/TTLS/src/Module.cpp | 2 +- lib/TTLS_UI/include/Module.h | 14 +++++++------- lib/TTLS_UI/src/Module.cpp | 12 ++++++------ 13 files changed, 67 insertions(+), 71 deletions(-) diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index 8b78e76..7ed992f 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -108,7 +108,7 @@ namespace eap /// /// \returns New method configuration /// - virtual config_method* make_config_method(); + virtual config_method* make_config(); /// @} diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index f2f75ec..fbb51ed 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -632,7 +632,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) com_obj pXmlElMethod; pXmlListMethods->get_item(i, &pXmlElMethod); - unique_ptr cfg(m_module.make_config_method()); + unique_ptr cfg(m_module.make_config()); // Check EAP method type (). DWORD dwMethodID; @@ -709,7 +709,7 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor) bool is_nonnull; cursor >> is_nonnull; if (is_nonnull) { - unique_ptr el(m_module.make_config_method()); + unique_ptr el(m_module.make_config()); cursor >> *el; m_methods.push_back(std::move(el)); } else diff --git a/lib/EAPBase/src/Module.cpp b/lib/EAPBase/src/Module.cpp index 3a1a58e..fda9569 100644 --- a/lib/EAPBase/src/Module.cpp +++ b/lib/EAPBase/src/Module.cpp @@ -187,7 +187,7 @@ void eap::module::log_error(_In_ const EAP_ERROR *err) const } -eap::config_method* eap::module::make_config_method() +eap::config_method* eap::module::make_config() { return NULL; } diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index 68e3018..0b92fd3 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -190,7 +190,7 @@ public: #endif // Set banner title. - std::unique_ptr cfg_dummy(cfg.m_module.make_config_method()); + std::unique_ptr cfg_dummy(cfg.m_module.make_config()); m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str())); for (auto provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) { @@ -253,7 +253,7 @@ protected: wxEAPConfigDialogBase::OnProvAdd(event); // One method - std::unique_ptr cfg_method(m_cfg.m_module.make_config_method()); + std::unique_ptr cfg_method(m_cfg.m_module.make_config()); // Create provider. eap::config_provider cfg_provider(m_cfg.m_module); diff --git a/lib/EAPBase_UI/src/EAP_UI.cpp b/lib/EAPBase_UI/src/EAP_UI.cpp index efb7d6f..b8f6b69 100644 --- a/lib/EAPBase_UI/src/EAP_UI.cpp +++ b/lib/EAPBase_UI/src/EAP_UI.cpp @@ -442,7 +442,7 @@ wxEAPProviderSelectDialog::wxEAPProviderSelectDialog(eap::config_connection &cfg wxEAPProviderSelectDialogBase(parent) { // Set banner title. - std::unique_ptr cfg_dummy(cfg.m_module.make_config_method()); + std::unique_ptr cfg_dummy(cfg.m_module.make_config()); m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str())); // Iterate over providers. diff --git a/lib/TLS/include/Module.h b/lib/TLS/include/Module.h index 4539f01..63d6726 100644 --- a/lib/TLS/include/Module.h +++ b/lib/TLS/include/Module.h @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ namespace eap @@ -157,12 +157,12 @@ namespace eap protected: /// - /// Makes a new inner method + /// Makes a new method /// /// \param[in] cfg Method configuration /// \param[in] cred Credentials /// - /// \returns A new inner method of given type + /// \returns A new method /// virtual method* make_method(_In_ config_method_tls &cfg, _In_ credentials_tls &cred) = 0; diff --git a/lib/TLS/src/Module.cpp b/lib/TLS/src/Module.cpp index 70420d2..fcd5345 100644 --- a/lib/TLS/src/Module.cpp +++ b/lib/TLS/src/Module.cpp @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ #include "StdAfx.h" @@ -170,7 +170,7 @@ void eap::peer_tls_base::credentials_xml2blob( UNREFERENCED_PARAMETER(dwConnectionDataSize); // Load credentials from XML. - unique_ptr cfg(make_config_method()); + unique_ptr cfg(make_config()); unique_ptr cred(cfg->make_credentials()); cred->load(pConfigRoot); diff --git a/lib/TTLS/include/Config.h b/lib/TTLS/include/Config.h index d37717b..b58eb8b 100644 --- a/lib/TTLS/include/Config.h +++ b/lib/TTLS/include/Config.h @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ #include @@ -103,6 +103,7 @@ namespace eap /// virtual credentials* make_credentials() const; + protected: /// /// Makes a new inner method config /// @@ -110,7 +111,7 @@ namespace eap /// /// \returns A new inner method config of given type /// - virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const = 0; + virtual config_method* make_inner_config(_In_ winstd::eap_type_t eap_type) const = 0; /// /// Makes a new inner method config @@ -119,7 +120,7 @@ namespace eap /// /// \returns A new inner method config of given type /// - virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const = 0; + virtual config_method* make_inner_config(_In_ const wchar_t *eap_type) const = 0; public: std::unique_ptr m_inner; ///< Inner authentication configuration @@ -192,23 +193,16 @@ namespace eap /// virtual const wchar_t* get_method_str() const; + protected: /// - /// Makes a new inner method config + /// @copydoc eap::config_method_tls_tunnel::make_inner_config() /// - /// \param[in] eap_type EAP type - /// - /// \returns A new inner method config of given type - /// - virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const; + virtual config_method* make_inner_config(_In_ winstd::eap_type_t eap_type) const; /// - /// Makes a new inner method config + /// @copydoc eap::config_method_tls_tunnel::make_inner_config() /// - /// \param[in] eap_type EAP type - /// - /// \returns A new inner method config of given type - /// - virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const; + virtual config_method* make_inner_config(_In_ const wchar_t *eap_type) const; }; /// @} diff --git a/lib/TTLS/include/Module.h b/lib/TTLS/include/Module.h index be0714c..7abcafd 100644 --- a/lib/TTLS/include/Module.h +++ b/lib/TTLS/include/Module.h @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ namespace eap @@ -78,13 +78,15 @@ namespace eap peer_ttls(); /// - /// @copydoc eap::method::make_config_method() + /// @copydoc eap::method::make_config() /// \returns This implementation always returns `eap::config_method_ttls` type of configuration /// - virtual config_method* make_config_method(); + virtual config_method* make_config(); protected: - /// @copydoc eap::method::make_config_method() + /// + /// @copydoc eap::peer_tls_base::make_method() + /// virtual method* make_method(_In_ config_method_tls &cfg, _In_ credentials_tls &cred); }; diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index b9cd4a7..7b1a0a1 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ #include "StdAfx.h" @@ -95,7 +95,7 @@ void eap::config_method_tls_tunnel::operator>>(_Inout_ cursor_in &cursor) eap_type_t eap_type; cursor >> eap_type; - m_inner.reset(make_config_method(eap_type)); + m_inner.reset(make_inner_config(eap_type)); cursor >> *m_inner; } @@ -253,10 +253,10 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) #endif )) { - m_inner.reset(make_config_method((eap_type_t)dwMethod)); + m_inner.reset(make_inner_config((eap_type_t)dwMethod)); m_module.log_config((xpath + L"/EAPMethod").c_str(), m_inner->get_method_str()); } else if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:NonEAPAuthMethod"), bstrMethod))) { - m_inner.reset(make_config_method(bstrMethod)); + m_inner.reset(make_inner_config(bstrMethod)); m_module.log_config((xpath + L"/NonEAPAuthMethod").c_str(), m_inner->get_method_str()); } else throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Unsupported inner authentication method."); @@ -277,7 +277,7 @@ const wchar_t* eap::config_method_ttls::get_method_str() const } -eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap_type_t eap_type) const +eap::config_method* eap::config_method_ttls::make_inner_config(_In_ winstd::eap_type_t eap_type) const { switch (eap_type) { case eap_type_t::legacy_pap : return new config_method_pap (m_module, m_level + 1); @@ -292,7 +292,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap } -eap::config_method* eap::config_method_ttls::make_config_method(_In_ const wchar_t *eap_type) const +eap::config_method* eap::config_method_ttls::make_inner_config(_In_ const wchar_t *eap_type) const { if (_wcsicmp(eap_type, L"PAP" ) == 0) return new config_method_pap (m_module, m_level + 1); else if (_wcsicmp(eap_type, L"MSCHAPv2" ) == 0) return new config_method_mschapv2 (m_module, m_level + 1); diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index 51759e6..5173da0 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -165,7 +165,7 @@ eap::peer_ttls::peer_ttls() : peer_tls_tunnel(eap_type_t::ttls) } -eap::config_method* eap::peer_ttls::make_config_method() +eap::config_method* eap::peer_ttls::make_config() { return new config_method_ttls(*this, 0); } diff --git a/lib/TTLS_UI/include/Module.h b/lib/TTLS_UI/include/Module.h index a793550..44e21ac 100644 --- a/lib/TTLS_UI/include/Module.h +++ b/lib/TTLS_UI/include/Module.h @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ namespace eap @@ -47,10 +47,10 @@ namespace eap peer_ttls_ui(); /// - /// @copydoc eap::method::make_config_method() + /// @copydoc eap::method::make_config() /// \returns This implementation always returns `eap::config_method_ttls` type of configuration /// - virtual config_method* make_config_method(); + virtual config_method* make_config(); virtual void invoke_config_ui( _In_ HWND hwndParent, diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index 627c3da..2755438 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -1,21 +1,21 @@ /* Copyright 2015-2020 Amebis - Copyright 2016 GÉANT + Copyright 2016 GÉANT - This file is part of GÉANTLink. + This file is part of GÉANTLink. - GÉANTLink is free software: you can redistribute it and/or modify it + GÉANTLink is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - GÉANTLink is distributed in the hope that it will be useful, but + GÉANTLink is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GÉANTLink. If not, see . + along with GÉANTLink. If not, see . */ #include "StdAfx.h" @@ -33,7 +33,7 @@ eap::peer_ttls_ui::peer_ttls_ui() : peer_ui(eap_type_t::ttls, _T("EAP-TTLS_UI")) } -eap::config_method* eap::peer_ttls_ui::make_config_method() +eap::config_method* eap::peer_ttls_ui::make_config() { return new config_method_ttls(*this, 0); }