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); |