eapol/eapol_framework/eapol_common/type/securid/core/eap_type_securid_client.cpp
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: %
    19 * %version: 14.1.3 %
    20 */
    20 */
    21 
    21 
    22 // This is enumeration of EAPOL source code.
    22 // This is enumeration of EAPOL source code.
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    24 	#undef EAP_FILE_NUMBER_ENUM
    24 	#undef EAP_FILE_NUMBER_ENUM
   108 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   108 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   109 
   109 
   110 	EAP_TRACE_DATA_DEBUG(
   110 	EAP_TRACE_DATA_DEBUG(
   111 		m_am_tools,
   111 		m_am_tools,
   112 		TRACE_FLAGS_DEFAULT,
   112 		TRACE_FLAGS_DEFAULT,
   113 		(EAPL("EAP_type_GTC: function: complete_eap_identity_query, identity:"),
   113 		(EAPL("EAP_type_GTC: function: complete_eap_identity_query, m_identity:"),
   114 		 m_identity.get_data(m_identity.get_data_length()),
   114 		 m_identity.get_data(),
   115 		 m_identity.get_data_length()));
   115 		 m_identity.get_data_length()));
       
   116 
       
   117 	EAP_TRACE_DATA_DEBUG(
       
   118 		m_am_tools,
       
   119 		TRACE_FLAGS_DEFAULT,
       
   120 		(EAPL("EAP_type_GTC: function: complete_eap_identity_query, identity_utf8:"),
       
   121 		 identity_utf8->get_data(),
       
   122 		 identity_utf8->get_data_length()));
   116 
   123 
   117 	eap_status_e status = get_type_partner()->complete_eap_identity_query(
   124 	eap_status_e status = get_type_partner()->complete_eap_identity_query(
   118 		&m_send_network_id,
   125 		&m_send_network_id,
   119 		identity_utf8,
   126 		identity_utf8,
   120 		m_identifier);
   127 		m_identifier);
   322 			EAP_TRACE_DEBUG(
   329 			EAP_TRACE_DEBUG(
   323 				m_am_tools,
   330 				m_am_tools,
   324 				TRACE_FLAGS_DEFAULT,
   331 				TRACE_FLAGS_DEFAULT,
   325 				(EAPL("WARNING: EAP-GTC: eap_type_securid_c::client_gtc_packet_process(): skips user interactions\n")));
   332 				(EAPL("WARNING: EAP-GTC: eap_type_securid_c::client_gtc_packet_process(): skips user interactions\n")));
   326 
   333 
   327 			status = client_gtc_complete_user_input_query(&m_passcode);
   334 			status = client_gtc_complete_user_input_query(&m_identity, &m_passcode);
   328 		}
   335 		}
   329 		else
   336 		else
   330 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
   337 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
   331 		{
   338 		{
   332 			eap_variable_data_c message(m_am_tools);
   339 			eap_variable_data_c message(m_am_tools);
   491 }
   498 }
   492 
   499 
   493 //--------------------------------------------------
   500 //--------------------------------------------------
   494 
   501 
   495 EAP_FUNC_EXPORT eap_status_e eap_type_securid_c::client_gtc_complete_user_input_query(
   502 EAP_FUNC_EXPORT eap_status_e eap_type_securid_c::client_gtc_complete_user_input_query(
       
   503 	const eap_variable_data_c * const identity_utf8,
   496 	const eap_variable_data_c * const response_utf8)
   504 	const eap_variable_data_c * const response_utf8)
   497 {
   505 {
   498 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   506 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   507 
       
   508 	eap_status_e status(eap_status_ok);
       
   509 
       
   510 	if (identity_utf8->get_is_valid_data() == true)
       
   511 	{
       
   512 		status = m_identity.set_copy_of_buffer(identity_utf8);
       
   513 		if (status != eap_status_ok)
       
   514 		{
       
   515 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   516 		}
       
   517 	}
   499 
   518 
   500 	// Send response
   519 	// Send response
   501 	u32_t packet_length = eap_header_base_c::get_type_data_start_offset(m_use_eap_expanded_type)
   520 	u32_t packet_length = eap_header_base_c::get_type_data_start_offset(m_use_eap_expanded_type)
   502 		+ response_utf8->get_data_length();
   521 		+ response_utf8->get_data_length();
   503 
   522 
   553 				delete packet;
   572 				delete packet;
   554 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   573 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   555 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   574 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   556 			}
   575 			}
   557 
   576 
   558 			eap_status_e status = eap_fast_response.set_copy_of_buffer(EAP_FAST_EAP_GTC_RESPONSE_PREFIX, EAP_FAST_EAP_GTC_RESPONSE_PREFIX_LENGTH);
   577 			status = eap_fast_response.set_copy_of_buffer(EAP_FAST_EAP_GTC_RESPONSE_PREFIX, EAP_FAST_EAP_GTC_RESPONSE_PREFIX_LENGTH);
   559 			if (status != eap_status_ok)
   578 			if (status != eap_status_ok)
   560 			{
   579 			{
   561 				delete packet;
   580 				delete packet;
   562 				return EAP_STATUS_RETURN(m_am_tools, status);
   581 				return EAP_STATUS_RETURN(m_am_tools, status);
   563 			}
   582 			}
   564 
   583 
       
   584 			EAP_TRACE_DATA_DEBUG(
       
   585 				m_am_tools,
       
   586 				TRACE_FLAGS_DEFAULT,
       
   587 				(EAPL("EAP_type_GTC: function: eap_type_securid_c::client_gtc_complete_user_input_query(): m_identity:"),
       
   588 				 m_identity.get_data(),
       
   589 				 m_identity.get_data_length()));
       
   590 
   565 			status = eap_fast_response.add_data(&m_identity);
   591 			status = eap_fast_response.add_data(&m_identity);
   566 			if (status != eap_status_ok)
   592 			if (status != eap_status_ok)
   567 			{
   593 			{
   568 				delete packet;
   594 				delete packet;
   569 				return EAP_STATUS_RETURN(m_am_tools, status);
   595 				return EAP_STATUS_RETURN(m_am_tools, status);
   573 			if (status != eap_status_ok)
   599 			if (status != eap_status_ok)
   574 			{
   600 			{
   575 				delete packet;
   601 				delete packet;
   576 				return EAP_STATUS_RETURN(m_am_tools, status);
   602 				return EAP_STATUS_RETURN(m_am_tools, status);
   577 			}
   603 			}
       
   604 
       
   605 			EAP_TRACE_DATA_DEBUG(
       
   606 				m_am_tools,
       
   607 				TRACE_FLAGS_DEFAULT,
       
   608 				(EAPL("EAP_type_GTC: function: eap_type_securid_c::client_gtc_complete_user_input_query(): response_utf8:"),
       
   609 				 response_utf8->get_data(),
       
   610 				 response_utf8->get_data_length()));
   578 
   611 
   579 			status = eap_fast_response.add_data(response_utf8);
   612 			status = eap_fast_response.add_data(response_utf8);
   580 			if (status != eap_status_ok)
   613 			if (status != eap_status_ok)
   581 			{
   614 			{
   582 				delete packet;
   615 				delete packet;
   596 				response_utf8->get_data(response_utf8->get_data_length()),
   629 				response_utf8->get_data(response_utf8->get_data_length()),
   597 				response_utf8->get_data_length());
   630 				response_utf8->get_data_length());
   598 		}
   631 		}
   599 	}
   632 	}
   600 
   633 
   601 	eap_status_e status = packet_send(packet, packet_length);
   634 	status = packet_send(packet, packet_length);
   602 	delete packet;
   635 	delete packet;
   603 
   636 
   604 	m_is_pending = false;
   637 	m_is_pending = false;
   605 
   638 
   606 	m_state.set_state(eap_type_securid_state_gtc_user_input_query);
   639 	m_state.set_state(eap_type_securid_state_gtc_user_input_query);