278 // Appropriate error notification is sent from finish_unsuccessful_authentication. |
312 // Appropriate error notification is sent from finish_unsuccessful_authentication. |
279 get_am_partner()->finish_unsuccessful_authentication(true); |
313 get_am_partner()->finish_unsuccessful_authentication(true); |
280 |
314 |
281 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
315 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
282 return; |
316 return; |
283 } |
317 } |
284 |
318 |
285 if (aStatus != KErrNone) |
319 if (iStatus.Int() != KErrNone) |
286 { |
320 { |
287 // Something is very wrong... |
321 // Something is very wrong... |
288 EAP_TRACE_ERROR( |
322 EAP_TRACE_ERROR( |
289 m_am_tools, |
323 m_am_tools, |
290 TRACE_FLAGS_DEFAULT, |
324 TRACE_FLAGS_DEFAULT, |
291 (EAPL("ERROR: EAP - MS-Chap-V2 notifier or dialog, aStatus=%d\n"), aStatus)); |
325 (EAPL("ERROR: EAP - MS-Chap-V2 notifier or dialog, iStatus.Int()=%d\n"), iStatus.Int())); |
292 |
326 |
293 send_error_notification(eap_status_authentication_failure); |
327 send_error_notification(eap_status_authentication_failure); |
294 |
328 |
295 get_am_partner()->finish_unsuccessful_authentication(false); |
329 get_am_partner()->finish_unsuccessful_authentication(false); |
296 |
330 |
297 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
331 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
298 return; |
332 return; |
299 } |
333 } |
300 |
334 |
301 eap_status_e status(eap_status_ok); |
335 eap_status_e status(eap_status_ok); |
302 |
336 |
303 switch (m_state) |
337 switch (m_state) |
304 { |
338 { |
305 case EHandlingUsernamePasswordQuery: |
339 case EHandlingUsernamePasswordQuery: |
306 { |
340 { |
307 if (m_username_password_io_ptr->iPasswordPromptEnabled) |
341 if (m_username_password_io_ptr->iPasswordPromptEnabled) |
308 { |
342 { |
309 *m_password_prompt_enabled = true; |
343 *m_password_prompt_enabled = true; |
310 } |
344 } |
311 else |
345 else |
312 { |
346 { |
313 *m_password_prompt_enabled = false; |
347 *m_password_prompt_enabled = false; |
314 } |
348 } |
315 |
349 |
316 { |
350 { |
317 eap_variable_data_c tmp_username_unicode( |
351 eap_variable_data_c tmp_username_unicode( |
318 m_am_tools); |
352 m_am_tools); |
319 |
353 |
320 status = tmp_username_unicode.set_buffer( |
354 status = tmp_username_unicode.set_buffer( |
321 m_username_password_io_ptr->iUsername.Ptr(), |
355 m_username_password_io_ptr->iUsername.Ptr(), |
322 m_username_password_io_ptr->iUsername.Size(), |
356 m_username_password_io_ptr->iUsername.Size(), |
323 false, |
357 false, |
324 false); |
358 false); |
325 if (status != eap_status_ok) |
359 if (status != eap_status_ok) |
326 { |
360 { |
327 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
361 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
328 (void) EAP_STATUS_RETURN(m_am_tools, status); |
362 (void) EAP_STATUS_RETURN(m_am_tools, status); |
329 return; |
363 return; |
330 } |
364 } |
331 |
365 |
332 eap_variable_data_c tmp_username_utf8(m_am_tools); |
366 eap_variable_data_c tmp_username_utf8(m_am_tools); |
333 status = m_am_tools->convert_unicode_to_utf8(tmp_username_utf8, tmp_username_unicode); |
367 status = m_am_tools->convert_unicode_to_utf8(tmp_username_utf8, tmp_username_unicode); |
334 if (status != eap_status_ok) |
368 if (status != eap_status_ok) |
335 { |
369 { |
336 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
370 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
337 (void) EAP_STATUS_RETURN(m_am_tools, status); |
371 (void) EAP_STATUS_RETURN(m_am_tools, status); |
338 return; |
372 return; |
339 } |
373 } |
340 |
374 |
341 status = m_username_utf8->set_copy_of_buffer(&tmp_username_utf8); |
375 status = m_username_utf8->set_copy_of_buffer(&tmp_username_utf8); |
342 if (status != eap_status_ok) |
376 if (status != eap_status_ok) |
343 { |
377 { |
344 get_am_partner()->finish_unsuccessful_authentication(false); |
378 get_am_partner()->finish_unsuccessful_authentication(false); |
345 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
379 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
346 (void) EAP_STATUS_RETURN(m_am_tools, status); |
380 (void) EAP_STATUS_RETURN(m_am_tools, status); |
347 return; |
381 return; |
348 } |
|
349 } |
382 } |
350 |
383 } |
351 { |
384 |
|
385 { |
352 eap_variable_data_c tmp_password_unicode( |
386 eap_variable_data_c tmp_password_unicode( |
353 m_am_tools); |
387 m_am_tools); |
354 |
388 |
355 status = tmp_password_unicode.set_buffer( |
389 status = tmp_password_unicode.set_buffer( |
356 m_username_password_io_ptr->iPassword.Ptr(), |
390 m_username_password_io_ptr->iPassword.Ptr(), |
357 m_username_password_io_ptr->iPassword.Size(), |
391 m_username_password_io_ptr->iPassword.Size(), |
358 false, |
392 false, |
359 false); |
393 false); |
360 if (status != eap_status_ok) |
394 if (status != eap_status_ok) |
361 { |
395 { |
362 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
396 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
363 (void) EAP_STATUS_RETURN(m_am_tools, status); |
397 (void) EAP_STATUS_RETURN(m_am_tools, status); |
364 return; |
398 return; |
365 } |
399 } |
366 |
400 |
367 eap_variable_data_c tmp_password_utf8(m_am_tools); |
401 eap_variable_data_c tmp_password_utf8(m_am_tools); |
368 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
402 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
369 if (status != eap_status_ok) |
403 if (status != eap_status_ok) |
370 { |
404 { |
371 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
405 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
372 (void) EAP_STATUS_RETURN(m_am_tools, status); |
406 (void) EAP_STATUS_RETURN(m_am_tools, status); |
373 return; |
407 return; |
374 } |
408 } |
375 |
409 |
376 status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
410 status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
377 if (status != eap_status_ok) |
411 if (status != eap_status_ok) |
378 { |
412 { |
379 get_am_partner()->finish_unsuccessful_authentication(false); |
413 get_am_partner()->finish_unsuccessful_authentication(false); |
380 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
414 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
381 (void) EAP_STATUS_RETURN(m_am_tools, status); |
415 (void) EAP_STATUS_RETURN(m_am_tools, status); |
382 return; |
416 return; |
383 } |
|
384 } |
417 } |
|
418 } |
385 |
419 |
386 // Store username and/or password if "Prompt for username" is enabled |
420 // Store username and/or password if "Prompt for username" is enabled |
387 status = update_username_password(); |
421 status = update_username_password(); |
388 if (status != eap_status_ok) |
422 if (status != eap_status_ok) |
389 { |
423 { |
390 get_am_partner()->finish_unsuccessful_authentication(false); |
424 get_am_partner()->finish_unsuccessful_authentication(false); |
391 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
425 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
392 return; |
426 return; |
393 } |
427 } |
394 |
428 |
395 if (m_is_identity_query) |
429 if (m_is_identity_query) |
396 { |
430 { |
397 status = get_am_partner()->complete_eap_identity_query(); |
431 status = get_am_partner()->complete_eap_identity_query(); |
398 } |
432 } |
399 else |
433 else |
400 { |
434 { |
401 status = get_am_partner()->complete_failure_retry_response(); |
435 status = get_am_partner()->complete_failure_retry_response(); |
402 } |
436 } |
403 } |
437 } |
404 break; |
438 break; |
405 |
439 |
406 case EHandlingChangePasswordQuery: |
440 case EHandlingChangePasswordQuery: |
407 { |
441 { |
408 { |
442 { |
409 eap_variable_data_c tmp_password_unicode( |
443 eap_variable_data_c tmp_password_unicode( |
410 m_am_tools); |
444 m_am_tools); |
411 |
445 |
412 status = tmp_password_unicode.set_buffer( |
446 status = tmp_password_unicode.set_buffer( |
413 m_username_password_io_ptr->iPassword.Ptr(), |
447 m_username_password_io_ptr->iPassword.Ptr(), |
414 m_username_password_io_ptr->iPassword.Size(), |
448 m_username_password_io_ptr->iPassword.Size(), |
415 false, |
449 false, |
416 false); |
450 false); |
417 if (status != eap_status_ok) |
451 if (status != eap_status_ok) |
418 { |
452 { |
419 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
453 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
420 (void) EAP_STATUS_RETURN(m_am_tools, status); |
454 (void) EAP_STATUS_RETURN(m_am_tools, status); |
421 return; |
455 return; |
422 } |
456 } |
423 |
457 |
424 eap_variable_data_c tmp_password_utf8(m_am_tools); |
458 eap_variable_data_c tmp_password_utf8(m_am_tools); |
425 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
459 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
426 if (status != eap_status_ok) |
460 if (status != eap_status_ok) |
427 { |
461 { |
428 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
462 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
429 (void) EAP_STATUS_RETURN(m_am_tools, status); |
463 (void) EAP_STATUS_RETURN(m_am_tools, status); |
430 return; |
464 return; |
431 } |
465 } |
432 |
466 |
433 eap_status_e status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
467 eap_status_e status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
434 if (status != eap_status_ok) |
468 if (status != eap_status_ok) |
435 { |
469 { |
436 get_am_partner()->finish_unsuccessful_authentication(false); |
470 get_am_partner()->finish_unsuccessful_authentication(false); |
437 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
471 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
438 return; |
472 return; |
439 } |
|
440 } |
473 } |
441 |
474 } |
442 { |
475 |
|
476 { |
443 eap_variable_data_c tmp_old_password_unicode( |
477 eap_variable_data_c tmp_old_password_unicode( |
444 m_am_tools); |
478 m_am_tools); |
445 |
479 |
446 status = tmp_old_password_unicode.set_buffer( |
480 status = tmp_old_password_unicode.set_buffer( |
447 m_username_password_io_ptr->iOldPassword.Ptr(), |
481 m_username_password_io_ptr->iOldPassword.Ptr(), |
448 m_username_password_io_ptr->iOldPassword.Size(), |
482 m_username_password_io_ptr->iOldPassword.Size(), |
449 false, |
483 false, |
450 false); |
484 false); |
451 if (status != eap_status_ok) |
485 if (status != eap_status_ok) |
452 { |
486 { |
453 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
487 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
454 (void) EAP_STATUS_RETURN(m_am_tools, status); |
488 (void) EAP_STATUS_RETURN(m_am_tools, status); |
455 return; |
489 return; |
456 } |
490 } |
457 |
491 |
458 eap_variable_data_c tmp_old_password_utf8(m_am_tools); |
492 eap_variable_data_c tmp_old_password_utf8(m_am_tools); |
459 status = m_am_tools->convert_unicode_to_utf8(tmp_old_password_utf8, tmp_old_password_unicode); |
493 status = m_am_tools->convert_unicode_to_utf8(tmp_old_password_utf8, tmp_old_password_unicode); |
460 if (status != eap_status_ok) |
494 if (status != eap_status_ok) |
461 { |
495 { |
462 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
496 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
463 (void) EAP_STATUS_RETURN(m_am_tools, status); |
497 (void) EAP_STATUS_RETURN(m_am_tools, status); |
464 return; |
498 return; |
465 } |
499 } |
466 |
500 |
467 status = m_old_password_utf8->set_copy_of_buffer(&tmp_old_password_utf8); |
501 status = m_old_password_utf8->set_copy_of_buffer(&tmp_old_password_utf8); |
468 if (status != eap_status_ok) |
502 if (status != eap_status_ok) |
469 { |
503 { |
470 get_am_partner()->finish_unsuccessful_authentication(false); |
504 get_am_partner()->finish_unsuccessful_authentication(false); |
471 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
505 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
472 return; |
506 return; |
473 } |
|
474 } |
507 } |
|
508 } |
475 |
509 |
476 status = get_am_partner()->complete_change_password_query(); |
510 status = get_am_partner()->complete_change_password_query(); |
477 } |
511 } |
478 break; |
512 break; |
479 |
513 |
480 default: |
514 default: |
481 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP - MS-Chap-V2 illegal state in RunL.\n"))); |
515 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP - MS-Chap-V2 illegal state in RunL.\n"))); |
482 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
516 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
483 return; |
517 return; |
484 |
518 } |
485 } |
519 |
486 } |
520 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
487 |
521 } |
488 //-------------------------------------------------- |
522 |
489 |
523 //-------------------------------------------------- |
490 void eap_am_type_mschapv2_symbian_c::RunL() |
524 |
491 { |
525 void eap_am_type_mschapv2_symbian_c::DoCancel() |
492 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
526 { |
493 |
527 if( m_is_notifier_connected ) |
|
528 { |
494 EAP_TRACE_DEBUG( |
529 EAP_TRACE_DEBUG( |
495 m_am_tools, |
530 m_am_tools, |
496 TRACE_FLAGS_DEFAULT, |
531 TRACE_FLAGS_DEFAULT, |
497 (EAPL("eap_am_type_mschapv2_symbian_c::RunL - start") |
532 (EAPL("eap_am_type_mschapv2_symbian_c::DoCancel - calling m_notifier.CancelNotifier(..)\n"))); |
498 EAPL("m_state, iStatus.Int()=%d\n"), |
533 |
499 m_state, iStatus.Int())); |
534 TInt error = KErrNone; |
500 |
535 EAP_UNREFERENCED_PARAMETER(error); |
501 |
536 error = m_notifier.CancelNotifier(KEapMsChapV2UsernamePasswordUid); |
502 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
537 |
503 } |
538 EAP_TRACE_DEBUG( |
504 |
539 m_am_tools, |
505 //-------------------------------------------------- |
540 TRACE_FLAGS_DEFAULT, |
506 |
541 (EAPL("eap_am_type_mschapv2_symbian_c::DoCancel - calling m_notifier.Close(), prev error=%d\n"), |
507 void eap_am_type_mschapv2_symbian_c::DoCancel() |
542 error)); |
508 { |
543 |
509 if (iEapAuthNotifier != 0) |
544 m_notifier.Close(); // Call close only if it is connected. |
510 { |
545 |
511 iEapAuthNotifier->Cancel(); |
546 m_is_notifier_connected = false; |
512 } |
547 } |
513 |
548 } |
514 |
|
515 } |
|
516 |
549 |
517 //-------------------------------------------------- |
550 //-------------------------------------------------- |
518 |
551 |
519 |
552 |
520 EAP_FUNC_EXPORT eap_status_e eap_am_type_mschapv2_symbian_c::type_configure_read( |
553 EAP_FUNC_EXPORT eap_status_e eap_am_type_mschapv2_symbian_c::type_configure_read( |
887 eap_variable_data_c & username_utf8, |
914 eap_variable_data_c & username_utf8, |
888 eap_variable_data_c & password_utf8, |
915 eap_variable_data_c & password_utf8, |
889 bool & password_prompt_enabled, |
916 bool & password_prompt_enabled, |
890 bool is_identity_query) |
917 bool is_identity_query) |
891 { |
918 { |
892 eap_status_e status = eap_status_ok; |
|
893 |
919 |
894 EAP_TRACE_DEBUG( |
920 EAP_TRACE_DEBUG( |
895 m_am_tools, |
921 m_am_tools, |
896 TRACE_FLAGS_DEFAULT, |
922 TRACE_FLAGS_DEFAULT, |
897 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog - start, password_prompt_enabled=%d,is_identity_query=%d\n"), |
923 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog - start, password_prompt_enabled=%d,is_identity_query=%d\n"), |
898 password_prompt_enabled, is_identity_query)); |
924 password_prompt_enabled, is_identity_query)); |
899 |
925 |
900 m_username_utf8 = &username_utf8; |
926 m_username_utf8 = &username_utf8; |
901 m_password_utf8 = &password_utf8; |
927 m_password_utf8 = &password_utf8; |
902 m_password_prompt_enabled = &password_prompt_enabled; |
928 m_password_prompt_enabled = &password_prompt_enabled; |
903 m_is_identity_query = is_identity_query; |
929 m_is_identity_query = is_identity_query; |
904 |
930 |
905 if (*m_password_prompt_enabled == true) |
931 if (!IsActive()) |
906 { |
932 { |
907 m_username_password_io_ptr->iPasswordPromptEnabled = ETrue; |
933 if (*m_password_prompt_enabled == true) |
908 } |
934 { |
909 else |
935 m_username_password_io_ptr->iPasswordPromptEnabled = ETrue; |
910 { |
936 } |
911 m_username_password_io_ptr->iPasswordPromptEnabled = EFalse; |
937 else |
912 } |
938 { |
913 |
939 m_username_password_io_ptr->iPasswordPromptEnabled = EFalse; |
914 if (m_is_identity_query == true) |
940 } |
915 { |
941 |
916 m_username_password_io_ptr->iIsIdentityQuery = ETrue; |
942 if (m_is_identity_query == true) |
917 } |
943 { |
918 else |
944 m_username_password_io_ptr->iIsIdentityQuery = ETrue; |
919 { |
945 } |
920 m_username_password_io_ptr->iIsIdentityQuery = EFalse; |
946 else |
921 } |
947 { |
922 |
948 m_username_password_io_ptr->iIsIdentityQuery = EFalse; |
923 |
949 } |
924 eap_variable_data_c tmp_username_unicode(m_am_tools); |
950 |
925 status = m_am_tools->convert_utf8_to_unicode(tmp_username_unicode, *m_username_utf8); |
951 |
926 if (status != eap_status_ok) |
952 { |
927 { |
953 eap_variable_data_c tmp_username_unicode(m_am_tools); |
928 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
954 eap_status_e status = m_am_tools->convert_utf8_to_unicode(tmp_username_unicode, *m_username_utf8); |
929 return EAP_STATUS_RETURN(m_am_tools, status); |
955 if (status != eap_status_ok) |
930 } |
956 { |
931 |
957 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
932 m_username_password_io_ptr->iUsername.Copy( |
958 return EAP_STATUS_RETURN(m_am_tools, status); |
933 reinterpret_cast<TUint16 *> ( |
959 } |
934 tmp_username_unicode.get_data(tmp_username_unicode.get_data_length())), |
960 |
935 tmp_username_unicode.get_data_length() / 2); // 8bit -> 16bit |
961 m_username_password_io_ptr->iUsername.Copy( |
936 |
962 reinterpret_cast<TUint16 *> ( |
937 |
963 tmp_username_unicode.get_data(tmp_username_unicode.get_data_length())), |
938 m_state = EHandlingUsernamePasswordQuery; |
964 tmp_username_unicode.get_data_length() / 2); // 8bit -> 16bit |
|
965 } |
|
966 |
|
967 |
|
968 m_state = EHandlingUsernamePasswordQuery; |
|
969 |
|
970 EAP_TRACE_DEBUG( |
|
971 m_am_tools, |
|
972 TRACE_FLAGS_DEFAULT, |
|
973 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - before m_notifier.Connect(), m_is_notifier_connected=%d\n"), |
|
974 m_is_notifier_connected)); |
|
975 |
|
976 if( !m_is_notifier_connected ) |
|
977 { |
|
978 TInt error = m_notifier.Connect(); |
|
979 |
|
980 EAP_TRACE_DEBUG( |
|
981 m_am_tools, |
|
982 TRACE_FLAGS_DEFAULT, |
|
983 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - m_notifier.Connect() returned error=%d\n"), |
|
984 error)); |
|
985 |
|
986 if( error != KErrNone) |
|
987 { |
|
988 // Can not connect to notifier. |
|
989 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
990 } |
|
991 |
|
992 m_is_notifier_connected = true; // Got connectted to notifier. |
|
993 } |
939 |
994 |
940 EAP_TRACE_DEBUG( |
995 EAP_TRACE_DEBUG( |
941 m_am_tools, |
996 m_am_tools, |
942 TRACE_FLAGS_DEFAULT, |
997 TRACE_FLAGS_DEFAULT, |
943 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - before m_notifier.StartNotifierAndGetResponse()\n"))); |
998 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - before m_notifier.StartNotifierAndGetResponse()\n"))); |
944 |
999 |
945 TInt err1 = KErrNone; |
1000 m_notifier.StartNotifierAndGetResponse( |
946 |
1001 iStatus, |
947 TRAPD(err, err1 = IsDlgReadyToCompleteL()); |
1002 KEapMsChapV2UsernamePasswordUid, |
948 |
1003 *m_username_password_io_pckg_ptr, |
949 EAP_TRACE_DEBUG( |
1004 *m_username_password_io_pckg_ptr); |
950 m_am_tools, |
1005 |
951 TRACE_FLAGS_DEFAULT, |
1006 SetActive(); |
952 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog(): err=%d, result= %d\n"), |
1007 } |
953 err, |
|
954 err1)); |
|
955 |
|
956 if (*m_password_prompt_enabled == true || err || err1 == KErrCancel) |
|
957 { |
|
958 TEapExpandedType aEapType(*EapExpandedTypeMsChapv2.GetType()); |
|
959 m_username_password_io_ptr->iPassword.Zero(); |
|
960 if (iEapAuthNotifier == 0) |
|
961 { |
|
962 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
963 if (err) |
|
964 { |
|
965 return eap_status_authentication_failure; |
|
966 } |
|
967 } |
|
968 else |
|
969 { |
|
970 iEapAuthNotifier->Cancel(); |
|
971 } |
|
972 |
|
973 TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeMsChapV2UsernamePasswordDialog, m_username_password_io_ptr, aEapType)); |
|
974 if (err1) |
|
975 { |
|
976 return eap_status_authentication_failure; |
|
977 } |
|
978 } |
|
979 else |
1008 else |
980 { |
1009 { |
981 DlgComplete( status ); |
1010 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_mschapv2_symbian_c: Already active when tried to show username/password dialog.\n"))); |
982 return status; |
1011 return eap_status_process_general_error; |
983 } |
1012 } |
984 |
1013 |
985 return eap_status_pending_request; |
1014 return eap_status_pending_request; |
986 } |
1015 } |
987 |
1016 |
988 //-------------------------------------------------- |
1017 //-------------------------------------------------- |
989 |
1018 |
990 TInt eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL() |
|
991 { |
|
992 |
|
993 EAP_TRACE_DEBUG( |
|
994 m_am_tools, |
|
995 TRACE_FLAGS_DEFAULT, |
|
996 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"), |
|
997 m_index_type, |
|
998 m_index, |
|
999 m_tunneling_type.get_vendor_id(), |
|
1000 m_tunneling_type.get_vendor_type())); |
|
1001 |
|
1002 TInt status = KErrNone; |
|
1003 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
|
1004 TPtr sqlStatement = buf->Des(); |
|
1005 |
|
1006 // Query all the relevant parameters |
|
1007 _LIT(KSQLQuery, "SELECT %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
|
1008 |
|
1009 sqlStatement.Format( |
|
1010 KSQLQuery, |
|
1011 &cf_str_EAP_MSCHAPV2_password_prompt_literal, |
|
1012 &cf_str_EAP_MSCHAPV2_username_literal, |
|
1013 &cf_str_EAP_MSCHAPV2_password_literal, |
|
1014 &KMsChapV2TableName, |
|
1015 &KServiceType, |
|
1016 m_index_type, |
|
1017 &KServiceIndex, |
|
1018 m_index, |
|
1019 &KTunnelingTypeVendorId, |
|
1020 m_tunneling_type.get_vendor_id(), |
|
1021 &KTunnelingType, |
|
1022 m_tunneling_type.get_vendor_type()); |
|
1023 |
|
1024 |
|
1025 EAP_TRACE_DEBUG( |
|
1026 m_am_tools, |
|
1027 TRACE_FLAGS_DEFAULT, |
|
1028 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): Opens view\n"))); |
|
1029 |
|
1030 RDbView view; |
|
1031 // Evaluate view |
|
1032 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
|
1033 CleanupClosePushL(view); |
|
1034 |
|
1035 User::LeaveIfError(view.EvaluateAll()); |
|
1036 |
|
1037 // Get the first (and only) row |
|
1038 view.FirstL(); |
|
1039 view.GetL(); |
|
1040 |
|
1041 // Get column set so we get the correct column numbers |
|
1042 CDbColSet* colSet = view.ColSetL(); |
|
1043 CleanupStack::PushL(colSet); |
|
1044 |
|
1045 EAP_TRACE_DEBUG( |
|
1046 m_am_tools, |
|
1047 TRACE_FLAGS_DEFAULT, |
|
1048 (EAPL("eap_am_type_leap_symbian_c::IsDlgReadyToCompleteL(): Reads database\n"))); |
|
1049 |
|
1050 TPtrC username = view.ColDes(colSet->ColNo( cf_str_EAP_MSCHAPV2_username_literal ) ); |
|
1051 |
|
1052 EAP_TRACE_DATA_DEBUG( |
|
1053 m_am_tools, |
|
1054 TRACE_FLAGS_DEFAULT, |
|
1055 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): username"), |
|
1056 username.Ptr(), |
|
1057 username.Size())); |
|
1058 |
|
1059 TPtrC password = view.ColDes(colSet->ColNo( cf_str_EAP_MSCHAPV2_password_literal ) ); |
|
1060 |
|
1061 EAP_TRACE_DATA_DEBUG( |
|
1062 m_am_tools, |
|
1063 TRACE_FLAGS_DEFAULT, |
|
1064 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): password"), |
|
1065 password.Ptr(), |
|
1066 password.Size())); |
|
1067 |
|
1068 TUint prompt = view.ColUint(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal)); |
|
1069 |
|
1070 EAP_TRACE_DEBUG( |
|
1071 m_am_tools, |
|
1072 TRACE_FLAGS_DEFAULT, |
|
1073 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): prompt=%d\n"), |
|
1074 prompt)); |
|
1075 |
|
1076 |
|
1077 if ((EEapDbFalse != prompt) |
|
1078 || (username.Size() == 0) |
|
1079 || (password.Size() == 0)) |
|
1080 { |
|
1081 |
|
1082 if (username.Size() == 0) |
|
1083 { |
|
1084 m_username_password_io_ptr->iUsername.Zero(); |
|
1085 } |
|
1086 else |
|
1087 { |
|
1088 m_username_password_io_ptr->iUsername.Copy(username); |
|
1089 } |
|
1090 |
|
1091 status = KErrCancel; |
|
1092 } |
|
1093 else |
|
1094 { |
|
1095 status = KErrNone; |
|
1096 m_username_password_io_ptr->iUsername.Copy(username); |
|
1097 m_username_password_io_ptr->iPassword.Copy(password); |
|
1098 } |
|
1099 |
|
1100 CleanupStack::PopAndDestroy(colSet); // Delete colSet. |
|
1101 CleanupStack::PopAndDestroy(&view); // Close view. |
|
1102 CleanupStack::PopAndDestroy(buf); // Delete buf. |
|
1103 |
|
1104 EAP_TRACE_DEBUG( |
|
1105 m_am_tools, |
|
1106 TRACE_FLAGS_DEFAULT, |
|
1107 (EAPL("eap_am_type_mschapv2_symbian_c::IsDlgReadyToCompleteL(): status=%d\n"), |
|
1108 status)); |
|
1109 |
|
1110 return status; |
|
1111 } |
|
1112 |
|
1113 eap_status_e eap_am_type_mschapv2_symbian_c::show_change_password_dialog( |
1019 eap_status_e eap_am_type_mschapv2_symbian_c::show_change_password_dialog( |
1114 eap_variable_data_c & /* username */, |
1020 eap_variable_data_c & /* username */, |
1115 eap_variable_data_c & /* old_password */, |
1021 eap_variable_data_c & /* old_password */, |
1116 eap_variable_data_c & /* password */, |
1022 eap_variable_data_c & /* password */, |
1117 bool & /* password_prompt_enabled */) |
1023 bool & /* password_prompt_enabled */) |