eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/eap_am_type_securid_symbian.cpp
changeset 39 fe6b6762fccd
parent 33 938269283a16
child 49 43351a4f2da3
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 29.1.14 %
    19 * %version: 29.1.36 %
    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
    37 #include "eap_am_memory.h"
    37 #include "eap_am_memory.h"
    38 #include "eap_tools.h"
    38 #include "eap_tools.h"
    39 #include "eap_am_type_securid_symbian.h"
    39 #include "eap_am_type_securid_symbian.h"
    40 #include "EapSecurIDDbParameterNames.h"
    40 #include "EapSecurIDDbParameterNames.h"
    41 #include "EapSecurIDDbUtils.h"
    41 #include "EapSecurIDDbUtils.h"
    42 
    42 #include "EapPluginDbDefaults.h"
    43 #include "eap_auth_notifier.h"
    43 #include "eap_auth_notifier.h"
    44 
    44 
    45 
    45 
    46 #include "EapGtcDbParameterNames.h"
    46 #include "EapGtcDbParameterNames.h"
    47 #include "EapGtcDbUtils.h"
    47 #include "EapGtcDbUtils.h"
    97 		this));
    97 		this));
    98 
    98 
    99 
    99 
   100 	m_shutdown_was_called = true;
   100 	m_shutdown_was_called = true;
   101 
   101 
       
   102 	m_partner->cancel_timer(this, EHandlingTimerCall);
       
   103 	
   102 	EAP_TRACE_DEBUG(
   104 	EAP_TRACE_DEBUG(
   103 		m_am_tools, 
   105 		m_am_tools, 
   104 		TRACE_FLAGS_DEFAULT, 
   106 		TRACE_FLAGS_DEFAULT, 
   105 		(EAPL("eap_am_type_securid_symbian_c::shutdown(): this = 0x%08x returns\n"),
   107 		(EAPL("eap_am_type_securid_symbian_c::shutdown(): this = 0x%08x returns\n"),
   106 		this));
   108 		this));
   196 
   198 
   197 //--------------------------------------------------
   199 //--------------------------------------------------
   198 
   200 
   199 void eap_am_type_securid_symbian_c::ConstructL()
   201 void eap_am_type_securid_symbian_c::ConstructL()
   200 {
   202 {
       
   203 	TInt error = m_session.Connect();
       
   204 	EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_type_securid_symbian_c::ConstructL(): - m_session.Connect(), error=%d\n"), error));
       
   205 	User::LeaveIfError(error);
       
   206 
   201 	// Open/create database
   207 	// Open/create database
   202 	if (m_eap_type == eap_type_generic_token_card)
   208 	if (m_eap_type == eap_type_generic_token_card)
   203 	{
   209 	{
   204 		EapGtcDbUtils::OpenDatabaseL(m_database, m_session, m_index_type, m_index, m_tunneling_type);
   210 		EapGtcDbUtils::OpenDatabaseL(m_database, m_session, m_index_type, m_index, m_tunneling_type);
   205 	}
   211 	}
   294 	const eap_configuration_field_c * const field,
   300 	const eap_configuration_field_c * const field,
   295 	eap_variable_data_c * const data)
   301 	eap_variable_data_c * const data)
   296 {
   302 {
   297 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   303 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   298 	EAP_ASSERT(data != 0);
   304 	EAP_ASSERT(data != 0);
       
   305 
   299 	// Trap must be set here because the OS independent portion of EAP SecurID
   306 	// Trap must be set here because the OS independent portion of EAP SecurID
   300 	// that calls this function does not know anything about Symbian.	
   307 	// that calls this function does not know anything about Symbian.	
   301 	eap_status_e status(eap_status_ok);
   308 	eap_status_e status(eap_status_ok);
       
   309 
   302 	TRAPD(err, type_configure_readL(
   310 	TRAPD(err, type_configure_readL(
   303 		field->get_field(),
   311 		field->get_field(),
   304 		field->get_field_length(),
   312 		field->get_field_length(),
   305 		data));
   313 		data));
   306 	if (err != KErrNone) 
   314 	if (err != KErrNone) 
   326 	eap_config_string field,
   334 	eap_config_string field,
   327 	const u32_t field_length,
   335 	const u32_t field_length,
   328 	eap_variable_data_c * const data)
   336 	eap_variable_data_c * const data)
   329 {
   337 {
   330 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   338 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   339 	EAP_TRACE_DEBUG(
       
   340 		m_am_tools, 
       
   341 		TRACE_FLAGS_DEFAULT,
       
   342 		(EAPL("eap_am_type_securid_symbian_c::type_configure_readL(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"),
       
   343 		m_index_type,
       
   344 		m_index,
       
   345 		m_tunneling_type.get_vendor_id(),
       
   346 		m_tunneling_type.get_vendor_type()));
       
   347 
   331 	EAP_UNREFERENCED_PARAMETER(field_length);
   348 	EAP_UNREFERENCED_PARAMETER(field_length);
   332 
   349 
   333 	// Create a buffer for the ascii strings - initialised with the argument
   350 	// Create a buffer for the ascii strings - initialised with the argument
   334 	HBufC16* unicodeBuf = HBufC16::NewLC(KMaxDBFieldNameLength);
   351 	HBufC16* unicodeBuf = HBufC16::NewLC(KMaxDBFieldNameLength);
   335 	TPtr16 unicodeString = unicodeBuf->Des();
   352 	TPtr16 unicodeString = unicodeBuf->Des();
   482 
   499 
   483 	{
   500 	{
   484 		// Read Maximum Session Validity Time from the config file
   501 		// Read Maximum Session Validity Time from the config file
   485 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   502 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   486 		
   503 		
   487 		eap_status_e status = m_partner->read_configure(
   504 		eap_status_e status = type_configure_read(
   488 			cf_str_EAP_GTC_max_session_validity_time.get_field(),
   505 			cf_str_EAP_GTC_max_session_validity_time.get_field(),
   489 			&sessionTimeFromFile);
   506 			&sessionTimeFromFile);
   490 		
   507 		
   491 		if (status == eap_status_ok
   508 		if (status == eap_status_ok
   492 			&& sessionTimeFromFile.get_is_valid_data() == true
   509 			&& sessionTimeFromFile.get_is_valid_data() == true
   544 
   561 
   545 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog(
   562 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog(
   546 	eap_variable_data_c * const /*passcode*/,
   563 	eap_variable_data_c * const /*passcode*/,
   547 	bool is_first_query)
   564 	bool is_first_query)
   548 {
   565 {
   549 		m_state = EHandlingPasscodeQuery;
   566 	EAP_TRACE_DEBUG(
   550 	//     m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo;
   567 		m_am_tools, 
   551 		if (is_first_query == true)
   568 		TRACE_FLAGS_DEFAULT,
   552 		{
   569 		(EAPL("eap_am_type_securid_symbian_c::show_passcode_query_dialog(): is_first_query=%d\n"),
   553 			m_dialog_data_ptr->iIsFirstQuery = ETrue;
   570 		is_first_query));
   554 		}
   571 
       
   572 	eap_status_e status = eap_status_pending_request;
       
   573 	
       
   574 	m_state = EHandlingPasscodeQuery;
       
   575 
       
   576 	TInt err1 = KErrNone;
       
   577 	
       
   578 	TRAPD(err, err1 = IsDlgReadyToCompleteL());
       
   579 	
       
   580 	EAP_TRACE_DEBUG(
       
   581 		m_am_tools, 
       
   582 		TRACE_FLAGS_DEFAULT,
       
   583 		(EAPL("eap_am_type_securid_symbian_c::show_passcode_query_dialog(): err=%d result=%d\n"),
       
   584 		err, err1));
       
   585 
       
   586 	if ((err1 == KErrCancel) || err)
       
   587 		{
       
   588 		TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
       
   589 		
       
   590 		if (iEapAuthNotifier == 0)
       
   591 		    {
       
   592 		    TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
       
   593 		  	if (err)
       
   594 		  		{
       
   595 		  			return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   596 		  		}
       
   597 		    }
       
   598 
       
   599 		if (is_first_query != true)
       
   600 			{
       
   601 			TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGtcChallengeDialog, m_dialog_data_ptr, aEapType));
       
   602 			if (err1)
       
   603 				{
       
   604 				return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   605 				}
       
   606 			}
   555 		else
   607 		else
   556 		{
   608 			{
   557 			m_dialog_data_ptr->iIsFirstQuery = EFalse;
   609 			TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType));
   558 		}
   610 			if (err2)
   559 
   611 				{
   560     TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
   612 				return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
   561     
   613 				}
   562     if (iEapAuthNotifier == 0)
   614 			}
   563     	{
   615 
   564     	TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
   616 		}
   565   		if (err)
   617 	else
   566   			{
   618 		{
   567   				return eap_status_authentication_failure;
   619 		EAP_TRACE_DEBUG(
   568   			}
   620 			m_am_tools, 
   569     	}
   621 			TRACE_FLAGS_DEFAULT,
   570     TRAPD(err, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCSecurIDPasscodeQueryUidDialog, m_dialog_data_ptr, aEapType));
   622 			(EAPL("eap_am_type_securid_symbian_c::show_passcode_query_dialog(): EHandlingTimerCall\n")));
   571 		if (err)
   623 
   572 			{
   624 		if(m_partner->set_timer(this,EHandlingTimerCall,0 /*data*/,2 /*time ms*/) != eap_status_ok)
   573 				return eap_status_authentication_failure;
   625 			status = eap_status_process_general_error;	
   574 			}
   626 		}
   575 
   627 
   576 
   628 
   577 
   629 	return EAP_STATUS_RETURN(m_am_tools, status);
   578 	return eap_status_pending_request;
       
   579 }
   630 }
   580 
   631 
   581 //--------------------------------------------------
   632 //--------------------------------------------------
   582 
   633 
   583 eap_status_e eap_am_type_securid_symbian_c::show_gtc_query_dialog(
   634 eap_status_e eap_am_type_securid_symbian_c::show_gtc_query_dialog(
   591 		TRACE_FLAGS_DEFAULT,
   642 		TRACE_FLAGS_DEFAULT,
   592 		(EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog: message"),
   643 		(EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog: message"),
   593 		message,
   644 		message,
   594 		message_length));
   645 		message_length));
   595 
   646 
   596 		m_state = EHandlingGTCQuery;
   647 	eap_status_e status = eap_status_pending_request;
   597 		
   648 	
       
   649 	m_state = EHandlingGTCQuery;
       
   650 	
       
   651 	TInt err1 = KErrNone;
       
   652 	
       
   653 	TRAPD(err, err1 = IsDlgReadyToCompleteL());
       
   654 	
       
   655 	EAP_TRACE_DEBUG(
       
   656 		m_am_tools, 
       
   657 		TRACE_FLAGS_DEFAULT,
       
   658 		(EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog(): err=%d, result=%d, is_first_query=%d\n"),
       
   659 		err,
       
   660 		err1,
       
   661 		is_first_query));
       
   662 
       
   663 	if ((err1 == KErrCancel) || err)
       
   664 		{
   598 		eap_variable_data_c message_utf8(m_am_tools);
   665 		eap_variable_data_c message_utf8(m_am_tools);
   599 		eap_status_e status = message_utf8.set_buffer(message, message_length, false, false);
   666 		eap_status_e status = message_utf8.set_buffer(message, message_length, false, false);
   600 		if (status != eap_status_ok)
   667 		if (status != eap_status_ok)
   601 		{
   668 			{
   602 			return EAP_STATUS_RETURN(m_am_tools, status);
   669 			return EAP_STATUS_RETURN(m_am_tools, status);
   603 		}
   670 			}
   604 
   671 
   605 		eap_variable_data_c message_unicode(m_am_tools);
   672 		eap_variable_data_c message_unicode(m_am_tools);
   606 		status = m_am_tools->convert_utf8_to_unicode(message_unicode, message_utf8);
   673 		status = m_am_tools->convert_utf8_to_unicode(message_unicode, message_utf8);
   607 		if (status != eap_status_ok)
   674 		if (status != eap_status_ok)
   608 		{
   675 			{
   609 			return EAP_STATUS_RETURN(m_am_tools, status);
   676 			return EAP_STATUS_RETURN(m_am_tools, status);
   610 		}
   677 			}
   611 
   678 
   612 /*		TRAPD(err, m_message_buf = HBufC8::NewL(message_unicode.get_data_length()));
   679 		m_dialog_data_ptr->iUidata.Copy((TText *)message_unicode.get_data(), message_unicode.get_data_length());
   613 		if (err != KErrNone)
   680 
   614 		{
   681 		m_dialog_data_ptr->iPassword.Zero();
   615 			return eap_status_allocation_error;
   682 
   616 		}
   683 		TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
   617 		TPtr8 messageBufPtr = m_message_buf->Des();
       
   618 		
   684 		
   619 		*/
   685 		if (iEapAuthNotifier == 0)
       
   686 		    {
       
   687 		    TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
       
   688 		  	if (err)
       
   689 		  		{
       
   690 		  			return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   691 		  		}
       
   692 		    }
       
   693 
       
   694 		if (is_first_query != true)
       
   695 			{
       
   696 			TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGtcChallengeDialog, m_dialog_data_ptr, aEapType));
       
   697 			if (err1)
       
   698 				{
       
   699 					return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   700 				}
       
   701 			}
       
   702 		else
       
   703 			{
       
   704 			TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCUsernamePasswordDialog, m_dialog_data_ptr, aEapType));
       
   705 			if (err2)
       
   706 				{
       
   707 					return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   708 				}
       
   709 			}
   620 		
   710 		
   621 		m_dialog_data_ptr->iUidata.Copy((TText *)message_unicode.get_data(), message_unicode.get_data_length());
   711 		}
   622 
   712 	else
   623 		if (is_first_query == true)
   713 		{
   624 		{
   714 		EAP_TRACE_DEBUG(
   625 			m_dialog_data_ptr->iIsFirstQuery = ETrue;
   715 			m_am_tools, 
   626 		}
   716 			TRACE_FLAGS_DEFAULT,
   627 		else
   717 			(EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog(): EHandlingTimerCall\n")));
   628 		{
   718 
   629 			m_dialog_data_ptr->iIsFirstQuery = EFalse;
   719 		if(m_partner->set_timer(this,EHandlingTimerCall, 0 /*data*/, 2 /*time ms*/) != eap_status_ok)
   630 		}
   720 			status = eap_status_process_general_error;	
   631 		
   721 		}
   632 	//     m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo;
   722 
   633     TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
   723 	return EAP_STATUS_RETURN(m_am_tools, status);
   634     
       
   635     if (iEapAuthNotifier == 0)
       
   636     	{
       
   637     	TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
       
   638   		if (err)
       
   639   			{
       
   640   				return eap_status_authentication_failure;
       
   641   			}
       
   642     	}
       
   643     TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType));
       
   644 		if (err1)
       
   645 			{
       
   646 				return eap_status_authentication_failure;
       
   647 			}
       
   648 	
       
   649 
       
   650 
       
   651 	return eap_status_pending_request;
       
   652 }
   724 }
   653 
   725 
   654 //--------------------------------------------------
   726 //--------------------------------------------------
   655 
   727 
   656 eap_status_e eap_am_type_securid_symbian_c::show_pincode_query_dialog(
   728 eap_status_e eap_am_type_securid_symbian_c::show_pincode_query_dialog(
   658 	eap_variable_data_c * const /*pincode*/,
   730 	eap_variable_data_c * const /*pincode*/,
   659 	bool is_first_query)
   731 	bool is_first_query)
   660 {
   732 {
   661 	EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query));
   733 	EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query));
   662 	
   734 	
   663 		m_state = EHandlingPincodeQuery;
   735 	eap_status_e status = eap_status_pending_request;
   664 	//     m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo;
   736 	
   665     TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
   737 	TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType());
   666     
   738 	
   667 		m_state = EHandlingPincodeQuery;
   739 	m_state = EHandlingPincodeQuery;
   668 
   740 
   669 		if (is_first_query == true)
   741 	TInt err1 = KErrNone;
   670 		{
   742 	
   671 			m_dialog_data_ptr->iIsFirstQuery = ETrue;
   743 	TRAPD(err, err1 = IsDlgReadyToCompleteL());
   672 		}
   744 	
       
   745 	EAP_TRACE_DEBUG(
       
   746 		m_am_tools, 
       
   747 		TRACE_FLAGS_DEFAULT,
       
   748 		(EAPL("eap_am_type_securid_symbian_c::show_pincode_query_dialog(): err=%d, result= %d is_first_query=%d\n"),
       
   749 		err,
       
   750 		err1,
       
   751 		is_first_query));
       
   752 
       
   753 	if ((err1 == KErrCancel) || err)
       
   754 		{
       
   755 
       
   756 	    if (iEapAuthNotifier == 0)
       
   757 	    	{
       
   758 		    TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
       
   759 		  	if (err)
       
   760 		  		{
       
   761 	  			return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   762 	  			}
       
   763 	    	}
       
   764 
       
   765 		if (is_first_query != true)
       
   766 			{
       
   767 			TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGtcChallengeDialog, m_dialog_data_ptr, aEapType));
       
   768 			if (err1)
       
   769 		  		{
       
   770 		  		return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
       
   771 		  		}
       
   772 			}
   673 		else
   773 		else
   674 		{
   774 			{
   675 			m_dialog_data_ptr->iIsFirstQuery = EFalse;
   775 			TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType));
   676 		}
   776 			if (err2)
   677 
   777 		  		{
   678     if (iEapAuthNotifier == 0)
   778 		  		return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure);
   679     	{
   779 		  		}
   680     	TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this ));
   780 			}
   681   		if (err)
   781 
   682   			{
   782 		}
   683   				return eap_status_authentication_failure;
   783 	else
   684   			}
   784 		{
   685     	}
   785 		if(m_partner->set_timer(this,EHandlingTimerCall, 0 /*data*/, 2 /*time ms*/) != eap_status_ok)
   686     TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCSecurIDPasscodeQueryUidDialog, m_dialog_data_ptr, aEapType));
   786 			status = eap_status_process_general_error;	
   687   		if (err1)
   787 		}
   688   			{
   788 
   689   				return eap_status_authentication_failure;
   789 
   690   			}
   790 
   691 	
   791 	return EAP_STATUS_RETURN(m_am_tools, status);
   692 
   792 }
   693 
   793 
   694 	return eap_status_pending_request;
   794 //--------------------------------------------------
   695 }
   795 
   696 
   796 TInt eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL()
   697 //--------------------------------------------------
   797 	{
       
   798 
       
   799 	EAP_TRACE_DEBUG(
       
   800 		m_am_tools, 
       
   801 		TRACE_FLAGS_DEFAULT,
       
   802 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"),
       
   803 		m_index_type,
       
   804 		m_index,
       
   805 		m_tunneling_type.get_vendor_id(),
       
   806 		m_tunneling_type.get_vendor_type()));
       
   807 
       
   808 	TInt status = KErrNone;
       
   809 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
       
   810 	TPtr sqlStatement = buf->Des();
       
   811 	
       
   812 	// Query all the relevant parameters
       
   813 	_LIT(KSQLQuery, "SELECT %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
       
   814 	
       
   815 	sqlStatement.Format(
       
   816 		KSQLQuery,
       
   817 		&cf_str_EAP_GTC_passcode_prompt_literal,
       
   818 		&cf_str_EAP_GTC_identity_literal,
       
   819 		&cf_str_EAP_GTC_passcode_literal,
       
   820 		&KGtcTableName,
       
   821 		&KServiceType,
       
   822 		m_index_type, 
       
   823 		&KServiceIndex,
       
   824 		m_index,
       
   825 		&KTunnelingTypeVendorId,
       
   826 		m_tunneling_type.get_vendor_id(),
       
   827 		&KTunnelingType, 
       
   828 		m_tunneling_type.get_vendor_type());
       
   829 	
       
   830 
       
   831 	EAP_TRACE_DEBUG(
       
   832 		m_am_tools, 
       
   833 		TRACE_FLAGS_DEFAULT,
       
   834 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));
       
   835 
       
   836 	RDbView view;
       
   837 	// Evaluate view
       
   838 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
       
   839 	CleanupClosePushL(view);
       
   840 	
       
   841 	User::LeaveIfError(view.EvaluateAll());
       
   842 	
       
   843 	// Get the first (and only) row
       
   844 	view.FirstL();
       
   845 	view.GetL();
       
   846 	
       
   847 	// Get column set so we get the correct column numbers
       
   848 	CDbColSet* colSet = view.ColSetL();
       
   849 	CleanupStack::PushL(colSet);
       
   850 
       
   851 	EAP_TRACE_DEBUG(
       
   852 		m_am_tools, 
       
   853 		TRACE_FLAGS_DEFAULT,
       
   854 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));
       
   855 
       
   856 	TPtrC username = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_identity_literal ) );
       
   857 
       
   858 	EAP_TRACE_DATA_DEBUG(
       
   859 		m_am_tools,
       
   860 		TRACE_FLAGS_DEFAULT,
       
   861 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): username"),
       
   862 		username.Ptr(),
       
   863 		username.Size()));
       
   864 
       
   865 	TPtrC password = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_passcode_literal ) );
       
   866 
       
   867 	EAP_TRACE_DATA_DEBUG(
       
   868 		m_am_tools,
       
   869 		TRACE_FLAGS_DEFAULT,
       
   870 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): password"),
       
   871 		password.Ptr(),
       
   872 		password.Size()));
       
   873 
       
   874 	TUint prompt = view.ColUint(colSet->ColNo(cf_str_EAP_GTC_passcode_prompt_literal));
       
   875 
       
   876 	EAP_TRACE_DEBUG(
       
   877 		m_am_tools, 
       
   878 		TRACE_FLAGS_DEFAULT,
       
   879 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): prompt=%d\n"),
       
   880 		prompt));
       
   881 
       
   882 
       
   883 	if ((EEapDbFalse != prompt)
       
   884 		 || (username.Size() == 0) 
       
   885 		 || (password.Size() == 0))
       
   886 		{
       
   887 
       
   888 		if (username.Size() == 0)
       
   889 			{
       
   890 			m_dialog_data_ptr->iUsername.Zero();
       
   891 			}
       
   892 		else
       
   893 			{
       
   894 			m_dialog_data_ptr->iUsername.Copy(username);
       
   895 			}
       
   896 
       
   897 		status = KErrCancel;
       
   898 		}
       
   899 	else
       
   900 		{
       
   901 		status = KErrNone;	
       
   902 		m_dialog_data_ptr->iUsername.Copy(username);
       
   903 		m_dialog_data_ptr->iPassword.Copy(password);
       
   904 		}
       
   905 		
       
   906 	CleanupStack::PopAndDestroy(colSet); // Delete colSet.
       
   907 	CleanupStack::PopAndDestroy(&view); // Close view.
       
   908 	CleanupStack::PopAndDestroy(buf); // Delete buf.
       
   909 		
       
   910 	EAP_TRACE_DEBUG(
       
   911 		m_am_tools, 
       
   912 		TRACE_FLAGS_DEFAULT,
       
   913 		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): status=%d\n"),
       
   914 		status));
       
   915 
       
   916 	return status;
       
   917 	}
       
   918 	
       
   919 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::timer_expired(
       
   920 		const u32_t id , void * data)
       
   921 	{
       
   922 	EAP_UNREFERENCED_PARAMETER(id); // in release
       
   923 	EAP_UNREFERENCED_PARAMETER(data); // in release
       
   924 	
       
   925 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("TIMER: [0x%08x]->eap_am_type_securid_symbian_c::timer_expired(id 0x%02x, data 0x%08x).\n"),
       
   926 		this, id, data));
       
   927 	
       
   928 	DlgComplete(KErrNone);
       
   929 	return eap_status_ok;	
       
   930 	}
       
   931 
       
   932 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::timer_delete_data(
       
   933 		const u32_t id, void *data)
       
   934 	{
       
   935 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   936 	EAP_UNREFERENCED_PARAMETER(id); // in release
       
   937 	EAP_UNREFERENCED_PARAMETER(data); // in release
       
   938 
       
   939 	eap_status_e status = eap_status_ok;
       
   940 
       
   941 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("TIMER: [0x%08x]->eap_am_type_securid_symbian_c::timer_delete_data(id 0x%02x, data 0x%08x).\n"),
       
   942 		this, id, data));
       
   943 
       
   944 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   945 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   946 			
       
   947 	}
       
   948 
       
   949 //--------------------------------------------------
       
   950 
   698 EAP_FUNC_EXPORT void eap_am_type_securid_symbian_c::DlgComplete( TInt aStatus )  
   951 EAP_FUNC_EXPORT void eap_am_type_securid_symbian_c::DlgComplete( TInt aStatus )  
   699 {
   952 {
   700 		if (aStatus == KErrCancel)
   953 	EAP_TRACE_DEBUG(
       
   954 		m_am_tools, 
       
   955 		TRACE_FLAGS_DEFAULT,
       
   956 		(EAPL("eap_am_type_securid_symbian_c::DlgComplete(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"),
       
   957 		m_index_type,
       
   958 		m_index,
       
   959 		m_tunneling_type.get_vendor_id(),
       
   960 		m_tunneling_type.get_vendor_type()));
       
   961 
       
   962 	if (aStatus == KErrCancel)
   701 	{
   963 	{
   702 		delete m_message_buf;
   964 		delete m_message_buf;
   703 		m_message_buf = NULL;
   965 		m_message_buf = NULL;
   704 		get_am_partner()->finish_unsuccessful_authentication(true);
   966 		get_am_partner()->finish_unsuccessful_authentication(true);
   705 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   967 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   727 
   989 
   728 	switch (m_state)
   990 	switch (m_state)
   729 	{
   991 	{
   730 	case EHandlingIdentityQuery:
   992 	case EHandlingIdentityQuery:
   731 		{
   993 		{
   732 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingIdentityQuery\n")));
   994 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingIdentityQuery\n")));
   733 
   995 
   734 			eap_variable_data_c identity(m_am_tools);
   996 			eap_variable_data_c identity(m_am_tools);
   735 
   997 
   736 			eap_status_e status = identity.set_copy_of_buffer(
   998 			eap_status_e status = identity.set_copy_of_buffer(
   737 				m_dialog_data_ptr->iUsername.Ptr(),
   999 				m_dialog_data_ptr->iUsername.Ptr(),
   756 		}
  1018 		}
   757 		break;
  1019 		break;
   758 
  1020 
   759 	case EHandlingPasscodeQuery:
  1021 	case EHandlingPasscodeQuery:
   760 		{
  1022 		{
   761 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPasscodeQuery\n")));
  1023 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingPasscodeQuery\n")));
   762 
  1024 
   763 			eap_variable_data_c passcode(m_am_tools);
  1025 			eap_variable_data_c passcode(m_am_tools);
   764 
  1026 
   765 			eap_status_e status = passcode.set_copy_of_buffer(
  1027 			eap_status_e status = passcode.set_copy_of_buffer(
   766 				m_dialog_data_ptr->iPassword.Ptr(),
  1028 				m_dialog_data_ptr->iPassword.Ptr(),
   785 		}
  1047 		}
   786 		break;
  1048 		break;
   787 
  1049 
   788 	case EHandlingPincodeQuery:
  1050 	case EHandlingPincodeQuery:
   789 		{
  1051 		{
   790 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPincodeQuery\n")));
  1052 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingPincodeQuery\n")));
   791 
  1053 
   792 			eap_variable_data_c pincode(m_am_tools);
  1054 			eap_variable_data_c pincode(m_am_tools);
   793 
  1055 
   794 			eap_status_e status = pincode.set_copy_of_buffer(
  1056 			eap_status_e status = pincode.set_copy_of_buffer(
   795 				m_dialog_data_ptr->iUsername.Ptr(),
  1057 				m_dialog_data_ptr->iUsername.Ptr(),
   836 		}
  1098 		}
   837 		break;
  1099 		break;
   838 
  1100 
   839 	case EHandlingGTCQuery:
  1101 	case EHandlingGTCQuery:
   840 		{
  1102 		{
   841 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingGTCQuery\n")));
  1103 			EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingGTCQuery\n")));
   842 
  1104 
   843 			delete m_message_buf;
  1105 			delete m_message_buf;
   844 			m_message_buf = NULL;
  1106 			m_message_buf = NULL;
   845 
  1107 
   846 			eap_variable_data_c passcode(m_am_tools);
  1108 			eap_variable_data_c passcode(m_am_tools);
   884 
  1146 
   885 	default:
  1147 	default:
   886 		EAP_TRACE_ERROR(
  1148 		EAP_TRACE_ERROR(
   887 			m_am_tools,
  1149 			m_am_tools,
   888 			TRACE_FLAGS_DEFAULT,
  1150 			TRACE_FLAGS_DEFAULT,
   889 			(EAPL("ERROR: EAP - SecurID illegal state in RunL.\n")));
  1151 			(EAPL("ERROR: EAP - SecurID illegal state in DlgComplete().\n")));
   890 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
  1152 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   891 		return;		
  1153 		return;		
   892 	}
  1154 	}
   893 }
  1155 }
   894 
  1156 
  1060 	}
  1322 	}
  1061 	
  1323 	
  1062 
  1324 
  1063 	RDbView view;
  1325 	RDbView view;
  1064 	// Evaluate view
  1326 	// Evaluate view
  1065 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  1327 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1066 	CleanupClosePushL(view);
  1328 	CleanupClosePushL(view);
  1067 	
  1329 	
  1068 	User::LeaveIfError(view.EvaluateAll());
  1330 	User::LeaveIfError(view.EvaluateAll());
  1069 	
  1331 	
  1070 	// Get the first (and only) row
  1332 	// Get the first (and only) row
  1223 		// Leave with error.
  1485 		// Leave with error.
  1224 
  1486 
  1225 		CleanupStack::PopAndDestroy(buf); // Delete buf.
  1487 		CleanupStack::PopAndDestroy(buf); // Delete buf.
  1226 		User::Leave(KErrNotSupported);		
  1488 		User::Leave(KErrNotSupported);		
  1227 	}
  1489 	}
  1228 		
  1490 
  1229 	RDbView view;
  1491 	RDbView view;
  1230 	// Evaluate view
  1492 	// Evaluate view
  1231 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1493 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1232 	CleanupClosePushL(view);
  1494 	CleanupClosePushL(view);
  1233 	
  1495