279 TRACE_FLAGS_DEFAULT, |
320 TRACE_FLAGS_DEFAULT, |
280 (EAPL("eap_am_type_securid_symbian_c::RunL - start") |
321 (EAPL("eap_am_type_securid_symbian_c::RunL - start") |
281 EAPL("m_state, iStatus.Int()=%d\n"), |
322 EAPL("m_state, iStatus.Int()=%d\n"), |
282 m_state, iStatus.Int())); |
323 m_state, iStatus.Int())); |
283 |
324 |
|
325 if (iStatus.Int() == KErrCancel) |
|
326 { |
|
327 delete m_message_buf; |
|
328 m_message_buf = NULL; |
|
329 get_am_partner()->finish_unsuccessful_authentication(true); |
|
330 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
331 return; |
|
332 } |
|
333 |
|
334 if (iStatus.Int() != KErrNone) |
|
335 { |
|
336 delete m_message_buf; |
|
337 m_message_buf = NULL; |
|
338 // Something is very wrong... |
|
339 |
|
340 EAP_TRACE_ERROR( |
|
341 m_am_tools, |
|
342 TRACE_FLAGS_DEFAULT, |
|
343 (EAPL("ERROR: EAP - SecurID notifier or dialog\n"))); |
|
344 |
|
345 send_error_notification(eap_status_authentication_failure); |
|
346 |
|
347 get_am_partner()->finish_unsuccessful_authentication(false); |
|
348 |
|
349 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
350 return; |
|
351 } |
|
352 |
|
353 switch (m_state) |
|
354 { |
|
355 case EHandlingIdentityQuery: |
|
356 { |
|
357 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingIdentityQuery\n"))); |
|
358 |
|
359 eap_variable_data_c identity(m_am_tools); |
|
360 |
|
361 eap_status_e status = identity.set_copy_of_buffer( |
|
362 m_dialog_data_ptr->iIdentity.Ptr(), |
|
363 m_dialog_data_ptr->iIdentity.Size()); |
|
364 if (status != eap_status_ok) |
|
365 { |
|
366 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
367 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
368 return; |
|
369 } |
|
370 |
|
371 eap_variable_data_c identity_utf8(m_am_tools); |
|
372 status = m_am_tools->convert_unicode_to_utf8(identity_utf8, identity); |
|
373 if (status != eap_status_ok) |
|
374 { |
|
375 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
376 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
377 return; |
|
378 } |
|
379 |
|
380 status = get_am_partner()->complete_eap_identity_query(&identity_utf8); |
|
381 } |
|
382 break; |
|
383 |
|
384 case EHandlingPasscodeQuery: |
|
385 { |
|
386 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPasscodeQuery\n"))); |
|
387 |
|
388 eap_variable_data_c passcode(m_am_tools); |
|
389 |
|
390 eap_status_e status = passcode.set_copy_of_buffer( |
|
391 m_dialog_data_ptr->iPasscode.Ptr(), |
|
392 m_dialog_data_ptr->iPasscode.Size()); |
|
393 if (status != eap_status_ok) |
|
394 { |
|
395 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
396 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
397 return; |
|
398 } |
|
399 |
|
400 eap_variable_data_c passcode_utf8(m_am_tools); |
|
401 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
402 if (status != eap_status_ok) |
|
403 { |
|
404 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
405 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
406 return; |
|
407 } |
|
408 |
|
409 status = get_am_partner()->client_securid_complete_passcode_query(&passcode_utf8); |
|
410 } |
|
411 break; |
|
412 |
|
413 case EHandlingPincodeQuery: |
|
414 { |
|
415 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPincodeQuery\n"))); |
|
416 |
|
417 eap_variable_data_c pincode(m_am_tools); |
|
418 |
|
419 eap_status_e status = pincode.set_copy_of_buffer( |
|
420 m_dialog_data_ptr->iPincode.Ptr(), |
|
421 m_dialog_data_ptr->iPincode.Size()); |
|
422 if (status != eap_status_ok) |
|
423 { |
|
424 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
425 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
426 return; |
|
427 } |
|
428 |
|
429 eap_variable_data_c passcode(m_am_tools); |
|
430 |
|
431 status = passcode.set_copy_of_buffer( |
|
432 m_dialog_data_ptr->iPasscode.Ptr(), |
|
433 m_dialog_data_ptr->iPasscode.Size()); |
|
434 if (status != eap_status_ok) |
|
435 { |
|
436 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
437 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
438 return; |
|
439 } |
|
440 |
|
441 |
|
442 eap_variable_data_c pincode_utf8(m_am_tools); |
|
443 status = m_am_tools->convert_unicode_to_utf8(pincode_utf8, pincode); |
|
444 if (status != eap_status_ok) |
|
445 { |
|
446 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
447 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
448 return; |
|
449 } |
|
450 |
|
451 eap_variable_data_c passcode_utf8(m_am_tools); |
|
452 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
453 if (status != eap_status_ok) |
|
454 { |
|
455 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
456 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
457 return; |
|
458 } |
|
459 |
|
460 status = get_am_partner()->client_securid_complete_pincode_query(&passcode_utf8, &passcode_utf8); |
|
461 } |
|
462 break; |
|
463 |
|
464 case EHandlingGTCQuery: |
|
465 { |
|
466 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingGTCQuery\n"))); |
|
467 |
|
468 delete m_message_buf; |
|
469 m_message_buf = NULL; |
|
470 |
|
471 eap_variable_data_c passcode(m_am_tools); |
|
472 |
|
473 eap_status_e status = passcode.set_copy_of_buffer( |
|
474 m_dialog_data_ptr->iPasscode.Ptr(), |
|
475 m_dialog_data_ptr->iPasscode.Size()); |
|
476 if (status != eap_status_ok) |
|
477 { |
|
478 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
479 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
480 return; |
|
481 } |
|
482 |
|
483 eap_variable_data_c passcode_utf8(m_am_tools); |
|
484 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
485 if (status != eap_status_ok) |
|
486 { |
|
487 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
488 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
489 return; |
|
490 } |
|
491 |
|
492 // User must have entered some password and pressed OK. |
|
493 // Treat this as a full authentication and update the Last Auth Time. |
|
494 status = store_authentication_time(); |
|
495 if (status != eap_status_ok) |
|
496 { |
|
497 // Storing failed. Don't care. |
|
498 EAP_TRACE_ERROR(m_am_tools, |
|
499 TRACE_FLAGS_DEFAULT, ( |
|
500 EAPL("eap_am_type_securid_symbian_c:Storing Last Full Authentication time failed, status=%d, but continuing\n"), |
|
501 status)); |
|
502 |
|
503 status = eap_status_ok; |
|
504 } |
|
505 |
|
506 status = get_am_partner()->client_gtc_complete_user_input_query(&passcode_utf8); |
|
507 } |
|
508 break; |
|
509 |
|
510 default: |
|
511 EAP_TRACE_ERROR( |
|
512 m_am_tools, |
|
513 TRACE_FLAGS_DEFAULT, |
|
514 (EAPL("ERROR: EAP - SecurID illegal state in RunL.\n"))); |
|
515 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
516 return; |
|
517 } |
284 |
518 |
285 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
519 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
286 } |
520 } |
287 |
521 |
288 //-------------------------------------------------- |
522 //-------------------------------------------------- |
289 |
523 |
290 void eap_am_type_securid_symbian_c::DoCancel() |
524 void eap_am_type_securid_symbian_c::DoCancel() |
291 { |
525 { |
292 iEapAuthNotifier->Cancel(); |
526 if( m_is_notifier_connected ) |
293 |
527 { |
|
528 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - calling m_notifier.CancelNotifier(..)\n"))); |
|
529 |
|
530 TInt error = m_notifier.CancelNotifier(KEapSecurIDIdentityQueryUid); |
|
531 |
|
532 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - CancelNotifier(KEapSecurIDIdentityQueryUid) error=%d\n"), error)); |
|
533 |
|
534 error = m_notifier.CancelNotifier(KEapSecurIDPasscodeQueryUid); |
|
535 |
|
536 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - CancelNotifier(KEapSecurIDPasscodeQueryUid) error=%d\n"), error)); |
|
537 |
|
538 error = m_notifier.CancelNotifier(KEapSecurIDPincodeQueryUid); |
|
539 |
|
540 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - CancelNotifier(KEapSecurIDPincodeQueryUid) error=%d\n"), error)); |
|
541 |
|
542 error = m_notifier.CancelNotifier(KEapGtcIdentityQueryUid); |
|
543 |
|
544 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - CancelNotifier(KEapGtcIdentityQueryUid) error=%d\n"), error)); |
|
545 |
|
546 error = m_notifier.CancelNotifier(KEapGtcUserInputQueryUid); |
|
547 |
|
548 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::DoCancel - CancelNotifier(KEapGtcUserInputQueryUid) error=%d\n"), error)); |
|
549 |
|
550 m_notifier.Close(); // Call close only if it is connected. |
|
551 |
|
552 m_is_notifier_connected = false; |
|
553 } |
294 } |
554 } |
295 |
555 |
296 //-------------------------------------------------- |
556 //-------------------------------------------------- |
297 |
557 |
298 |
558 |
561 |
789 |
562 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog( |
790 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog( |
563 eap_variable_data_c * const /*passcode*/, |
791 eap_variable_data_c * const /*passcode*/, |
564 bool is_first_query) |
792 bool is_first_query) |
565 { |
793 { |
566 EAP_TRACE_DEBUG( |
794 if (!IsActive()) |
567 m_am_tools, |
795 { |
568 TRACE_FLAGS_DEFAULT, |
796 m_state = EHandlingPasscodeQuery; |
569 (EAPL("eap_am_type_securid_symbian_c::show_passcode_query_dialog(): is_first_query=%d\n"), |
797 |
570 is_first_query)); |
798 if (is_first_query == true) |
571 |
799 { |
572 eap_status_e status = eap_status_pending_request; |
800 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
573 |
801 } |
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 } |
|
607 else |
802 else |
608 { |
803 { |
609 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType)); |
804 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
610 if (err2) |
805 } |
611 { |
806 |
612 return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure); |
807 if( !m_is_notifier_connected ) |
613 } |
808 { |
614 } |
809 TInt error = m_notifier.Connect(); |
615 |
810 |
616 } |
811 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_passcode_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
|
812 |
|
813 if( error != KErrNone) |
|
814 { |
|
815 // Can not connect to notifier. |
|
816 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
817 } |
|
818 |
|
819 m_is_notifier_connected = true; // Got connectted to notifier. |
|
820 } |
|
821 |
|
822 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_passcode_query_dialog - StartNotifierAndGetResponse - KEapSecurIDPasscodeQueryUid \n"))); |
|
823 |
|
824 m_notifier.StartNotifierAndGetResponse( |
|
825 iStatus, |
|
826 KEapSecurIDPasscodeQueryUid, |
|
827 *m_dialog_data_pckg_ptr, |
|
828 *m_dialog_data_pckg_ptr); |
|
829 |
|
830 SetActive(); |
|
831 } |
617 else |
832 else |
618 { |
833 { |
619 EAP_TRACE_DEBUG( |
834 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c: Already active when tried to show passcode query dialog.\n"))); |
620 m_am_tools, |
835 return eap_status_process_general_error; |
621 TRACE_FLAGS_DEFAULT, |
836 } |
622 (EAPL("eap_am_type_securid_symbian_c::show_passcode_query_dialog(): EHandlingTimerCall\n"))); |
837 |
623 |
838 return eap_status_pending_request; |
624 if(m_partner->set_timer(this,EHandlingTimerCall,0 /*data*/,2 /*time ms*/) != eap_status_ok) |
|
625 status = eap_status_process_general_error; |
|
626 } |
|
627 |
|
628 |
|
629 return EAP_STATUS_RETURN(m_am_tools, status); |
|
630 } |
839 } |
631 |
840 |
632 //-------------------------------------------------- |
841 //-------------------------------------------------- |
633 |
842 |
634 eap_status_e eap_am_type_securid_symbian_c::show_gtc_query_dialog( |
843 eap_status_e eap_am_type_securid_symbian_c::show_gtc_query_dialog( |
642 TRACE_FLAGS_DEFAULT, |
851 TRACE_FLAGS_DEFAULT, |
643 (EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog: message"), |
852 (EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog: message"), |
644 message, |
853 message, |
645 message_length)); |
854 message_length)); |
646 |
855 |
647 eap_status_e status = eap_status_pending_request; |
856 if (!IsActive()) |
648 |
857 { |
649 m_state = EHandlingGTCQuery; |
858 m_state = EHandlingGTCQuery; |
650 |
859 |
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 { |
|
665 eap_variable_data_c message_utf8(m_am_tools); |
860 eap_variable_data_c message_utf8(m_am_tools); |
666 eap_status_e status = message_utf8.set_buffer(message, message_length, false, false); |
861 eap_status_e status = message_utf8.set_buffer(message, message_length, false, false); |
667 if (status != eap_status_ok) |
862 if (status != eap_status_ok) |
668 { |
863 { |
669 return EAP_STATUS_RETURN(m_am_tools, status); |
864 return EAP_STATUS_RETURN(m_am_tools, status); |
670 } |
865 } |
671 |
866 |
672 eap_variable_data_c message_unicode(m_am_tools); |
867 eap_variable_data_c message_unicode(m_am_tools); |
673 status = m_am_tools->convert_utf8_to_unicode(message_unicode, message_utf8); |
868 status = m_am_tools->convert_utf8_to_unicode(message_unicode, message_utf8); |
674 if (status != eap_status_ok) |
869 if (status != eap_status_ok) |
675 { |
870 { |
676 return EAP_STATUS_RETURN(m_am_tools, status); |
871 return EAP_STATUS_RETURN(m_am_tools, status); |
677 } |
872 } |
678 |
873 |
679 m_dialog_data_ptr->iUidata.Copy((TText *)message_unicode.get_data(), message_unicode.get_data_length()); |
874 TRAPD(err, m_message_buf = HBufC8::NewL(message_unicode.get_data_length())); |
680 |
875 if (err != KErrNone) |
681 m_dialog_data_ptr->iPassword.Zero(); |
876 { |
682 |
877 return eap_status_allocation_error; |
683 TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType()); |
878 } |
684 |
879 TPtr8 messageBufPtr = m_message_buf->Des(); |
685 if (iEapAuthNotifier == 0) |
880 messageBufPtr.Copy(message_unicode.get_data(), message_unicode.get_data_length()); |
686 { |
881 |
687 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
882 if (is_first_query == true) |
688 if (err) |
883 { |
689 { |
884 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
690 return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure); |
885 } |
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 |
886 else |
703 { |
887 { |
704 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCUsernamePasswordDialog, m_dialog_data_ptr, aEapType)); |
888 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
705 if (err2) |
889 } |
706 { |
890 |
707 return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure); |
891 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_gtc_query_dialog - before m_notifier.Connect(), m_is_notifier_connected=%d\n"), m_is_notifier_connected)); |
708 } |
892 |
709 } |
893 if( !m_is_notifier_connected ) |
710 |
894 { |
711 } |
895 TInt error = m_notifier.Connect(); |
|
896 |
|
897 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_gtc_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
|
898 |
|
899 if( error != KErrNone) |
|
900 { |
|
901 // Can not connect to notifier. |
|
902 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
903 } |
|
904 |
|
905 m_is_notifier_connected = true; // Got connectted to notifier. |
|
906 } |
|
907 |
|
908 EAP_TRACE_DATA_DEBUG( |
|
909 m_am_tools, |
|
910 TRACE_FLAGS_DEFAULT, |
|
911 (EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog: m_message_buf"), |
|
912 m_message_buf->Ptr(), |
|
913 m_message_buf->Size())); |
|
914 |
|
915 m_notifier.StartNotifierAndGetResponse( |
|
916 iStatus, |
|
917 KEapGtcUserInputQueryUid, |
|
918 *m_message_buf, |
|
919 *m_dialog_data_pckg_ptr); |
|
920 |
|
921 SetActive(); |
|
922 } |
712 else |
923 else |
713 { |
924 { |
714 EAP_TRACE_DEBUG( |
925 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c: Already active when tried to show GTC query dialog.\n"))); |
715 m_am_tools, |
926 return eap_status_process_general_error; |
716 TRACE_FLAGS_DEFAULT, |
927 } |
717 (EAPL("eap_am_type_securid_symbian_c::show_gtc_query_dialog(): EHandlingTimerCall\n"))); |
928 |
718 |
929 return eap_status_pending_request; |
719 if(m_partner->set_timer(this,EHandlingTimerCall, 0 /*data*/, 2 /*time ms*/) != eap_status_ok) |
|
720 status = eap_status_process_general_error; |
|
721 } |
|
722 |
|
723 return EAP_STATUS_RETURN(m_am_tools, status); |
|
724 } |
930 } |
725 |
931 |
726 //-------------------------------------------------- |
932 //-------------------------------------------------- |
727 |
933 |
728 eap_status_e eap_am_type_securid_symbian_c::show_pincode_query_dialog( |
934 eap_status_e eap_am_type_securid_symbian_c::show_pincode_query_dialog( |
730 eap_variable_data_c * const /*pincode*/, |
936 eap_variable_data_c * const /*pincode*/, |
731 bool is_first_query) |
937 bool is_first_query) |
732 { |
938 { |
733 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query)); |
939 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query)); |
734 |
940 |
735 eap_status_e status = eap_status_pending_request; |
941 if (!IsActive()) |
736 |
942 { |
737 TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType()); |
943 m_state = EHandlingPincodeQuery; |
738 |
944 |
739 m_state = EHandlingPincodeQuery; |
945 if (is_first_query == true) |
740 |
946 { |
741 TInt err1 = KErrNone; |
947 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
742 |
948 } |
743 TRAPD(err, err1 = IsDlgReadyToCompleteL()); |
|
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 } |
|
773 else |
949 else |
774 { |
950 { |
775 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType)); |
951 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
776 if (err2) |
952 } |
777 { |
953 |
778 return EAP_STATUS_RETURN(m_am_tools, eap_status_authentication_failure); |
954 if( !m_is_notifier_connected ) |
779 } |
955 { |
780 } |
956 TInt error = m_notifier.Connect(); |
781 |
957 |
782 } |
958 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_pincode_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
|
959 |
|
960 if( error != KErrNone) |
|
961 { |
|
962 // Can not connect to notifier. |
|
963 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
964 } |
|
965 |
|
966 m_is_notifier_connected = true; // Got connectted to notifier. |
|
967 } |
|
968 |
|
969 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_pincode_query_dialog - StartNotifierAndGetResponse - KEapSecurIDPincodeQueryUid \n"))); |
|
970 |
|
971 m_notifier.StartNotifierAndGetResponse( |
|
972 iStatus, |
|
973 KEapSecurIDPincodeQueryUid, |
|
974 *m_dialog_data_pckg_ptr, |
|
975 *m_dialog_data_pckg_ptr); |
|
976 |
|
977 SetActive(); |
|
978 } |
783 else |
979 else |
784 { |
980 { |
785 if(m_partner->set_timer(this,EHandlingTimerCall, 0 /*data*/, 2 /*time ms*/) != eap_status_ok) |
981 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c: Already active when tried to show identity query dialog.\n"))); |
786 status = eap_status_process_general_error; |
982 return eap_status_process_general_error; |
787 } |
983 } |
788 |
984 |
789 |
985 return eap_status_pending_request; |
790 |
|
791 return EAP_STATUS_RETURN(m_am_tools, status); |
|
792 } |
|
793 |
|
794 //-------------------------------------------------- |
|
795 |
|
796 TInt eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL() |
|
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 |
|
951 EAP_FUNC_EXPORT void eap_am_type_securid_symbian_c::DlgComplete( TInt aStatus ) |
|
952 { |
|
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) |
|
963 { |
|
964 delete m_message_buf; |
|
965 m_message_buf = NULL; |
|
966 get_am_partner()->finish_unsuccessful_authentication(true); |
|
967 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
968 return; |
|
969 } |
|
970 |
|
971 if (aStatus != KErrNone) |
|
972 { |
|
973 delete m_message_buf; |
|
974 m_message_buf = NULL; |
|
975 // Something is very wrong... |
|
976 |
|
977 EAP_TRACE_ERROR( |
|
978 m_am_tools, |
|
979 TRACE_FLAGS_DEFAULT, |
|
980 (EAPL("ERROR: EAP - SecurID notifier or dialog\n"))); |
|
981 |
|
982 send_error_notification(eap_status_authentication_failure); |
|
983 |
|
984 get_am_partner()->finish_unsuccessful_authentication(false); |
|
985 |
|
986 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
987 return; |
|
988 } |
|
989 |
|
990 switch (m_state) |
|
991 { |
|
992 case EHandlingIdentityQuery: |
|
993 { |
|
994 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingIdentityQuery\n"))); |
|
995 |
|
996 eap_variable_data_c identity(m_am_tools); |
|
997 |
|
998 eap_status_e status = identity.set_copy_of_buffer( |
|
999 m_dialog_data_ptr->iUsername.Ptr(), |
|
1000 m_dialog_data_ptr->iUsername.Size()); |
|
1001 if (status != eap_status_ok) |
|
1002 { |
|
1003 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1004 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1005 return; |
|
1006 } |
|
1007 |
|
1008 eap_variable_data_c identity_utf8(m_am_tools); |
|
1009 status = m_am_tools->convert_unicode_to_utf8(identity_utf8, identity); |
|
1010 if (status != eap_status_ok) |
|
1011 { |
|
1012 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1013 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1014 return; |
|
1015 } |
|
1016 |
|
1017 status = get_am_partner()->complete_eap_identity_query(&identity_utf8); |
|
1018 } |
|
1019 break; |
|
1020 |
|
1021 case EHandlingPasscodeQuery: |
|
1022 { |
|
1023 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingPasscodeQuery\n"))); |
|
1024 |
|
1025 eap_variable_data_c passcode(m_am_tools); |
|
1026 |
|
1027 eap_status_e status = passcode.set_copy_of_buffer( |
|
1028 m_dialog_data_ptr->iPassword.Ptr(), |
|
1029 m_dialog_data_ptr->iPassword.Size()); |
|
1030 if (status != eap_status_ok) |
|
1031 { |
|
1032 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1033 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1034 return; |
|
1035 } |
|
1036 |
|
1037 eap_variable_data_c passcode_utf8(m_am_tools); |
|
1038 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
1039 if (status != eap_status_ok) |
|
1040 { |
|
1041 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1042 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1043 return; |
|
1044 } |
|
1045 |
|
1046 status = get_am_partner()->client_securid_complete_passcode_query(&passcode_utf8); |
|
1047 } |
|
1048 break; |
|
1049 |
|
1050 case EHandlingPincodeQuery: |
|
1051 { |
|
1052 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingPincodeQuery\n"))); |
|
1053 |
|
1054 eap_variable_data_c pincode(m_am_tools); |
|
1055 |
|
1056 eap_status_e status = pincode.set_copy_of_buffer( |
|
1057 m_dialog_data_ptr->iUsername.Ptr(), |
|
1058 m_dialog_data_ptr->iUsername.Size()); |
|
1059 if (status != eap_status_ok) |
|
1060 { |
|
1061 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1062 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1063 return; |
|
1064 } |
|
1065 |
|
1066 eap_variable_data_c passcode(m_am_tools); |
|
1067 |
|
1068 status = passcode.set_copy_of_buffer( |
|
1069 m_dialog_data_ptr->iPassword.Ptr(), |
|
1070 m_dialog_data_ptr->iPassword.Size()); |
|
1071 if (status != eap_status_ok) |
|
1072 { |
|
1073 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1074 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1075 return; |
|
1076 } |
|
1077 |
|
1078 |
|
1079 eap_variable_data_c pincode_utf8(m_am_tools); |
|
1080 status = m_am_tools->convert_unicode_to_utf8(pincode_utf8, pincode); |
|
1081 if (status != eap_status_ok) |
|
1082 { |
|
1083 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1084 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1085 return; |
|
1086 } |
|
1087 |
|
1088 eap_variable_data_c passcode_utf8(m_am_tools); |
|
1089 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
1090 if (status != eap_status_ok) |
|
1091 { |
|
1092 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1093 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1094 return; |
|
1095 } |
|
1096 |
|
1097 status = get_am_partner()->client_securid_complete_pincode_query(&passcode_utf8, &passcode_utf8); |
|
1098 } |
|
1099 break; |
|
1100 |
|
1101 case EHandlingGTCQuery: |
|
1102 { |
|
1103 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::DlgComplete(): EHandlingGTCQuery\n"))); |
|
1104 |
|
1105 delete m_message_buf; |
|
1106 m_message_buf = NULL; |
|
1107 |
|
1108 eap_variable_data_c passcode(m_am_tools); |
|
1109 |
|
1110 eap_status_e status = passcode.set_copy_of_buffer( |
|
1111 m_dialog_data_ptr->iPassword.Ptr(), |
|
1112 m_dialog_data_ptr->iPassword.Size()); |
|
1113 if (status != eap_status_ok) |
|
1114 { |
|
1115 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1116 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1117 return; |
|
1118 } |
|
1119 |
|
1120 eap_variable_data_c passcode_utf8(m_am_tools); |
|
1121 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
1122 if (status != eap_status_ok) |
|
1123 { |
|
1124 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1125 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
1126 return; |
|
1127 } |
|
1128 |
|
1129 // User must have entered some password and pressed OK. |
|
1130 // Treat this as a full authentication and update the Last Auth Time. |
|
1131 status = store_authentication_time(); |
|
1132 if (status != eap_status_ok) |
|
1133 { |
|
1134 // Storing failed. Don't care. |
|
1135 EAP_TRACE_ERROR(m_am_tools, |
|
1136 TRACE_FLAGS_DEFAULT, ( |
|
1137 EAPL("eap_am_type_securid_symbian_c:Storing Last Full Authentication time failed, status=%d, but continuing\n"), |
|
1138 status)); |
|
1139 |
|
1140 status = eap_status_ok; |
|
1141 } |
|
1142 |
|
1143 status = get_am_partner()->client_gtc_complete_user_input_query(&passcode_utf8); |
|
1144 } |
|
1145 break; |
|
1146 |
|
1147 default: |
|
1148 EAP_TRACE_ERROR( |
|
1149 m_am_tools, |
|
1150 TRACE_FLAGS_DEFAULT, |
|
1151 (EAPL("ERROR: EAP - SecurID illegal state in DlgComplete().\n"))); |
|
1152 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1153 return; |
|
1154 } |
|
1155 } |
986 } |
1156 |
987 |
1157 //-------------------------------------------------- |
988 //-------------------------------------------------- |
1158 |
989 |
1159 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::read_auth_failure_string( |
990 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::read_auth_failure_string( |