diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index 5d52390..0aa878f 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -660,13 +660,13 @@ void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot) if (match(*cfg_prov)) { // Matching provider found. Create matching blank credential set, then load. if (cfg_prov->m_methods.empty()) - throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str())); m_cred.reset(cfg_prov->m_methods.front().get()->make_credentials()); m_cred->load(pXmlElClientSideCredential); break; } } else - throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str())); } } @@ -702,13 +702,13 @@ void eap::credentials_connection::operator>>(_Inout_ cursor_in &cursor) if (match(*cfg_prov)) { // Matching provider found. Create matching blank credential set, then read. if (cfg_prov->m_methods.empty()) - throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str())); m_cred.reset(cfg_prov->m_methods.front().get()->make_credentials()); cursor >> *m_cred; break; } } else - throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str())); } } diff --git a/lib/EAPBase/src/Method.cpp b/lib/EAPBase/src/Method.cpp index 3d944b1..3a6a0c2 100644 --- a/lib/EAPBase/src/Method.cpp +++ b/lib/EAPBase/src/Method.cpp @@ -341,7 +341,7 @@ void eap::method_eap::get_response_packet( // Check packet size. We will suggest one EAP method alone, so we need one byte for data. size_t size_packet = sizeof(EapPacket) + 1; if (size_packet > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, size_max)); packet.reserve(size_packet); // To avoid reallocation when inserting EAP packet header later. // Data of Legacy Nak packet is a list of supported EAP types: our method alone. diff --git a/lib/EapHost/include/Method.h b/lib/EapHost/include/Method.h index 392d23c..a2d324f 100644 --- a/lib/EapHost/include/Method.h +++ b/lib/EapHost/include/Method.h @@ -142,7 +142,7 @@ namespace eap case EapHostPeerResponseRespond : return EapPeerMethodResponseActionRespond ; case EapHostPeerResponseStartAuthentication: return EapPeerMethodResponseActionDiscard ; // The session could not be found. So the supplicant either needs to start session again with the same packet or discard the packet. case EapHostPeerResponseNone : return EapPeerMethodResponseActionNone ; - default : throw std::invalid_argument(winstd::string_printf(__FUNCTION__ " Unknown action (%u).", action).c_str()); + default : throw std::invalid_argument(winstd::string_printf(__FUNCTION__ " Unknown action (%u).", action)); } } diff --git a/lib/MSCHAPv2/src/Method.cpp b/lib/MSCHAPv2/src/Method.cpp index 2519ad0..76f9d9c 100644 --- a/lib/MSCHAPv2/src/Method.cpp +++ b/lib/MSCHAPv2/src/Method.cpp @@ -96,7 +96,7 @@ void eap::method_mschapv2_base::get_response_packet( _In_opt_ DWORD size_max) { if (m_packet_res.size() > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max)); packet.assign(m_packet_res.begin(), m_packet_res.end()); } @@ -173,7 +173,7 @@ void eap::method_mschapv2_base::process_error(_In_ const list &argv) bool is_last; dec.decode(resp, is_last, val.data() + 2, (size_t)-1); if (resp.size() != sizeof(m_challenge_server)) - throw invalid_argument(string_printf(__FUNCTION__ " Incorrect MSCHAPv2 challenge length (expected: %uB, received: %uB).", sizeof(m_challenge_server), resp.size()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Incorrect MSCHAPv2 challenge length (expected: %uB, received: %uB).", sizeof(m_challenge_server), resp.size())); memcpy(&m_challenge_server, resp.data(), sizeof(m_challenge_server)); } else if ((val[0] == 'M' || val[0] == 'm') && val[1] == '=') { MultiByteToWideChar(CP_UTF8, 0, val.data() + 2, -1, m_cfg.m_last_msg); @@ -423,7 +423,7 @@ EapPeerMethodResponseAction eap::method_mschapv2_diameter::process_request_packe return EapPeerMethodResponseActionNone; default: - throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase)); } } @@ -457,7 +457,7 @@ void eap::method_mschapv2_diameter::process_packet(_In_bytecount_(size_pck) cons if (code == 26 && vendor == 311) { // MS-CHAP2-Success if (msg[0] != m_ident) - throw invalid_argument(string_printf(__FUNCTION__ " Wrong MSCHAPv2 ident (expected: %u, received: %u).", m_ident, msg[0]).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Wrong MSCHAPv2 ident (expected: %u, received: %u).", m_ident, msg[0])); const char *str = reinterpret_cast(msg + 1); process_success(parse_response(str, (reinterpret_cast(msg_end) - str))); } else if (code == 2 && vendor == 311) { @@ -466,7 +466,7 @@ void eap::method_mschapv2_diameter::process_packet(_In_bytecount_(size_pck) cons const char *str = reinterpret_cast(msg + 1); process_error(parse_response(str, (reinterpret_cast(msg_end) - str))); } else if (hdr->flags & diameter_avp_flag_mandatory) - throw win_runtime_error(ERROR_NOT_SUPPORTED, string_printf(__FUNCTION__ " Server sent mandatory Diameter AVP we do not support (code: %u, vendor: %u).", code, vendor).c_str()); + throw win_runtime_error(ERROR_NOT_SUPPORTED, string_printf(__FUNCTION__ " Server sent mandatory Diameter AVP we do not support (code: %u, vendor: %u).", code, vendor)); pck = msg_next; } diff --git a/lib/PAP/src/Method.cpp b/lib/PAP/src/Method.cpp index 9c7b41f..94a9849 100644 --- a/lib/PAP/src/Method.cpp +++ b/lib/PAP/src/Method.cpp @@ -112,7 +112,7 @@ EapPeerMethodResponseAction eap::method_pap_diameter::process_request_packet( return EapPeerMethodResponseActionNone; default: - throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase)); } } @@ -122,7 +122,7 @@ void eap::method_pap_diameter::get_response_packet( _In_opt_ DWORD size_max) { if (m_packet_res.size() > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max)); packet.assign(m_packet_res.begin(), m_packet_res.end()); } diff --git a/lib/TTLS/src/Method.cpp b/lib/TTLS/src/Method.cpp index d725e6c..1642754 100644 --- a/lib/TTLS/src/Method.cpp +++ b/lib/TTLS/src/Method.cpp @@ -293,7 +293,7 @@ EapPeerMethodResponseAction eap::method_eapmsg::process_request_packet( } default: - throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase)); } } @@ -325,7 +325,7 @@ void eap::method_eapmsg::get_response_packet( packet.insert(packet.end(), (unsigned int)((4 - size_packet) % 4), 0); } else { if (m_packet_res.size() > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max)); packet.assign(m_packet_res.begin(), m_packet_res.end()); } @@ -653,7 +653,7 @@ EapPeerMethodResponseAction eap::method_ttls::process_request_packet( switch (action) { case EapPeerMethodResponseActionSend: m_packet_res_inner = true ; break; case EapPeerMethodResponseActionNone: m_packet_res_inner = false; break; - default : throw invalid_argument(string_printf(__FUNCTION__ " Inner method returned an unsupported action (action %u).", action).c_str()); + default : throw invalid_argument(string_printf(__FUNCTION__ " Inner method returned an unsupported action (action %u).", action)); } } return EapPeerMethodResponseActionSend; @@ -717,7 +717,7 @@ EapPeerMethodResponseAction eap::method_ttls::process_request_packet( } default: - throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Unknown phase (phase %u).", m_phase)); } } @@ -733,7 +733,7 @@ void eap::method_ttls::get_response_packet( if (FAILED(status)) throw sec_runtime_error(status, __FUNCTION__ " Error getting Schannel required encryption sizes."); if (m_packet_res.size() + sizes.cbHeader + sizes.cbTrailer > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max)); sizes.cbMaximumMessage = std::min(sizes.cbMaximumMessage, size_max - (unsigned long)(m_packet_res.size() + sizes.cbHeader + sizes.cbTrailer)); // Get inner response packet. @@ -762,7 +762,7 @@ void eap::method_ttls::get_response_packet( m_packet_res.insert(m_packet_res.end(), reinterpret_cast(buf[0].pvBuffer), reinterpret_cast(buf[0].pvBuffer) + buf[0].cbBuffer + buf[1].cbBuffer + buf[2].cbBuffer); } } else if (m_packet_res.size() > size_max) - throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max)); packet.assign(m_packet_res.begin(), m_packet_res.end()); } diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index 019c1af..a3a36d7 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -218,12 +218,12 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session( if (s->m_cred.match(*cfg_prov)) { // Matching provider found. if (cfg_prov->m_methods.empty()) - throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str())); cfg_method = dynamic_cast(cfg_prov->m_methods.front().get()); break; } } else - throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", s->m_cred.get_id().c_str()).c_str()); + throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", s->m_cred.get_id().c_str())); } // We have configuration, we have credentials, create method.