127 // ---------------------------------------------------------- |
127 // ---------------------------------------------------------- |
128 // qtdone |
128 // qtdone |
129 EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) |
129 EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) |
130 { |
130 { |
131 RDEBUG("0", 0); |
131 RDEBUG("0", 0); |
|
132 RDEBUG("TBool aStartup", aStartup); |
132 |
133 |
133 iStartup = aStartup; |
134 iStartup = aStartup; |
134 HandleEventL(aEvent, aResult); |
135 HandleEventL(aEvent, aResult); |
135 } |
136 } |
136 |
137 |
184 aResult = UPukRequiredL(); |
185 aResult = UPukRequiredL(); |
185 } |
186 } |
186 else |
187 else |
187 aResult = KErrNotSupported; |
188 aResult = KErrNotSupported; |
188 break; |
189 break; |
|
190 case RMobilePhone::EPhonePasswordRequired+0x100: // from Autolock |
189 case RMobilePhone::EPhonePasswordRequired: |
191 case RMobilePhone::EPhonePasswordRequired: |
190 aResult = PassPhraseRequiredL(); |
192 aResult = PassPhraseRequiredL(); |
191 break; |
193 break; |
192 case RMobilePhone::EICCTerminated: |
194 case RMobilePhone::EICCTerminated: |
193 SimLockEventL(); |
195 SimLockEventL(); |
341 CleanupClosePushL(scpClient); |
343 CleanupClosePushL(scpClient); |
342 |
344 |
343 TSCPSecCode newCode; |
345 TSCPSecCode newCode; |
344 RDEBUG("iSecUi_password", 1); |
346 RDEBUG("iSecUi_password", 1); |
345 RDEBUGSTR(iSecUi_password); |
347 RDEBUGSTR(iSecUi_password); |
346 newCode.Copy(iSecUi_password); |
348 newCode.Copy(iSecUi_password); // this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10 |
347 RDEBUG( |
349 RDEBUG( |
348 "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", |
350 "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", |
349 0); |
351 0); |
350 scpClient.StoreCode(newCode); |
352 scpClient.StoreCode(newCode); |
351 RDEBUG("called StoreCode", 1); |
353 RDEBUG("called StoreCode", 1); |
533 RDEBUG("codeQueryNotifier 0", 0); |
536 RDEBUG("codeQueryNotifier 0", 0); |
534 RNotifier codeQueryNotifier; |
537 RNotifier codeQueryNotifier; |
535 User::LeaveIfError(codeQueryNotifier.Connect()); |
538 User::LeaveIfError(codeQueryNotifier.Connect()); |
536 CWait* wait = CWait::NewL(); |
539 CWait* wait = CWait::NewL(); |
537 CleanupStack::PushL(wait); |
540 CleanupStack::PushL(wait); |
538 TInt queryResponse = 0; |
541 TInt queryResponse = 0; // TODO will be changed by SecurityObserver |
539 TPckg<TInt> response(queryResponse); |
542 TPckg<TInt> response(queryResponse); |
540 RDEBUG("0", 0); |
543 RDEBUG("0", 0); |
541 TSecurityNotificationPckg params; |
544 TSecurityNotificationPckg params; |
542 params().iEvent = static_cast<TInt> (RMobilePhone::EPhonePasswordRequired); |
545 params().iEvent = static_cast<TInt> (0x100+RMobilePhone::EPhonePasswordRequired); |
543 params().iStartup = EFalse; |
546 params().iStartup = EFalse; |
|
547 RDEBUG("queryResponse", queryResponse); |
544 |
548 |
545 RDEBUG("StartNotifierAndGetResponse", 0); |
549 RDEBUG("StartNotifierAndGetResponse", 0); |
546 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); |
550 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); |
547 // this will eventually call PassPhraseRequiredL |
551 // this will eventually call PassPhraseRequiredL |
548 RDEBUG("WaitForRequestL", 0); |
552 RDEBUG("WaitForRequestL", 0); |
664 { |
668 { |
665 /***************************************************** |
669 /***************************************************** |
666 * Series 60 Customer / ETel |
670 * Series 60 Customer / ETel |
667 * Series 60 ETel API |
671 * Series 60 ETel API |
668 *****************************************************/ |
672 *****************************************************/ |
|
673 askPassPhraseRequiredL: |
669 RDEBUG("0", 0); |
674 RDEBUG("0", 0); |
670 TBool StartUp = iStartup; |
675 TBool StartUp = iStartup; |
671 |
676 |
672 RMobilePhone::TMobilePassword iSecUi_password; |
677 RMobilePhone::TMobilePassword iSecUi_password; |
|
678 iSecUi_password.Copy(_L("")); |
673 RMobilePhone::TMobilePassword required_fourth; |
679 RMobilePhone::TMobilePassword required_fourth; |
674 TInt queryAccepted = KErrCancel; |
680 TInt queryAccepted = KErrCancel; |
675 |
681 |
676 TInt autolockState = 0; |
682 TInt autolockState = 0; |
677 TInt lCancelSupported = 0; |
683 TInt lCancelSupported = 0; |
914 RDEBUG("tRet", tRet); |
920 RDEBUG("tRet", tRet); |
915 User::LeaveIfError(tRet); |
921 User::LeaveIfError(tRet); |
916 RDEBUG("scpClient.Connect", 1); |
922 RDEBUG("scpClient.Connect", 1); |
917 CleanupClosePushL(scpClient); |
923 CleanupClosePushL(scpClient); |
918 TSCPSecCode newCode; |
924 TSCPSecCode newCode; |
919 newCode.Copy(iSecUi_password); |
925 newCode.Copy(iSecUi_password); // this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10 |
920 RDEBUG( |
926 RDEBUG( |
921 "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", |
927 "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", |
922 0); |
928 0); |
923 scpClient.StoreCode(newCode); |
929 scpClient.StoreCode(newCode); |
924 RDEBUG("scpClient.StoreCode", 1); |
930 RDEBUG("scpClient.StoreCode", 1); |
1039 ; |
1045 ; |
1040 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
1046 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
1041 } |
1047 } |
1042 break; |
1048 break; |
1043 case KErrGsm0707IncorrectPassword: |
1049 case KErrGsm0707IncorrectPassword: |
|
1050 { |
1044 RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword); |
1051 RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword); |
|
1052 // The Settings caller might retry |
|
1053 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1054 if(StartUp) |
|
1055 goto askPassPhraseRequiredL; |
|
1056 } |
|
1057 break; |
1045 // and continue |
1058 // and continue |
1046 case KErrAccessDenied: |
1059 case KErrAccessDenied: |
1047 { |
1060 { |
1048 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
1061 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
1049 // The Settings caller might retry |
1062 // The Settings caller might retry |
1253 { |
1266 { |
1254 /***************************************************** |
1267 /***************************************************** |
1255 * Series 60 Customer / ETel |
1268 * Series 60 Customer / ETel |
1256 * Series 60 ETel API |
1269 * Series 60 ETel API |
1257 *****************************************************/ |
1270 *****************************************************/ |
|
1271 askPuk1RequiredL: |
1258 RDEBUG("0", 0); |
1272 RDEBUG("0", 0); |
1259 TInt queryAccepted = KErrCancel; |
1273 TInt queryAccepted = KErrCancel; |
1260 RMobilePhone::TMobilePassword puk1_password; |
1274 RMobilePhone::TMobilePassword puk1_password; |
1261 RMobilePhone::TMobilePassword aNewPinPassword; |
1275 RMobilePhone::TMobilePassword aNewPinPassword; |
1262 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1276 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1354 break; |
1368 break; |
1355 case KErrGsm0707IncorrectPassword: |
1369 case KErrGsm0707IncorrectPassword: |
1356 case KErrAccessDenied: |
1370 case KErrAccessDenied: |
1357 // wrong PUK code -> note -> ask PUK code again |
1371 // wrong PUK code -> note -> ask PUK code again |
1358 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1372 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1359 returnValue = Puk1RequiredL(); |
1373 RDEBUG("goto askPuk1RequiredL", 0); |
1360 break; |
1374 goto askPuk1RequiredL; |
|
1375 // break; |
1361 case KErrGsm0707SimWrong: |
1376 case KErrGsm0707SimWrong: |
1362 // sim lock active |
1377 // sim lock active |
1363 // no message ? |
1378 // no message ? |
1364 break; |
1379 break; |
1365 case KErrGsmSSPasswordAttemptsViolation: |
1380 case KErrGsmSSPasswordAttemptsViolation: |
1366 case KErrLocked: |
1381 case KErrLocked: |
1367 // sim card rejected. |
1382 // sim card rejected. |
1368 break; |
1383 break; |
1369 default: |
1384 default: |
1370 CSecuritySettings::ShowErrorNoteL(res); |
1385 CSecuritySettings::ShowErrorNoteL(res); |
1371 returnValue = Puk1RequiredL(); |
1386 RDEBUG("goto askPuk1RequiredL", 0); |
1372 break; |
1387 goto askPuk1RequiredL; |
|
1388 // break; |
1373 } |
1389 } |
1374 |
1390 |
1375 // Now the PUK1 is validated. It's time for asking the new PIN1 |
1391 // Now the PUK1 is validated. It's time for asking the new PIN1 |
1376 RDEBUG("new wait", 0); |
1392 RDEBUG("new wait", 0); |
1377 wait = CWait::NewL(); |
1393 wait = CWait::NewL(); |
1390 CleanupStack::PopAndDestroy(stringHolder); |
1406 CleanupStack::PopAndDestroy(stringHolder); |
1391 title.Append(_L("|")); |
1407 title.Append(_L("|")); |
1392 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); |
1408 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); |
1393 title.Append(stringHolder2->Des()); |
1409 title.Append(stringHolder2->Des()); |
1394 CleanupStack::PopAndDestroy(stringHolder2); |
1410 CleanupStack::PopAndDestroy(stringHolder2); |
1395 lSecUiCancelSupported = ESecUiCancelSupported; |
1411 lSecUiCancelSupported = ESecUiCancelNotSupported; // initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm" |
|
1412 // Somehow both scenarios make sense: User should not cancel because the code has been already changed to PUK. |
|
1413 // On the other hand, this happened because user forgot the PIN. Now you know it: same as PUK. So user can cancel. |
1396 RDEBUG("StartUp", 0); |
1414 RDEBUG("StartUp", 0); |
1397 if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? |
1415 if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? |
1398 { |
1416 { |
1399 lSecUiCancelSupported = ESecUiCancelNotSupported; |
1417 lSecUiCancelSupported = ESecUiCancelNotSupported; |
1400 } |
1418 } |
1413 return KErrCancel; |
1431 return KErrCancel; |
1414 } |
1432 } |
1415 |
1433 |
1416 // send code again, now with the user pin |
1434 // send code again, now with the user pin |
1417 RDEBUG("VerifySecurityCode", 0); |
1435 RDEBUG("VerifySecurityCode", 0); |
1418 iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); |
1436 iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); // TODO why not ChangeSecurityCode ? |
1419 RDEBUG("WaitForRequestL", 0); |
1437 RDEBUG("WaitForRequestL", 0); |
1420 res = wait->WaitForRequestL(); |
1438 res = wait->WaitForRequestL(); |
1421 RDEBUG("WaitForRequestL res", res); |
1439 RDEBUG("WaitForRequestL res", res); |
1422 CleanupStack::PopAndDestroy(wait); |
1440 CleanupStack::PopAndDestroy(wait); |
1423 |
1441 |
|
1442 // this can't fail, because PUK1 was just verified |
1424 returnValue = res; |
1443 returnValue = res; |
1425 switch (res) |
1444 switch (res) |
1426 { |
1445 { |
1427 case KErrNone: |
1446 case KErrNone: |
1428 // code approved -> note |
1447 // code approved -> note |
1555 { |
1574 { |
1556 /***************************************************** |
1575 /***************************************************** |
1557 * Series 60 Customer / ETel |
1576 * Series 60 Customer / ETel |
1558 * Series 60 ETel API |
1577 * Series 60 ETel API |
1559 *****************************************************/ |
1578 *****************************************************/ |
|
1579 askPuk2RequiredL: |
1560 RDEBUG("0", 0); |
1580 RDEBUG("0", 0); |
1561 TInt queryAccepted = KErrCancel; |
1581 TInt queryAccepted = KErrCancel; |
1562 RMobilePhone::TMobilePassword iSecUi_password; |
1582 RMobilePhone::TMobilePassword iSecUi_password; |
1563 RMobilePhone::TMobilePassword aNewPassword; |
1583 RMobilePhone::TMobilePassword aNewPassword; |
1564 RMobilePhone::TMobilePassword verifcationPassword; |
1584 RMobilePhone::TMobilePassword verifcationPassword; |
1634 break; |
1654 break; |
1635 case KErrGsm0707IncorrectPassword: |
1655 case KErrGsm0707IncorrectPassword: |
1636 case KErrAccessDenied: |
1656 case KErrAccessDenied: |
1637 // wrong PUK2 code -> note -> ask PUK2 code again |
1657 // wrong PUK2 code -> note -> ask PUK2 code again |
1638 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1658 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1639 Puk2RequiredL(); |
1659 RDEBUG("goto askPuk2RequiredL", 0); |
1640 break; |
1660 goto askPuk2RequiredL; |
|
1661 // break; |
1641 case KErrGsmSSPasswordAttemptsViolation: |
1662 case KErrGsmSSPasswordAttemptsViolation: |
1642 case KErrLocked: |
1663 case KErrLocked: |
1643 // Pin2 features blocked permanently! |
1664 // Pin2 features blocked permanently! |
1644 CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
1665 CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
1645 break; |
1666 break; |
1646 default: |
1667 default: |
1647 CSecuritySettings::ShowErrorNoteL(res); |
1668 CSecuritySettings::ShowErrorNoteL(res); |
1648 Puk2RequiredL(); |
1669 RDEBUG("goto askPuk2RequiredL", 0); |
1649 break; |
1670 goto askPuk2RequiredL; |
|
1671 // break; |
1650 } |
1672 } |
1651 |
1673 |
1652 // now the PUK2 is valid. Time to get the new PIN2 |
1674 // now the PUK2 is valid. Time to get the new PIN2 |
1653 wait = CWait::NewL(); |
1675 wait = CWait::NewL(); |
1654 CleanupStack::PushL(wait); |
1676 CleanupStack::PushL(wait); |
1691 RDEBUG("WaitForRequestL", 0); |
1713 RDEBUG("WaitForRequestL", 0); |
1692 res = wait->WaitForRequestL(); |
1714 res = wait->WaitForRequestL(); |
1693 RDEBUG("WaitForRequestL res", res); |
1715 RDEBUG("WaitForRequestL res", res); |
1694 CleanupStack::PopAndDestroy(wait); |
1716 CleanupStack::PopAndDestroy(wait); |
1695 |
1717 |
|
1718 // this can't fail, as PUK2 was just verified |
1696 switch (res) |
1719 switch (res) |
1697 { |
1720 { |
1698 case KErrNone: |
1721 case KErrNone: |
1699 // code approved -> note |
1722 // code approved -> note |
1700 CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
1723 CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |