312 // Appropriate error notification is sent from finish_unsuccessful_authentication. |
278 // Appropriate error notification is sent from finish_unsuccessful_authentication. |
313 get_am_partner()->finish_unsuccessful_authentication(true); |
279 get_am_partner()->finish_unsuccessful_authentication(true); |
314 |
280 |
315 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
281 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
316 return; |
282 return; |
317 } |
283 } |
318 |
284 |
319 if (iStatus.Int() != KErrNone) |
285 if (aStatus != KErrNone) |
320 { |
286 { |
321 // Something is very wrong... |
287 // Something is very wrong... |
322 EAP_TRACE_ERROR( |
288 EAP_TRACE_ERROR( |
323 m_am_tools, |
289 m_am_tools, |
324 TRACE_FLAGS_DEFAULT, |
290 TRACE_FLAGS_DEFAULT, |
325 (EAPL("ERROR: EAP - MS-Chap-V2 notifier or dialog, iStatus.Int()=%d\n"), iStatus.Int())); |
291 (EAPL("ERROR: EAP - MS-Chap-V2 notifier or dialog, aStatus=%d\n"), aStatus)); |
326 |
292 |
327 send_error_notification(eap_status_authentication_failure); |
293 send_error_notification(eap_status_authentication_failure); |
328 |
294 |
329 get_am_partner()->finish_unsuccessful_authentication(false); |
295 get_am_partner()->finish_unsuccessful_authentication(false); |
330 |
296 |
331 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
297 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
332 return; |
298 return; |
333 } |
299 } |
334 |
300 |
335 eap_status_e status(eap_status_ok); |
301 eap_status_e status(eap_status_ok); |
336 |
302 |
337 switch (m_state) |
303 switch (m_state) |
338 { |
304 { |
339 case EHandlingUsernamePasswordQuery: |
305 case EHandlingUsernamePasswordQuery: |
340 { |
306 { |
341 if (m_username_password_io_ptr->iPasswordPromptEnabled) |
307 if (m_username_password_io_ptr->iPasswordPromptEnabled) |
342 { |
308 { |
343 *m_password_prompt_enabled = true; |
309 *m_password_prompt_enabled = true; |
344 } |
310 } |
345 else |
311 else |
346 { |
312 { |
347 *m_password_prompt_enabled = false; |
313 *m_password_prompt_enabled = false; |
348 } |
314 } |
349 |
315 |
350 { |
316 { |
351 eap_variable_data_c tmp_username_unicode( |
317 eap_variable_data_c tmp_username_unicode( |
352 m_am_tools); |
318 m_am_tools); |
353 |
319 |
354 status = tmp_username_unicode.set_buffer( |
320 status = tmp_username_unicode.set_buffer( |
355 m_username_password_io_ptr->iUsername.Ptr(), |
321 m_username_password_io_ptr->iUsername.Ptr(), |
356 m_username_password_io_ptr->iUsername.Size(), |
322 m_username_password_io_ptr->iUsername.Size(), |
357 false, |
323 false, |
358 false); |
324 false); |
359 if (status != eap_status_ok) |
325 if (status != eap_status_ok) |
360 { |
326 { |
361 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
327 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
362 (void) EAP_STATUS_RETURN(m_am_tools, status); |
328 (void) EAP_STATUS_RETURN(m_am_tools, status); |
363 return; |
329 return; |
364 } |
330 } |
365 |
331 |
366 eap_variable_data_c tmp_username_utf8(m_am_tools); |
332 eap_variable_data_c tmp_username_utf8(m_am_tools); |
367 status = m_am_tools->convert_unicode_to_utf8(tmp_username_utf8, tmp_username_unicode); |
333 status = m_am_tools->convert_unicode_to_utf8(tmp_username_utf8, tmp_username_unicode); |
368 if (status != eap_status_ok) |
334 if (status != eap_status_ok) |
369 { |
335 { |
370 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
336 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
371 (void) EAP_STATUS_RETURN(m_am_tools, status); |
337 (void) EAP_STATUS_RETURN(m_am_tools, status); |
372 return; |
338 return; |
373 } |
339 } |
374 |
340 |
375 status = m_username_utf8->set_copy_of_buffer(&tmp_username_utf8); |
341 status = m_username_utf8->set_copy_of_buffer(&tmp_username_utf8); |
376 if (status != eap_status_ok) |
342 if (status != eap_status_ok) |
377 { |
343 { |
378 get_am_partner()->finish_unsuccessful_authentication(false); |
344 get_am_partner()->finish_unsuccessful_authentication(false); |
379 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
345 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
380 (void) EAP_STATUS_RETURN(m_am_tools, status); |
346 (void) EAP_STATUS_RETURN(m_am_tools, status); |
381 return; |
347 return; |
|
348 } |
382 } |
349 } |
383 } |
350 |
384 |
351 { |
385 { |
|
386 eap_variable_data_c tmp_password_unicode( |
352 eap_variable_data_c tmp_password_unicode( |
387 m_am_tools); |
353 m_am_tools); |
388 |
354 |
389 status = tmp_password_unicode.set_buffer( |
355 status = tmp_password_unicode.set_buffer( |
390 m_username_password_io_ptr->iPassword.Ptr(), |
356 m_username_password_io_ptr->iPassword.Ptr(), |
391 m_username_password_io_ptr->iPassword.Size(), |
357 m_username_password_io_ptr->iPassword.Size(), |
392 false, |
358 false, |
393 false); |
359 false); |
394 if (status != eap_status_ok) |
360 if (status != eap_status_ok) |
395 { |
361 { |
396 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
362 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
397 (void) EAP_STATUS_RETURN(m_am_tools, status); |
363 (void) EAP_STATUS_RETURN(m_am_tools, status); |
398 return; |
364 return; |
399 } |
365 } |
400 |
366 |
401 eap_variable_data_c tmp_password_utf8(m_am_tools); |
367 eap_variable_data_c tmp_password_utf8(m_am_tools); |
402 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
368 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
403 if (status != eap_status_ok) |
369 if (status != eap_status_ok) |
404 { |
370 { |
405 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
371 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
406 (void) EAP_STATUS_RETURN(m_am_tools, status); |
372 (void) EAP_STATUS_RETURN(m_am_tools, status); |
407 return; |
373 return; |
408 } |
374 } |
409 |
375 |
410 status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
376 status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
411 if (status != eap_status_ok) |
377 if (status != eap_status_ok) |
412 { |
378 { |
413 get_am_partner()->finish_unsuccessful_authentication(false); |
379 get_am_partner()->finish_unsuccessful_authentication(false); |
414 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
380 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
415 (void) EAP_STATUS_RETURN(m_am_tools, status); |
381 (void) EAP_STATUS_RETURN(m_am_tools, status); |
416 return; |
382 return; |
|
383 } |
417 } |
384 } |
418 } |
|
419 |
385 |
420 // Store username and/or password if "Prompt for username" is enabled |
386 // Store username and/or password if "Prompt for username" is enabled |
421 status = update_username_password(); |
387 status = update_username_password(); |
422 if (status != eap_status_ok) |
388 if (status != eap_status_ok) |
423 { |
389 { |
424 get_am_partner()->finish_unsuccessful_authentication(false); |
390 get_am_partner()->finish_unsuccessful_authentication(false); |
425 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
391 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
426 return; |
392 return; |
|
393 } |
|
394 |
|
395 if (m_is_identity_query) |
|
396 { |
|
397 status = get_am_partner()->complete_eap_identity_query(); |
|
398 } |
|
399 else |
|
400 { |
|
401 status = get_am_partner()->complete_failure_retry_response(); |
|
402 } |
427 } |
403 } |
428 |
|
429 if (m_is_identity_query) |
|
430 { |
|
431 status = get_am_partner()->complete_eap_identity_query(); |
|
432 } |
|
433 else |
|
434 { |
|
435 status = get_am_partner()->complete_failure_retry_response(); |
|
436 } |
|
437 } |
|
438 break; |
404 break; |
439 |
405 |
440 case EHandlingChangePasswordQuery: |
406 case EHandlingChangePasswordQuery: |
441 { |
407 { |
442 { |
408 { |
443 eap_variable_data_c tmp_password_unicode( |
409 eap_variable_data_c tmp_password_unicode( |
444 m_am_tools); |
410 m_am_tools); |
445 |
411 |
446 status = tmp_password_unicode.set_buffer( |
412 status = tmp_password_unicode.set_buffer( |
447 m_username_password_io_ptr->iPassword.Ptr(), |
413 m_username_password_io_ptr->iPassword.Ptr(), |
448 m_username_password_io_ptr->iPassword.Size(), |
414 m_username_password_io_ptr->iPassword.Size(), |
449 false, |
415 false, |
450 false); |
416 false); |
451 if (status != eap_status_ok) |
417 if (status != eap_status_ok) |
452 { |
418 { |
453 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
419 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
454 (void) EAP_STATUS_RETURN(m_am_tools, status); |
420 (void) EAP_STATUS_RETURN(m_am_tools, status); |
455 return; |
421 return; |
456 } |
422 } |
457 |
423 |
458 eap_variable_data_c tmp_password_utf8(m_am_tools); |
424 eap_variable_data_c tmp_password_utf8(m_am_tools); |
459 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
425 status = m_am_tools->convert_unicode_to_utf8(tmp_password_utf8, tmp_password_unicode); |
460 if (status != eap_status_ok) |
426 if (status != eap_status_ok) |
461 { |
427 { |
462 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
428 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
463 (void) EAP_STATUS_RETURN(m_am_tools, status); |
429 (void) EAP_STATUS_RETURN(m_am_tools, status); |
464 return; |
430 return; |
465 } |
431 } |
466 |
432 |
467 eap_status_e status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
433 eap_status_e status = m_password_utf8->set_copy_of_buffer(&tmp_password_utf8); |
468 if (status != eap_status_ok) |
434 if (status != eap_status_ok) |
469 { |
435 { |
470 get_am_partner()->finish_unsuccessful_authentication(false); |
436 get_am_partner()->finish_unsuccessful_authentication(false); |
471 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
437 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
472 return; |
438 return; |
|
439 } |
473 } |
440 } |
474 } |
441 |
475 |
442 { |
476 { |
|
477 eap_variable_data_c tmp_old_password_unicode( |
443 eap_variable_data_c tmp_old_password_unicode( |
478 m_am_tools); |
444 m_am_tools); |
479 |
445 |
480 status = tmp_old_password_unicode.set_buffer( |
446 status = tmp_old_password_unicode.set_buffer( |
481 m_username_password_io_ptr->iOldPassword.Ptr(), |
447 m_username_password_io_ptr->iOldPassword.Ptr(), |
482 m_username_password_io_ptr->iOldPassword.Size(), |
448 m_username_password_io_ptr->iOldPassword.Size(), |
483 false, |
449 false, |
484 false); |
450 false); |
485 if (status != eap_status_ok) |
451 if (status != eap_status_ok) |
486 { |
452 { |
487 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
453 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
488 (void) EAP_STATUS_RETURN(m_am_tools, status); |
454 (void) EAP_STATUS_RETURN(m_am_tools, status); |
489 return; |
455 return; |
490 } |
456 } |
491 |
457 |
492 eap_variable_data_c tmp_old_password_utf8(m_am_tools); |
458 eap_variable_data_c tmp_old_password_utf8(m_am_tools); |
493 status = m_am_tools->convert_unicode_to_utf8(tmp_old_password_utf8, tmp_old_password_unicode); |
459 status = m_am_tools->convert_unicode_to_utf8(tmp_old_password_utf8, tmp_old_password_unicode); |
494 if (status != eap_status_ok) |
460 if (status != eap_status_ok) |
495 { |
461 { |
496 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
462 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
497 (void) EAP_STATUS_RETURN(m_am_tools, status); |
463 (void) EAP_STATUS_RETURN(m_am_tools, status); |
498 return; |
464 return; |
499 } |
465 } |
500 |
466 |
501 status = m_old_password_utf8->set_copy_of_buffer(&tmp_old_password_utf8); |
467 status = m_old_password_utf8->set_copy_of_buffer(&tmp_old_password_utf8); |
502 if (status != eap_status_ok) |
468 if (status != eap_status_ok) |
503 { |
469 { |
504 get_am_partner()->finish_unsuccessful_authentication(false); |
470 get_am_partner()->finish_unsuccessful_authentication(false); |
505 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
471 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
506 return; |
472 return; |
|
473 } |
507 } |
474 } |
|
475 |
|
476 status = get_am_partner()->complete_change_password_query(); |
508 } |
477 } |
509 |
|
510 status = get_am_partner()->complete_change_password_query(); |
|
511 } |
|
512 break; |
478 break; |
513 |
479 |
514 default: |
480 default: |
515 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP - MS-Chap-V2 illegal state in RunL.\n"))); |
481 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP - MS-Chap-V2 illegal state in RunL.\n"))); |
516 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
482 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
517 return; |
483 return; |
518 } |
484 |
|
485 } |
|
486 } |
|
487 |
|
488 //-------------------------------------------------- |
|
489 |
|
490 void eap_am_type_mschapv2_symbian_c::RunL() |
|
491 { |
|
492 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
493 |
|
494 EAP_TRACE_DEBUG( |
|
495 m_am_tools, |
|
496 TRACE_FLAGS_DEFAULT, |
|
497 (EAPL("eap_am_type_mschapv2_symbian_c::RunL - start") |
|
498 EAPL("m_state, iStatus.Int()=%d\n"), |
|
499 m_state, iStatus.Int())); |
|
500 |
519 |
501 |
520 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
502 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
521 } |
503 } |
522 |
504 |
523 //-------------------------------------------------- |
505 //-------------------------------------------------- |
524 |
506 |
525 void eap_am_type_mschapv2_symbian_c::DoCancel() |
507 void eap_am_type_mschapv2_symbian_c::DoCancel() |
526 { |
508 { |
527 if( m_is_notifier_connected ) |
509 if (iEapAuthNotifier != 0) |
528 { |
510 { |
529 EAP_TRACE_DEBUG( |
511 iEapAuthNotifier->Cancel(); |
530 m_am_tools, |
512 } |
531 TRACE_FLAGS_DEFAULT, |
513 |
532 (EAPL("eap_am_type_mschapv2_symbian_c::DoCancel - calling m_notifier.CancelNotifier(..)\n"))); |
514 |
533 |
515 } |
534 TInt error = KErrNone; |
|
535 EAP_UNREFERENCED_PARAMETER(error); |
|
536 error = m_notifier.CancelNotifier(KEapMsChapV2UsernamePasswordUid); |
|
537 |
|
538 EAP_TRACE_DEBUG( |
|
539 m_am_tools, |
|
540 TRACE_FLAGS_DEFAULT, |
|
541 (EAPL("eap_am_type_mschapv2_symbian_c::DoCancel - calling m_notifier.Close(), prev error=%d\n"), |
|
542 error)); |
|
543 |
|
544 m_notifier.Close(); // Call close only if it is connected. |
|
545 |
|
546 m_is_notifier_connected = false; |
|
547 } |
|
548 } |
|
549 |
516 |
550 //-------------------------------------------------- |
517 //-------------------------------------------------- |
551 |
518 |
552 |
519 |
553 EAP_FUNC_EXPORT eap_status_e eap_am_type_mschapv2_symbian_c::type_configure_read( |
520 EAP_FUNC_EXPORT eap_status_e eap_am_type_mschapv2_symbian_c::type_configure_read( |
914 eap_variable_data_c & username_utf8, |
887 eap_variable_data_c & username_utf8, |
915 eap_variable_data_c & password_utf8, |
888 eap_variable_data_c & password_utf8, |
916 bool & password_prompt_enabled, |
889 bool & password_prompt_enabled, |
917 bool is_identity_query) |
890 bool is_identity_query) |
918 { |
891 { |
|
892 eap_status_e status = eap_status_ok; |
919 |
893 |
920 EAP_TRACE_DEBUG( |
894 EAP_TRACE_DEBUG( |
921 m_am_tools, |
895 m_am_tools, |
922 TRACE_FLAGS_DEFAULT, |
896 TRACE_FLAGS_DEFAULT, |
923 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog - start, password_prompt_enabled=%d,is_identity_query=%d\n"), |
897 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog - start, password_prompt_enabled=%d,is_identity_query=%d\n"), |
924 password_prompt_enabled, is_identity_query)); |
898 password_prompt_enabled, is_identity_query)); |
925 |
899 |
926 m_username_utf8 = &username_utf8; |
900 m_username_utf8 = &username_utf8; |
927 m_password_utf8 = &password_utf8; |
901 m_password_utf8 = &password_utf8; |
928 m_password_prompt_enabled = &password_prompt_enabled; |
902 m_password_prompt_enabled = &password_prompt_enabled; |
929 m_is_identity_query = is_identity_query; |
903 m_is_identity_query = is_identity_query; |
930 |
904 |
931 if (!IsActive()) |
905 if (*m_password_prompt_enabled == true) |
932 { |
906 { |
933 if (*m_password_prompt_enabled == true) |
907 m_username_password_io_ptr->iPasswordPromptEnabled = ETrue; |
934 { |
908 } |
935 m_username_password_io_ptr->iPasswordPromptEnabled = ETrue; |
909 else |
936 } |
910 { |
937 else |
911 m_username_password_io_ptr->iPasswordPromptEnabled = EFalse; |
938 { |
912 } |
939 m_username_password_io_ptr->iPasswordPromptEnabled = EFalse; |
913 |
940 } |
914 if (m_is_identity_query == true) |
941 |
915 { |
942 if (m_is_identity_query == true) |
916 m_username_password_io_ptr->iIsIdentityQuery = ETrue; |
943 { |
917 } |
944 m_username_password_io_ptr->iIsIdentityQuery = ETrue; |
918 else |
945 } |
919 { |
946 else |
920 m_username_password_io_ptr->iIsIdentityQuery = EFalse; |
947 { |
921 } |
948 m_username_password_io_ptr->iIsIdentityQuery = EFalse; |
922 |
949 } |
923 |
950 |
924 eap_variable_data_c tmp_username_unicode(m_am_tools); |
951 |
925 status = m_am_tools->convert_utf8_to_unicode(tmp_username_unicode, *m_username_utf8); |
952 { |
926 if (status != eap_status_ok) |
953 eap_variable_data_c tmp_username_unicode(m_am_tools); |
927 { |
954 eap_status_e status = m_am_tools->convert_utf8_to_unicode(tmp_username_unicode, *m_username_utf8); |
928 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
955 if (status != eap_status_ok) |
929 return EAP_STATUS_RETURN(m_am_tools, status); |
956 { |
930 } |
957 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
931 |
958 return EAP_STATUS_RETURN(m_am_tools, status); |
932 m_username_password_io_ptr->iUsername.Copy( |
959 } |
933 reinterpret_cast<TUint16 *> ( |
960 |
934 tmp_username_unicode.get_data(tmp_username_unicode.get_data_length())), |
961 m_username_password_io_ptr->iUsername.Copy( |
935 tmp_username_unicode.get_data_length() / 2); // 8bit -> 16bit |
962 reinterpret_cast<TUint16 *> ( |
936 |
963 tmp_username_unicode.get_data(tmp_username_unicode.get_data_length())), |
937 |
964 tmp_username_unicode.get_data_length() / 2); // 8bit -> 16bit |
938 m_state = EHandlingUsernamePasswordQuery; |
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 } |
|
994 |
939 |
995 EAP_TRACE_DEBUG( |
940 EAP_TRACE_DEBUG( |
996 m_am_tools, |
941 m_am_tools, |
997 TRACE_FLAGS_DEFAULT, |
942 TRACE_FLAGS_DEFAULT, |
998 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - before m_notifier.StartNotifierAndGetResponse()\n"))); |
943 (EAPL(" eap_am_type_mschapv2_symbian_c::show_username_password_dialog - before m_notifier.StartNotifierAndGetResponse()\n"))); |
999 |
944 |
1000 m_notifier.StartNotifierAndGetResponse( |
945 TInt err1 = KErrNone; |
1001 iStatus, |
946 |
1002 KEapMsChapV2UsernamePasswordUid, |
947 TRAPD(err, err1 = IsDlgReadyToCompleteL()); |
1003 *m_username_password_io_pckg_ptr, |
948 |
1004 *m_username_password_io_pckg_ptr); |
949 EAP_TRACE_DEBUG( |
1005 |
950 m_am_tools, |
1006 SetActive(); |
951 TRACE_FLAGS_DEFAULT, |
1007 } |
952 (EAPL("eap_am_type_mschapv2_symbian_c::show_username_password_dialog(): err=%d, result= %d\n"), |
|
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 } |
1008 else |
979 else |
1009 { |
980 { |
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"))); |
981 DlgComplete( status ); |
1011 return eap_status_process_general_error; |
982 return status; |
1012 } |
983 } |
1013 |
984 |
1014 return eap_status_pending_request; |
985 return eap_status_pending_request; |
1015 } |
986 } |
1016 |
987 |
1017 //-------------------------------------------------- |
988 //-------------------------------------------------- |
1018 |
989 |
|
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 |
1019 eap_status_e eap_am_type_mschapv2_symbian_c::show_change_password_dialog( |
1113 eap_status_e eap_am_type_mschapv2_symbian_c::show_change_password_dialog( |
1020 eap_variable_data_c & /* username */, |
1114 eap_variable_data_c & /* username */, |
1021 eap_variable_data_c & /* old_password */, |
1115 eap_variable_data_c & /* old_password */, |
1022 eap_variable_data_c & /* password */, |
1116 eap_variable_data_c & /* password */, |
1023 bool & /* password_prompt_enabled */) |
1117 bool & /* password_prompt_enabled */) |