320 TRACE_FLAGS_DEFAULT, |
273 TRACE_FLAGS_DEFAULT, |
321 (EAPL("eap_am_type_securid_symbian_c::RunL - start") |
274 (EAPL("eap_am_type_securid_symbian_c::RunL - start") |
322 EAPL("m_state, iStatus.Int()=%d\n"), |
275 EAPL("m_state, iStatus.Int()=%d\n"), |
323 m_state, iStatus.Int())); |
276 m_state, iStatus.Int())); |
324 |
277 |
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 } |
|
518 |
278 |
519 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
279 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
520 } |
280 } |
521 |
281 |
522 //-------------------------------------------------- |
282 //-------------------------------------------------- |
523 |
283 |
524 void eap_am_type_securid_symbian_c::DoCancel() |
284 void eap_am_type_securid_symbian_c::DoCancel() |
525 { |
285 { |
526 if( m_is_notifier_connected ) |
286 iEapAuthNotifier->Cancel(); |
527 { |
287 |
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 } |
|
554 } |
288 } |
555 |
289 |
556 //-------------------------------------------------- |
290 //-------------------------------------------------- |
557 |
291 |
558 |
292 |
607 // Now do the database query |
341 // Now do the database query |
608 |
342 |
609 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
343 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
610 TPtr sqlStatement = buf->Des(); |
344 TPtr sqlStatement = buf->Des(); |
611 |
345 |
612 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
346 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
613 if (m_eap_type == eap_type_securid) |
347 if (m_eap_type == eap_type_securid) |
614 { |
348 { |
615 sqlStatement.Format(KSQLQueryRow, &unicodeString, &KSecurIDTableName, |
349 sqlStatement.Format( |
616 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
350 KSQLQueryRow, |
|
351 &unicodeString, |
|
352 &KSecurIDTableName, |
|
353 &KServiceType, |
|
354 m_index_type, |
|
355 &KServiceIndex, |
|
356 m_index, |
|
357 &KTunnelingTypeVendorId, |
|
358 m_tunneling_type.get_vendor_id(), |
|
359 &KTunnelingType, |
|
360 m_tunneling_type.get_vendor_type()); |
617 } |
361 } |
618 else |
362 else |
619 { |
363 { |
620 sqlStatement.Format(KSQLQueryRow, &unicodeString, &KGtcTableName, |
364 sqlStatement.Format( |
621 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
365 KSQLQueryRow, |
622 } |
366 &unicodeString, |
|
367 &KGtcTableName, |
|
368 &KServiceType, |
|
369 m_index_type, |
|
370 &KServiceIndex, |
|
371 m_index, |
|
372 &KTunnelingTypeVendorId, |
|
373 m_tunneling_type.get_vendor_id(), |
|
374 &KTunnelingType, |
|
375 m_tunneling_type.get_vendor_type()); |
|
376 } |
|
377 |
623 RDbView view; |
378 RDbView view; |
624 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
379 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
625 CleanupClosePushL(view); |
380 CleanupClosePushL(view); |
626 |
381 |
627 User::LeaveIfError(view.EvaluateAll()); |
382 User::LeaveIfError(view.EvaluateAll()); |
789 |
544 |
790 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog( |
545 eap_status_e eap_am_type_securid_symbian_c::show_passcode_query_dialog( |
791 eap_variable_data_c * const /*passcode*/, |
546 eap_variable_data_c * const /*passcode*/, |
792 bool is_first_query) |
547 bool is_first_query) |
793 { |
548 { |
794 if (!IsActive()) |
|
795 { |
|
796 m_state = EHandlingPasscodeQuery; |
549 m_state = EHandlingPasscodeQuery; |
797 |
550 // m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo; |
798 if (is_first_query == true) |
551 if (is_first_query == true) |
799 { |
552 { |
800 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
553 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
801 } |
554 } |
802 else |
555 else |
803 { |
556 { |
804 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
557 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
805 } |
558 } |
806 |
559 |
807 if( !m_is_notifier_connected ) |
560 TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType()); |
808 { |
561 |
809 TInt error = m_notifier.Connect(); |
562 if (iEapAuthNotifier == 0) |
810 |
563 { |
811 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_passcode_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
564 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
812 |
565 if (err) |
813 if( error != KErrNone) |
566 { |
814 { |
567 return eap_status_authentication_failure; |
815 // Can not connect to notifier. |
568 } |
816 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
569 } |
817 } |
570 TRAPD(err, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCSecurIDPasscodeQueryUidDialog, m_dialog_data_ptr, aEapType)); |
818 |
571 if (err) |
819 m_is_notifier_connected = true; // Got connectted to notifier. |
572 { |
820 } |
573 return eap_status_authentication_failure; |
821 |
574 } |
822 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_passcode_query_dialog - StartNotifierAndGetResponse - KEapSecurIDPasscodeQueryUid \n"))); |
575 |
823 |
576 |
824 m_notifier.StartNotifierAndGetResponse( |
|
825 iStatus, |
|
826 KEapSecurIDPasscodeQueryUid, |
|
827 *m_dialog_data_pckg_ptr, |
|
828 *m_dialog_data_pckg_ptr); |
|
829 |
|
830 SetActive(); |
|
831 } |
|
832 else |
|
833 { |
|
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"))); |
|
835 return eap_status_process_general_error; |
|
836 } |
|
837 |
577 |
838 return eap_status_pending_request; |
578 return eap_status_pending_request; |
839 } |
579 } |
840 |
580 |
841 //-------------------------------------------------- |
581 //-------------------------------------------------- |
869 if (status != eap_status_ok) |
607 if (status != eap_status_ok) |
870 { |
608 { |
871 return EAP_STATUS_RETURN(m_am_tools, status); |
609 return EAP_STATUS_RETURN(m_am_tools, status); |
872 } |
610 } |
873 |
611 |
874 TRAPD(err, m_message_buf = HBufC8::NewL(message_unicode.get_data_length())); |
612 /* TRAPD(err, m_message_buf = HBufC8::NewL(message_unicode.get_data_length())); |
875 if (err != KErrNone) |
613 if (err != KErrNone) |
876 { |
614 { |
877 return eap_status_allocation_error; |
615 return eap_status_allocation_error; |
878 } |
616 } |
879 TPtr8 messageBufPtr = m_message_buf->Des(); |
617 TPtr8 messageBufPtr = m_message_buf->Des(); |
880 messageBufPtr.Copy(message_unicode.get_data(), message_unicode.get_data_length()); |
618 |
|
619 */ |
|
620 |
|
621 m_dialog_data_ptr->iUidata.Copy((TText *)message_unicode.get_data(), message_unicode.get_data_length()); |
881 |
622 |
882 if (is_first_query == true) |
623 if (is_first_query == true) |
883 { |
624 { |
884 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
625 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
885 } |
626 } |
886 else |
627 else |
887 { |
628 { |
888 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
629 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
889 } |
630 } |
890 |
631 |
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)); |
632 // m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo; |
892 |
633 TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType()); |
893 if( !m_is_notifier_connected ) |
634 |
894 { |
635 if (iEapAuthNotifier == 0) |
895 TInt error = m_notifier.Connect(); |
636 { |
896 |
637 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
897 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_gtc_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
638 if (err) |
898 |
639 { |
899 if( error != KErrNone) |
640 return eap_status_authentication_failure; |
900 { |
641 } |
901 // Can not connect to notifier. |
642 } |
902 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
643 TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog, m_dialog_data_ptr, aEapType)); |
903 } |
644 if (err1) |
904 |
645 { |
905 m_is_notifier_connected = true; // Got connectted to notifier. |
646 return eap_status_authentication_failure; |
906 } |
647 } |
907 |
648 |
908 EAP_TRACE_DATA_DEBUG( |
649 |
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 } |
|
923 else |
|
924 { |
|
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"))); |
|
926 return eap_status_process_general_error; |
|
927 } |
|
928 |
650 |
929 return eap_status_pending_request; |
651 return eap_status_pending_request; |
930 } |
652 } |
931 |
653 |
932 //-------------------------------------------------- |
654 //-------------------------------------------------- |
936 eap_variable_data_c * const /*pincode*/, |
658 eap_variable_data_c * const /*pincode*/, |
937 bool is_first_query) |
659 bool is_first_query) |
938 { |
660 { |
939 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query)); |
661 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::_pincode_query_dialog - start - is_first_query=%d\n"), is_first_query)); |
940 |
662 |
941 if (!IsActive()) |
|
942 { |
|
943 m_state = EHandlingPincodeQuery; |
663 m_state = EHandlingPincodeQuery; |
|
664 // m_input_output_data_ptr = new(ELeave) TEapLeapUsernamePasswordInfo; |
|
665 TEapExpandedType aEapType(*EapExpandedTypeGtc.GetType()); |
|
666 |
|
667 m_state = EHandlingPincodeQuery; |
944 |
668 |
945 if (is_first_query == true) |
669 if (is_first_query == true) |
946 { |
670 { |
947 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
671 m_dialog_data_ptr->iIsFirstQuery = ETrue; |
948 } |
672 } |
949 else |
673 else |
950 { |
674 { |
951 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
675 m_dialog_data_ptr->iIsFirstQuery = EFalse; |
952 } |
676 } |
953 |
677 |
954 if( !m_is_notifier_connected ) |
678 if (iEapAuthNotifier == 0) |
955 { |
679 { |
956 TInt error = m_notifier.Connect(); |
680 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
681 if (err) |
|
682 { |
|
683 return eap_status_authentication_failure; |
|
684 } |
|
685 } |
|
686 TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeGTCSecurIDPasscodeQueryUidDialog, m_dialog_data_ptr, aEapType)); |
|
687 if (err1) |
|
688 { |
|
689 return eap_status_authentication_failure; |
|
690 } |
|
691 |
|
692 |
|
693 |
|
694 return eap_status_pending_request; |
|
695 } |
|
696 |
|
697 //-------------------------------------------------- |
|
698 EAP_FUNC_EXPORT void eap_am_type_securid_symbian_c::DlgComplete( TInt aStatus ) |
|
699 { |
|
700 if (aStatus == KErrCancel) |
|
701 { |
|
702 delete m_message_buf; |
|
703 m_message_buf = NULL; |
|
704 get_am_partner()->finish_unsuccessful_authentication(true); |
|
705 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
706 return; |
|
707 } |
|
708 |
|
709 if (aStatus != KErrNone) |
|
710 { |
|
711 delete m_message_buf; |
|
712 m_message_buf = NULL; |
|
713 // Something is very wrong... |
|
714 |
|
715 EAP_TRACE_ERROR( |
|
716 m_am_tools, |
|
717 TRACE_FLAGS_DEFAULT, |
|
718 (EAPL("ERROR: EAP - SecurID notifier or dialog\n"))); |
|
719 |
|
720 send_error_notification(eap_status_authentication_failure); |
|
721 |
|
722 get_am_partner()->finish_unsuccessful_authentication(false); |
|
723 |
|
724 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
725 return; |
|
726 } |
|
727 |
|
728 switch (m_state) |
|
729 { |
|
730 case EHandlingIdentityQuery: |
|
731 { |
|
732 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingIdentityQuery\n"))); |
|
733 |
|
734 eap_variable_data_c identity(m_am_tools); |
|
735 |
|
736 eap_status_e status = identity.set_copy_of_buffer( |
|
737 m_dialog_data_ptr->iUsername.Ptr(), |
|
738 m_dialog_data_ptr->iUsername.Size()); |
|
739 if (status != eap_status_ok) |
|
740 { |
|
741 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
742 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
743 return; |
|
744 } |
|
745 |
|
746 eap_variable_data_c identity_utf8(m_am_tools); |
|
747 status = m_am_tools->convert_unicode_to_utf8(identity_utf8, identity); |
|
748 if (status != eap_status_ok) |
|
749 { |
|
750 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
751 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
752 return; |
|
753 } |
|
754 |
|
755 status = get_am_partner()->complete_eap_identity_query(&identity_utf8); |
|
756 } |
|
757 break; |
|
758 |
|
759 case EHandlingPasscodeQuery: |
|
760 { |
|
761 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPasscodeQuery\n"))); |
|
762 |
|
763 eap_variable_data_c passcode(m_am_tools); |
|
764 |
|
765 eap_status_e status = passcode.set_copy_of_buffer( |
|
766 m_dialog_data_ptr->iPassword.Ptr(), |
|
767 m_dialog_data_ptr->iPassword.Size()); |
|
768 if (status != eap_status_ok) |
|
769 { |
|
770 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
771 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
772 return; |
|
773 } |
|
774 |
|
775 eap_variable_data_c passcode_utf8(m_am_tools); |
|
776 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
777 if (status != eap_status_ok) |
|
778 { |
|
779 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
780 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
781 return; |
|
782 } |
|
783 |
|
784 status = get_am_partner()->client_securid_complete_passcode_query(&passcode_utf8); |
|
785 } |
|
786 break; |
|
787 |
|
788 case EHandlingPincodeQuery: |
|
789 { |
|
790 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingPincodeQuery\n"))); |
|
791 |
|
792 eap_variable_data_c pincode(m_am_tools); |
|
793 |
|
794 eap_status_e status = pincode.set_copy_of_buffer( |
|
795 m_dialog_data_ptr->iUsername.Ptr(), |
|
796 m_dialog_data_ptr->iUsername.Size()); |
|
797 if (status != eap_status_ok) |
|
798 { |
|
799 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
800 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
801 return; |
|
802 } |
|
803 |
|
804 eap_variable_data_c passcode(m_am_tools); |
|
805 |
|
806 status = passcode.set_copy_of_buffer( |
|
807 m_dialog_data_ptr->iPassword.Ptr(), |
|
808 m_dialog_data_ptr->iPassword.Size()); |
|
809 if (status != eap_status_ok) |
|
810 { |
|
811 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
812 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
813 return; |
|
814 } |
|
815 |
|
816 |
|
817 eap_variable_data_c pincode_utf8(m_am_tools); |
|
818 status = m_am_tools->convert_unicode_to_utf8(pincode_utf8, pincode); |
|
819 if (status != eap_status_ok) |
|
820 { |
|
821 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
822 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
823 return; |
|
824 } |
|
825 |
|
826 eap_variable_data_c passcode_utf8(m_am_tools); |
|
827 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
828 if (status != eap_status_ok) |
|
829 { |
|
830 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
831 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
832 return; |
|
833 } |
|
834 |
|
835 status = get_am_partner()->client_securid_complete_pincode_query(&passcode_utf8, &passcode_utf8); |
|
836 } |
|
837 break; |
|
838 |
|
839 case EHandlingGTCQuery: |
|
840 { |
|
841 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::RunL(): EHandlingGTCQuery\n"))); |
|
842 |
|
843 delete m_message_buf; |
|
844 m_message_buf = NULL; |
|
845 |
|
846 eap_variable_data_c passcode(m_am_tools); |
|
847 |
|
848 eap_status_e status = passcode.set_copy_of_buffer( |
|
849 m_dialog_data_ptr->iPassword.Ptr(), |
|
850 m_dialog_data_ptr->iPassword.Size()); |
|
851 if (status != eap_status_ok) |
|
852 { |
|
853 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
854 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
855 return; |
|
856 } |
|
857 |
|
858 eap_variable_data_c passcode_utf8(m_am_tools); |
|
859 status = m_am_tools->convert_unicode_to_utf8(passcode_utf8, passcode); |
|
860 if (status != eap_status_ok) |
|
861 { |
|
862 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
863 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
864 return; |
|
865 } |
957 |
866 |
958 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_pincode_query_dialog - m_notifier.Connect() returned error=%d\n"), error)); |
867 // User must have entered some password and pressed OK. |
959 |
868 // Treat this as a full authentication and update the Last Auth Time. |
960 if( error != KErrNone) |
869 status = store_authentication_time(); |
961 { |
870 if (status != eap_status_ok) |
962 // Can not connect to notifier. |
871 { |
963 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
872 // Storing failed. Don't care. |
964 } |
873 EAP_TRACE_ERROR(m_am_tools, |
965 |
874 TRACE_FLAGS_DEFAULT, ( |
966 m_is_notifier_connected = true; // Got connectted to notifier. |
875 EAPL("eap_am_type_securid_symbian_c:Storing Last Full Authentication time failed, status=%d, but continuing\n"), |
967 } |
876 status)); |
968 |
877 |
969 EAP_TRACE_DEBUG_SYMBIAN((_L(" eap_am_type_securid_symbian_c::show_pincode_query_dialog - StartNotifierAndGetResponse - KEapSecurIDPincodeQueryUid \n"))); |
878 status = eap_status_ok; |
970 |
879 } |
971 m_notifier.StartNotifierAndGetResponse( |
880 |
972 iStatus, |
881 status = get_am_partner()->client_gtc_complete_user_input_query(&passcode_utf8); |
973 KEapSecurIDPincodeQueryUid, |
882 } |
974 *m_dialog_data_pckg_ptr, |
883 break; |
975 *m_dialog_data_pckg_ptr); |
884 |
976 |
885 default: |
977 SetActive(); |
886 EAP_TRACE_ERROR( |
978 } |
887 m_am_tools, |
979 else |
888 TRACE_FLAGS_DEFAULT, |
980 { |
889 (EAPL("ERROR: EAP - SecurID illegal state in RunL.\n"))); |
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"))); |
890 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
982 return eap_status_process_general_error; |
891 return; |
983 } |
892 } |
984 |
|
985 return eap_status_pending_request; |
|
986 } |
893 } |
987 |
894 |
988 //-------------------------------------------------- |
895 //-------------------------------------------------- |
989 |
896 |
990 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::read_auth_failure_string( |
897 EAP_FUNC_EXPORT eap_status_e eap_am_type_securid_symbian_c::read_auth_failure_string( |
1096 |
1019 |
1097 bool eap_am_type_securid_symbian_c::is_session_validL() |
1020 bool eap_am_type_securid_symbian_c::is_session_validL() |
1098 { |
1021 { |
1099 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1022 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1100 |
1023 |
1101 EAP_TRACE_DEBUG(m_am_tools, |
1024 EAP_TRACE_DEBUG( |
1102 TRACE_FLAGS_DEFAULT, ( |
1025 m_am_tools, |
1103 EAPL("eap_am_type_securid_symbian_c::is_session_valid: EAP vendor type=%d\n"), |
1026 TRACE_FLAGS_DEFAULT, |
1104 m_eap_vendor_type)); |
1027 (EAPL("eap_am_type_securid_symbian_c::is_session_valid(): EAP-tunneling type=0xfe%06x%08x\n"), |
|
1028 m_tunneling_type.get_vendor_id(), |
|
1029 m_tunneling_type.get_vendor_type())); |
1105 |
1030 |
1106 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
1031 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
1107 TPtr sqlStatement = buf->Des(); |
1032 TPtr sqlStatement = buf->Des(); |
1108 |
1033 |
1109 // Query all the relevant parameters |
1034 // Query all the relevant parameters |
1110 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
1035 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
1111 |
1036 |
1112 if (m_eap_type == eap_type_generic_token_card) |
1037 if (m_eap_type == eap_type_generic_token_card) |
1113 { |
1038 { |
1114 sqlStatement.Format(KSQLQuery, &cf_str_EAP_GTC_max_session_validity_time_literal, |
1039 sqlStatement.Format( |
1115 &KGTCLastFullAuthTime, &KGtcTableName, |
1040 KSQLQuery, |
1116 &KServiceType, m_index_type, |
1041 &cf_str_EAP_GTC_max_session_validity_time_literal, |
1117 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
1042 &KGTCLastFullAuthTime, |
|
1043 &KGtcTableName, |
|
1044 &KServiceType, |
|
1045 m_index_type, |
|
1046 &KServiceIndex, |
|
1047 m_index, |
|
1048 &KTunnelingTypeVendorId, |
|
1049 m_tunneling_type.get_vendor_id(), |
|
1050 &KTunnelingType, |
|
1051 m_tunneling_type.get_vendor_type()); |
1118 } |
1052 } |
1119 else |
1053 else |
1120 { |
1054 { |
1121 // Secure ID is not supported at the moment. |
1055 // Secure ID is not supported at the moment. |
1122 // Treat this as session invalid. |
1056 // Treat this as session invalid. |
1256 { |
1190 { |
1257 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1191 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1258 |
1192 |
1259 EAP_TRACE_DEBUG(m_am_tools, |
1193 EAP_TRACE_DEBUG(m_am_tools, |
1260 TRACE_FLAGS_DEFAULT, ( |
1194 TRACE_FLAGS_DEFAULT, ( |
1261 EAPL("eap_am_type_securid_symbian_c::store_authentication_timeL: EAP Vendor Type=%d\n"), |
1195 EAPL("eap_am_type_securid_symbian_c::store_authentication_timeL: EAP-tunneling type=0xfe%06x%08x\n"), |
1262 m_eap_vendor_type)); |
1196 m_tunneling_type.get_vendor_id(), |
|
1197 m_tunneling_type.get_vendor_type())); |
1263 |
1198 |
1264 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
1199 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
1265 TPtr sqlStatement = buf->Des(); |
1200 TPtr sqlStatement = buf->Des(); |
1266 |
1201 |
1267 // Query all the relevant parameters |
1202 // Query all the relevant parameters |
1268 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
1203 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
1269 |
1204 |
1270 if (m_eap_type == eap_type_generic_token_card) |
1205 if (m_eap_type == eap_type_generic_token_card) |
1271 { |
1206 { |
1272 sqlStatement.Format(KSQLQuery, &KGTCLastFullAuthTime, &KGtcTableName, |
1207 sqlStatement.Format( |
1273 &KServiceType, m_index_type, |
1208 KSQLQuery, |
1274 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
1209 &KGTCLastFullAuthTime, |
|
1210 &KGtcTableName, |
|
1211 &KServiceType, |
|
1212 m_index_type, |
|
1213 &KServiceIndex, |
|
1214 m_index, |
|
1215 &KTunnelingTypeVendorId, |
|
1216 m_tunneling_type.get_vendor_id(), |
|
1217 &KTunnelingType, |
|
1218 m_tunneling_type.get_vendor_type()); |
1275 } |
1219 } |
1276 else |
1220 else |
1277 { |
1221 { |
1278 // Secure ID is not supported at the moment. |
1222 // Secure ID is not supported at the moment. |
1279 // Leave with error. |
1223 // Leave with error. |