eapol/eapol_framework/eapol_common/common/eap_state_notification.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
--- a/eapol/eapol_framework/eapol_common/common/eap_state_notification.cpp	Thu Aug 19 09:58:27 2010 +0300
+++ b/eapol/eapol_framework/eapol_common/common/eap_state_notification.cpp	Tue Aug 31 15:16:37 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 20.1.2 %
+* %version: %
 */
 
 // This is enumeration of EAPOL source code.
@@ -33,10 +33,13 @@
 #include "eap_am_tools.h"
 #include "eap_tools.h"
 #include "eapol_key_types.h"
+#include "eap_am_network_id.h"
 
 
 EAP_FUNC_EXPORT eap_state_notification_c::~eap_state_notification_c()
 {
+	delete m_send_network_id;
+	m_send_network_id = 0;
 }
 
 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
@@ -58,15 +61,30 @@
 	, m_eap_type(eap_type_none)
 	, m_previous_state(previous_state)
 	, m_current_state(current_state)
-	, m_send_network_id(send_network_id)
+	, m_send_network_id(0)
 	, m_is_client(is_client)
 	, m_eap_identifier(eap_identifier)
 	, m_allow_send_eap_success(allow_send_eap_success)
 	, m_authentication_error(eap_status_ok)
 {
-}
+	if (send_network_id == 0
+		|| send_network_id->get_is_valid() == false)
+	{
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
+
+	m_send_network_id = send_network_id->copy();
 
-#if defined(USE_EAP_EXPANDED_TYPES)
+	if (m_send_network_id == 0
+		|| m_send_network_id->get_is_valid() == false)
+	{
+		delete m_send_network_id;
+		m_send_network_id = 0;
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
+}
 
 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
 	abs_eap_am_tools_c * const tools,
@@ -87,15 +105,30 @@
 	, m_eap_type(eap_type)
 	, m_previous_state(previous_state)
 	, m_current_state(current_state)
-	, m_send_network_id(send_network_id)
+	, m_send_network_id(0)
 	, m_is_client(is_client)
 	, m_eap_identifier(eap_identifier)
 	, m_allow_send_eap_success(allow_send_eap_success)
 	, m_authentication_error(eap_status_ok)
 {
-}
+	if (send_network_id == 0
+		|| send_network_id->get_is_valid() == false)
+	{
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
+
+	m_send_network_id = send_network_id->copy();
 
-#endif //#if defined(USE_EAP_EXPANDED_TYPES)
+	if (m_send_network_id == 0
+		|| m_send_network_id->get_is_valid() == false)
+	{
+		delete m_send_network_id;
+		m_send_network_id = 0;
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
+}
 
 
 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
@@ -117,12 +150,29 @@
 	, m_eap_type(eap_type)
 	, m_previous_state(previous_state)
 	, m_current_state(current_state)
-	, m_send_network_id(send_network_id)
+	, m_send_network_id(0)
 	, m_is_client(is_client)
 	, m_eap_identifier(eap_identifier)
 	, m_allow_send_eap_success(allow_send_eap_success)
 	, m_authentication_error(eap_status_ok)
 {
+	if (send_network_id == 0
+		|| send_network_id->get_is_valid() == false)
+	{
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
+
+	m_send_network_id = send_network_id->copy();
+
+	if (m_send_network_id == 0
+		|| m_send_network_id->get_is_valid() == false)
+	{
+		delete m_send_network_id;
+		m_send_network_id = 0;
+		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
+		return;
+	}
 }
 
 EAP_FUNC_EXPORT const eap_am_network_id_c * eap_state_notification_c::get_send_network_id() const
@@ -371,6 +421,7 @@
 #if defined(USE_WAPI_CORE)
 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_wai_handshake)
 #endif //#if defined(USE_WAPI_CORE)
+		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_authenticated)
 		else
 		{
 			return EAPL("Unknown EAPOL protocol");