91 if (iDestroyedPtr) |
91 if (iDestroyedPtr) |
92 { |
92 { |
93 *iDestroyedPtr = ETrue; |
93 *iDestroyedPtr = ETrue; |
94 iDestroyedPtr = NULL; |
94 iDestroyedPtr = NULL; |
95 } |
95 } |
96 CancelSecCodeQuery(); |
96 RDEBUG("calling CancelOpenQuery", 0); |
|
97 TInt err = CancelOpenQuery(-1); |
|
98 RDEBUG("err", err); |
97 iCustomPhone.Close(); |
99 iCustomPhone.Close(); |
98 FeatureManager::UnInitializeLib(); |
100 FeatureManager::UnInitializeLib(); |
|
101 RDEBUG("1", 1); |
99 } |
102 } |
100 // |
103 // |
101 // ---------------------------------------------------------- |
104 // ---------------------------------------------------------- |
102 // CSecurityHandler::HandleEventL() |
105 // CSecurityHandler::HandleEventL() |
103 // Handles different security events |
106 // Handles different security events |
246 |
248 |
247 /* request PIN using QT */ |
249 /* request PIN using QT */ |
248 CSecQueryUi *iSecQueryUi; |
250 CSecQueryUi *iSecQueryUi; |
249 RDEBUG("CSecQueryUi", 0); |
251 RDEBUG("CSecQueryUi", 0); |
250 iSecQueryUi = CSecQueryUi::NewL(); |
252 iSecQueryUi = CSecQueryUi::NewL(); |
|
253 iQueryCanceled = EFalse; |
251 lAlphaSupported = ESecUiAlphaSupported; |
254 lAlphaSupported = ESecUiAlphaSupported; |
252 lCancelSupported = ESecUiCancelSupported; |
255 lCancelSupported = ESecUiCancelSupported; |
253 TBuf<0x100> title; |
256 TBuf<0x100> title; |
254 title.Zero(); |
257 title.Zero(); |
255 title.Append(_L("AskSecCodeL")); |
258 title.Append(_L("AskSecCodeL")); |
262 | lAlphaSupported | lCancelSupported |
265 | lAlphaSupported | lCancelSupported |
263 | secCodeType ); |
266 | secCodeType ); |
264 RDEBUG("iSecUi_password", 0); |
267 RDEBUG("iSecUi_password", 0); |
265 RDebug::Print(iSecUi_password); |
268 RDebug::Print(iSecUi_password); |
266 RDEBUG("delete", 0); |
269 RDEBUG("delete", 0); |
|
270 iQueryCanceled = ETrue; |
267 delete iSecQueryUi; |
271 delete iSecQueryUi; |
268 RDEBUG("queryAccepted", queryAccepted); |
272 RDEBUG("queryAccepted", queryAccepted); |
269 /* end request PIN using QT */ |
273 /* end request PIN using QT */ |
270 if (queryAccepted != KErrNone) |
274 if (queryAccepted != KErrNone) |
271 { |
275 { |
343 iQueryCanceled = ETrue; |
347 iQueryCanceled = ETrue; |
344 return ret; |
348 return ret; |
345 } |
349 } |
346 // |
350 // |
347 // ---------------------------------------------------------- |
351 // ---------------------------------------------------------- |
|
352 // Cancels all security code queries |
|
353 // aStatus = -1 from destructor |
|
354 // aStatus = 1 from API. Will kill all dialogs through signal P&S |
|
355 // ---------------------------------------------------------- |
|
356 // qtdone |
|
357 TInt CSecurityHandler::CancelOpenQuery(TInt aStatus) |
|
358 { |
|
359 RDEBUG("aStatus", aStatus); |
|
360 RDEBUG("iQueryCanceled", iQueryCanceled); |
|
361 TInt res = 0; |
|
362 |
|
363 if(aStatus==1) // also signal all other dialogs |
|
364 { |
|
365 RDEBUG("set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", ESecurityUIsDismissDialogOn); |
|
366 TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn ); |
|
367 RDEBUG("err", err); |
|
368 res += 1; |
|
369 } |
|
370 |
|
371 if (!iQueryCanceled) |
|
372 { |
|
373 // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged |
|
374 // this will cancel only the dialog which was opened by same client. |
|
375 res += 0x10; |
|
376 iQueryCanceled = ETrue; |
|
377 if (iSecurityDlg != NULL) |
|
378 { |
|
379 RDEBUG("deleting iSecurityDlg", 0); |
|
380 res += 0x100; |
|
381 delete iSecurityDlg; |
|
382 } |
|
383 if (iNoteDlg != NULL) |
|
384 { |
|
385 RDEBUG("deleting iNoteDlg", 0); |
|
386 res += 0x1000; |
|
387 delete iNoteDlg; |
|
388 } |
|
389 iNoteDlg = NULL; |
|
390 iSecurityDlg = NULL; |
|
391 } |
|
392 res += 0x10000; |
|
393 RDEBUG("res", res); |
|
394 return res; |
|
395 } |
|
396 |
|
397 // |
|
398 // ---------------------------------------------------------- |
348 // CSecurityHandler::CancelSecCodeQuery() |
399 // CSecurityHandler::CancelSecCodeQuery() |
349 // Cancels PIN2 and security code queries |
400 // Cancels PIN2 and security code queries |
350 // this is used by rfsHandler |
401 // this is used by rfsHandler |
351 // ---------------------------------------------------------- |
402 // ---------------------------------------------------------- |
352 // qtdone |
403 // qtdone |
353 EXPORT_C void CSecurityHandler::CancelSecCodeQuery() |
404 EXPORT_C void CSecurityHandler::CancelSecCodeQuery() |
354 { |
405 { |
355 RDEBUG("0", 0); |
406 RDEBUG("0", 0); |
356 // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged |
407 |
357 TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn ); |
408 TInt err = CancelOpenQuery(1); |
358 RDEBUG("err", err); |
409 |
359 RDEBUG("iQueryCanceled", iQueryCanceled); |
410 RDEBUG("err", err); |
360 if (!iQueryCanceled) |
|
361 { |
|
362 iQueryCanceled = ETrue; |
|
363 if (iSecurityDlg != NULL) |
|
364 { |
|
365 delete iSecurityDlg; |
|
366 } |
|
367 if (iNoteDlg != NULL) |
|
368 { |
|
369 delete iNoteDlg; |
|
370 } |
|
371 iNoteDlg = NULL; |
|
372 iSecurityDlg = NULL; |
|
373 } |
|
374 } |
411 } |
375 // |
412 // |
376 // ---------------------------------------------------------- |
413 // ---------------------------------------------------------- |
377 // CSecurityHandler::AskSecCodeInAutoLock() |
414 // CSecurityHandler::AskSecCodeInAutoLock() |
378 // for asking security code in autolock |
415 // for asking security code in autolock |
542 case KErrAccessDenied: |
579 case KErrAccessDenied: |
543 { |
580 { |
544 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
581 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
545 return AskSecCodeInAutoLockL(); |
582 return AskSecCodeInAutoLockL(); |
546 } |
583 } |
|
584 case KErrInUse: |
|
585 { |
|
586 RDEBUG("KErrInUse", KErrInUse); |
|
587 return EFalse; |
|
588 } |
|
589 case KErrDied : |
|
590 { |
|
591 RDEBUG("KErrDied ", KErrDied ); |
|
592 return EFalse; |
|
593 } |
|
594 case KErrServerTerminated : |
|
595 { |
|
596 RDEBUG("KErrServerTerminated ", KErrServerTerminated ); |
|
597 return EFalse; |
|
598 } |
|
599 case KErrServerBusy : |
|
600 { |
|
601 RDEBUG("KErrServerBusy ", KErrServerBusy ); |
|
602 return EFalse; |
|
603 } |
547 case KErrAbort: |
604 case KErrAbort: |
|
605 { |
|
606 RDEBUG("KErrAbort", KErrAbort); |
|
607 return EFalse; |
|
608 } |
548 case KErrCancel: |
609 case KErrCancel: |
|
610 { |
|
611 RDEBUG("KErrCancel", KErrCancel); |
549 // user pressed "cancel" |
612 // user pressed "cancel" |
550 return EFalse; |
613 return EFalse; |
|
614 } |
551 default: |
615 default: |
552 { |
616 { |
553 RDEBUG("default", res); |
617 RDEBUG("default", res); |
554 return AskSecCodeInAutoLockL(); |
618 return AskSecCodeInAutoLockL(); |
555 } |
619 } |
635 lEmergencySupported = ESecUiEmergencyNotSupported; |
699 lEmergencySupported = ESecUiEmergencyNotSupported; |
636 } |
700 } |
637 |
701 |
638 CSecQueryUi *iSecQueryUi; |
702 CSecQueryUi *iSecQueryUi; |
639 iSecQueryUi = CSecQueryUi::NewL(); |
703 iSecQueryUi = CSecQueryUi::NewL(); |
|
704 iQueryCanceled = EFalse; |
640 TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported |
705 TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported |
641 | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; |
706 | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; |
642 RDEBUG("lType", lType); |
707 RDEBUG("lType", lType); |
643 queryAccepted = iSecQueryUi->SecQueryDialog(_L("PassPhraseRequiredL"), |
708 queryAccepted = iSecQueryUi->SecQueryDialog(_L("PassPhraseRequiredL"), |
644 iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, |
709 iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, |
645 SEC_C_SECURITY_CODE_MAX_LENGTH, lType); |
710 SEC_C_SECURITY_CODE_MAX_LENGTH, lType); |
646 RDEBUG("iSecUi_password", 0); |
711 RDEBUG("iSecUi_password", 0); |
647 RDebug::Print(iSecUi_password); |
712 RDebug::Print(iSecUi_password); |
648 RDEBUG("queryAccepted", queryAccepted); |
713 RDEBUG("queryAccepted", queryAccepted); |
|
714 iQueryCanceled = ETrue; |
649 delete iSecQueryUi; |
715 delete iSecQueryUi; |
650 |
716 |
651 TBool wasCancelledOrEmergency = EFalse; |
717 TBool wasCancelledOrEmergency = EFalse; |
652 RDEBUG("KFeatureIdSapDeviceLockEnhancements", |
718 RDEBUG("KFeatureIdSapDeviceLockEnhancements", |
653 KFeatureIdSapDeviceLockEnhancements); |
719 KFeatureIdSapDeviceLockEnhancements); |
904 if (err != KErrNone) |
970 if (err != KErrNone) |
905 { |
971 { |
906 RDEBUG("FAILED to get the SECUI query Flag err", err); |
972 RDEBUG("FAILED to get the SECUI query Flag err", err); |
907 } |
973 } |
908 } |
974 } |
909 RDEBUG("StartUp", StartUp); |
975 RDEBUG("err", err); |
910 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
976 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
911 RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); |
977 RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); |
912 RDEBUG("err", err); |
|
913 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
978 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
914 || (err != KErrNone)) |
979 || (err != KErrNone)) |
915 { |
980 { |
916 RDEBUG("0", 0); |
981 RDEBUG("0", 0); |
917 lCancelSupported = ESecUiCancelNotSupported; |
982 lCancelSupported = ESecUiCancelNotSupported; |
941 |
1006 |
942 /* request PIN using QT */ |
1007 /* request PIN using QT */ |
943 CSecQueryUi *iSecQueryUi; |
1008 CSecQueryUi *iSecQueryUi; |
944 RDEBUG("CSecQueryUi", 0); |
1009 RDEBUG("CSecQueryUi", 0); |
945 iSecQueryUi = CSecQueryUi::NewL(); |
1010 iSecQueryUi = CSecQueryUi::NewL(); |
|
1011 iQueryCanceled = EFalse; |
946 RDEBUG("SecQueryDialog", 1); |
1012 RDEBUG("SecQueryDialog", 1); |
947 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1013 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
948 // TODO also support Emergency |
|
949 lAlphaSupported = ESecUiAlphaNotSupported; |
1014 lAlphaSupported = ESecUiAlphaNotSupported; |
950 TBuf<0x100> title; |
1015 TBuf<0x100> title; |
951 title.Zero(); |
1016 title.Zero(); |
952 title.Append(_L("Pin1RequiredL")); |
1017 title.Append(_L("Pin1RequiredL")); |
953 title.Append(_L("#")); |
1018 title.Append(_L("#")); |
957 RDEBUG("amode", amode); |
1022 RDEBUG("amode", amode); |
958 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, |
1023 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, |
959 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode); |
1024 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode); |
960 RDEBUG("iSecUi_password", 0); |
1025 RDEBUG("iSecUi_password", 0); |
961 RDebug::Print(iSecUi_password); |
1026 RDebug::Print(iSecUi_password); |
|
1027 iQueryCanceled = ETrue; |
962 delete iSecQueryUi; |
1028 delete iSecQueryUi; |
963 RDEBUG("queryAccepted", queryAccepted); |
1029 RDEBUG("queryAccepted", queryAccepted); |
964 // TODO handle emergency |
|
965 /* end request PIN using QT */ |
1030 /* end request PIN using QT */ |
966 |
1031 |
967 if (queryAccepted == KErrAbort) // emergency call |
1032 if (queryAccepted == KErrAbort) // emergency call |
968 { |
1033 { |
969 RDEBUG("queryAccepted", queryAccepted); |
1034 RDEBUG("queryAccepted", queryAccepted); |
1013 } |
1078 } |
1014 break; |
1079 break; |
1015 case KErrGsmSSPasswordAttemptsViolation: |
1080 case KErrGsmSSPasswordAttemptsViolation: |
1016 case KErrLocked: |
1081 case KErrLocked: |
1017 // code blocked; show error note and terminate. |
1082 // code blocked; show error note and terminate. |
1018 // TODO what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp |
1083 // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp |
1019 if (StartUp) |
1084 if (StartUp) |
1020 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1085 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1021 CAknNoteDialog::EErrorTone); |
1086 CAknNoteDialog::EErrorTone); |
1022 break; |
1087 break; |
1023 case KErrGsm0707SimWrong: |
1088 case KErrGsm0707SimWrong: |
1024 // sim lock active |
1089 // sim lock active |
1025 // TODO no error? This is strange |
1090 // no error? This is strange |
1026 break; |
1091 break; |
1027 default: |
1092 default: |
1028 CSecuritySettings::ShowErrorNoteL(res); |
1093 CSecuritySettings::ShowErrorNoteL(res); |
1029 if (StartUp) |
1094 if (StartUp) |
1030 { |
1095 { |
1077 RDEBUG("WaitForRequestL", 0); |
1142 RDEBUG("WaitForRequestL", 0); |
1078 res = wait->WaitForRequestL(); |
1143 res = wait->WaitForRequestL(); |
1079 RDEBUG("WaitForRequestL res", res); |
1144 RDEBUG("WaitForRequestL res", res); |
1080 } |
1145 } |
1081 RDEBUG("res", res); |
1146 RDEBUG("res", res); |
1082 //If there's still an error we're doomed. Bail out. |
1147 // If there's still an error we're doomed. Bail out. |
1083 User::LeaveIfError(res); |
1148 User::LeaveIfError(res); |
1084 |
1149 |
1085 RDEBUG("StartUp", StartUp); |
1150 RDEBUG("StartUp", StartUp); |
1086 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1151 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1087 codeInfo.iRemainingEntryAttempts); |
1152 codeInfo.iRemainingEntryAttempts); |
1088 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1153 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1089 RDEBUG( "attempts", attempts ); |
1154 RDEBUG( "attempts", attempts ); |
1090 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1155 // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1091 if (!StartUp && (attempts |
1156 if (!StartUp && (attempts |
1092 == KMaxNumberOfPUKAttempts)) |
1157 == KMaxNumberOfPUKAttempts)) |
1093 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1158 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1094 CAknNoteDialog::EErrorTone); |
1159 CAknNoteDialog::EErrorTone); |
1095 |
1160 |
1097 attempts = -1; |
1162 attempts = -1; |
1098 |
1163 |
1099 CSecQueryUi *iSecQueryUi; |
1164 CSecQueryUi *iSecQueryUi; |
1100 RDEBUG("CSecQueryUi", 0); |
1165 RDEBUG("CSecQueryUi", 0); |
1101 iSecQueryUi = CSecQueryUi::NewL(); |
1166 iSecQueryUi = CSecQueryUi::NewL(); |
|
1167 iQueryCanceled = EFalse; |
1102 RDEBUG("SecQueryDialog", 1); |
1168 RDEBUG("SecQueryDialog", 1); |
1103 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1169 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1104 // TODO also support Emergency |
|
1105 TBuf<0x100> title; |
1170 TBuf<0x100> title; |
1106 title.Zero(); |
1171 title.Zero(); |
1107 title.Append(_L("Puk1RequiredL")); |
1172 title.Append(_L("Puk1RequiredL")); |
1108 title.Append(_L("#")); |
1173 title.Append(_L("#")); |
1109 title.AppendNum(attempts); |
1174 title.AppendNum(attempts); |
1110 TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; |
1175 TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; |
1111 if(StartUp) // TODO how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? |
1176 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) ??? |
1112 lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; |
1177 lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; |
1113 queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, |
1178 queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, |
1114 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1179 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1115 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1180 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1116 | lSecUiCancelSupported | ESecUiPukRequired); |
1181 | lSecUiCancelSupported | ESecUiPukRequired); |
1117 RDEBUG("puk1_password", 0); |
1182 RDEBUG("puk1_password", 0); |
1118 RDebug::Print(puk1_password); |
1183 RDebug::Print(puk1_password); |
|
1184 iQueryCanceled = ETrue; |
1119 delete iSecQueryUi; |
1185 delete iSecQueryUi; |
1120 RDEBUG("queryAccepted", queryAccepted); |
1186 RDEBUG("queryAccepted", queryAccepted); |
1121 |
1187 |
1122 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
1188 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
1123 { |
1189 { |
1171 { |
1237 { |
1172 // new-pin query |
1238 // new-pin query |
1173 CSecQueryUi * iSecQueryUi; |
1239 CSecQueryUi * iSecQueryUi; |
1174 RDEBUG("CSecQueryUi", 0); |
1240 RDEBUG("CSecQueryUi", 0); |
1175 iSecQueryUi = CSecQueryUi::NewL(); |
1241 iSecQueryUi = CSecQueryUi::NewL(); |
|
1242 iQueryCanceled = EFalse; |
1176 RDEBUG("SecQueryDialog", 1); |
1243 RDEBUG("SecQueryDialog", 1); |
1177 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
|
1178 // TODO also support Emergency |
|
1179 |
1244 |
1180 queryAccepted = iSecQueryUi->SecQueryDialog( |
1245 queryAccepted = iSecQueryUi->SecQueryDialog( |
1181 _L("PIN1-New|PIN1-Verif"), aNewPinPassword, |
1246 _L("PIN1-New|PIN1-Verif"), aNewPinPassword, |
1182 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, |
1247 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, |
1183 ESecUiAlphaNotSupported | ESecUiCancelSupported |
1248 ESecUiAlphaNotSupported | ESecUiCancelSupported |
1184 | ESecUiPukRequired); |
1249 | ESecUiPukRequired); |
1185 RDEBUG("aNewPinPassword", 0); |
1250 RDEBUG("aNewPinPassword", 0); |
1186 RDebug::Print(aNewPinPassword); |
1251 RDebug::Print(aNewPinPassword); |
|
1252 iQueryCanceled = ETrue; |
1187 delete iSecQueryUi; |
1253 delete iSecQueryUi; |
1188 RDEBUG("queryAccepted", queryAccepted); |
1254 RDEBUG("queryAccepted", queryAccepted); |
1189 } |
1255 } |
1190 |
1256 |
1191 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
1257 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
1266 RDEBUG("WaitForRequestL ret", ret); |
1332 RDEBUG("WaitForRequestL ret", ret); |
1267 User::LeaveIfError(ret); |
1333 User::LeaveIfError(ret); |
1268 |
1334 |
1269 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1335 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1270 codeInfo.iRemainingEntryAttempts); |
1336 codeInfo.iRemainingEntryAttempts); |
1271 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ? |
1337 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1272 codeInfo.iRemainingEntryAttempts = -1; |
1338 codeInfo.iRemainingEntryAttempts = -1; |
1273 |
1339 |
1274 /* request PIN using QT */ |
1340 /* request PIN using QT */ |
1275 CSecQueryUi *iSecQueryUi; |
1341 CSecQueryUi *iSecQueryUi; |
1276 RDEBUG("CSecQueryUi", 0); |
1342 RDEBUG("CSecQueryUi", 0); |
1277 iSecQueryUi = CSecQueryUi::NewL(); |
1343 iSecQueryUi = CSecQueryUi::NewL(); |
|
1344 iQueryCanceled = EFalse; |
1278 RDEBUG("SecQueryDialog", 1); |
1345 RDEBUG("SecQueryDialog", 1); |
1279 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt |
1346 // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt |
1280 // TODO also support Emergency |
|
1281 |
1347 |
1282 TBuf<0x100> title; |
1348 TBuf<0x100> title; |
1283 title.Zero(); |
1349 title.Zero(); |
1284 title.Append(_L("Pin2RequiredL")); |
1350 title.Append(_L("Pin2RequiredL")); |
1285 title.Append(_L("#")); |
1351 title.Append(_L("#")); |
1289 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1355 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1290 | ESecUiCancelSupported | secCodeType); |
1356 | ESecUiCancelSupported | secCodeType); |
1291 RDEBUG("iSecUi_password", 0); |
1357 RDEBUG("iSecUi_password", 0); |
1292 RDebug::Print(iSecUi_password); |
1358 RDebug::Print(iSecUi_password); |
1293 RDEBUG("queryAccepted", queryAccepted); |
1359 RDEBUG("queryAccepted", queryAccepted); |
|
1360 iQueryCanceled = ETrue; |
1294 delete iSecQueryUi; |
1361 delete iSecQueryUi; |
1295 |
1362 |
1296 // If failed or device became locked, any pending request should be cancelled. |
1363 // If failed or device became locked, any pending request should be cancelled. |
1297 if (queryAccepted != KErrNone) |
1364 if (queryAccepted != KErrNone) |
1298 { |
1365 { |
1370 |
1437 |
1371 /* request PIN using QT */ |
1438 /* request PIN using QT */ |
1372 CSecQueryUi *iSecQueryUi; |
1439 CSecQueryUi *iSecQueryUi; |
1373 RDEBUG("CSecQueryUi", 0); |
1440 RDEBUG("CSecQueryUi", 0); |
1374 iSecQueryUi = CSecQueryUi::NewL(); |
1441 iSecQueryUi = CSecQueryUi::NewL(); |
|
1442 iQueryCanceled = EFalse; |
1375 RDEBUG("SecQueryDialog", 1); |
1443 RDEBUG("SecQueryDialog", 1); |
1376 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1444 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1377 // TODO also support Emergency |
|
1378 |
1445 |
1379 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1446 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1380 codeInfo.iRemainingEntryAttempts); |
1447 codeInfo.iRemainingEntryAttempts); |
1381 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ? |
1448 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ? |
1382 codeInfo.iRemainingEntryAttempts = -1; |
1449 codeInfo.iRemainingEntryAttempts = -1; |
1390 SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, |
1457 SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, |
1391 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1458 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1392 | ESecUiCancelSupported | secCodeType ); |
1459 | ESecUiCancelSupported | secCodeType ); |
1393 RDEBUG("iSecUi_password", 0); |
1460 RDEBUG("iSecUi_password", 0); |
1394 RDebug::Print(iSecUi_password); |
1461 RDebug::Print(iSecUi_password); |
|
1462 iQueryCanceled = ETrue; |
1395 delete iSecQueryUi; |
1463 delete iSecQueryUi; |
1396 RDEBUG("queryAccepted", queryAccepted); |
1464 RDEBUG("queryAccepted", queryAccepted); |
1397 |
1465 |
1398 if (queryAccepted != KErrNone) |
1466 if (queryAccepted != KErrNone) |
1399 { |
1467 { |
1445 { |
1513 { |
1446 // new pin2 code query |
1514 // new pin2 code query |
1447 CSecQueryUi * iSecQueryUi; |
1515 CSecQueryUi * iSecQueryUi; |
1448 RDEBUG("CSecQueryUi", 0); |
1516 RDEBUG("CSecQueryUi", 0); |
1449 iSecQueryUi = CSecQueryUi::NewL(); |
1517 iSecQueryUi = CSecQueryUi::NewL(); |
1450 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1518 iQueryCanceled = EFalse; |
1451 // TODO also support Emergency |
1519 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1452 |
|
1453 queryAccepted |
1520 queryAccepted |
1454 = iSecQueryUi->SecQueryDialog(_L("PIN2-New|PIN2-Verif"), |
1521 = iSecQueryUi->SecQueryDialog(_L("PIN2-New|PIN2-Verif"), |
1455 aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, |
1522 aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, |
1456 SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported |
1523 SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported |
1457 | ESecUiCancelSupported | secCodeType); |
1524 | ESecUiCancelSupported | secCodeType); |
1458 RDEBUG("aNewPassword", 0); |
1525 RDEBUG("aNewPassword", 0); |
1459 RDebug::Print(aNewPassword); |
1526 RDebug::Print(aNewPassword); |
|
1527 iQueryCanceled = ETrue; |
1460 delete iSecQueryUi; |
1528 delete iSecQueryUi; |
1461 RDEBUG("queryAccepted", queryAccepted); |
1529 RDEBUG("queryAccepted", queryAccepted); |
1462 if (queryAccepted != KErrNone) |
1530 if (queryAccepted != KErrNone) |
1463 { |
1531 { |
1464 // cancel "get security unblock code" request |
1532 // cancel "get security unblock code" request |
1467 RDEBUG("AbortSecurityCode", 1); |
1535 RDEBUG("AbortSecurityCode", 1); |
1468 CleanupStack::PopAndDestroy(1); //wait |
1536 CleanupStack::PopAndDestroy(1); //wait |
1469 return; |
1537 return; |
1470 } |
1538 } |
1471 } |
1539 } |
1472 // send code |
1540 // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one |
1473 // TODO the current code should be verified before |
|
1474 RDEBUG("VerifySecurityCode", 0); |
1541 RDEBUG("VerifySecurityCode", 0); |
1475 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, |
1542 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, |
1476 iSecUi_password); |
1543 iSecUi_password); |
1477 RDEBUG("WaitForRequestL", 0); |
1544 RDEBUG("WaitForRequestL", 0); |
1478 res = wait->WaitForRequestL(); |
1545 res = wait->WaitForRequestL(); |
1561 |
1628 |
1562 /* request PIN using QT */ |
1629 /* request PIN using QT */ |
1563 CSecQueryUi *iSecQueryUi; |
1630 CSecQueryUi *iSecQueryUi; |
1564 RDEBUG("CSecQueryUi", 0); |
1631 RDEBUG("CSecQueryUi", 0); |
1565 iSecQueryUi = CSecQueryUi::NewL(); |
1632 iSecQueryUi = CSecQueryUi::NewL(); |
1566 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1633 iQueryCanceled = EFalse; |
|
1634 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1567 // TODO also support Emergency |
1635 // TODO also support Emergency |
1568 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
1636 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
1569 || (err != KErrNone)) |
1637 || (err != KErrNone)) |
1570 lCancelSupported = ESecUiCancelNotSupported; |
1638 lCancelSupported = ESecUiCancelNotSupported; |
1571 else |
1639 else |
1580 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, |
1648 SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, |
1581 ESecUiSecretSupported | ESecUiAlphaNotSupported |
1649 ESecUiSecretSupported | ESecUiAlphaNotSupported |
1582 | lCancelSupported | ESecUiCodeEtelReqest); |
1650 | lCancelSupported | ESecUiCodeEtelReqest); |
1583 RDEBUG("iSecUi_password", 0); |
1651 RDEBUG("iSecUi_password", 0); |
1584 RDebug::Print(iSecUi_password); |
1652 RDebug::Print(iSecUi_password); |
|
1653 iQueryCanceled = ETrue; |
1585 delete iSecQueryUi; |
1654 delete iSecQueryUi; |
1586 RDEBUG("queryAccepted", queryAccepted); |
1655 RDEBUG("queryAccepted", queryAccepted); |
1587 if (queryAccepted != KErrNone) |
1656 if (queryAccepted != KErrNone) |
1588 { |
1657 { |
1589 CleanupStack::PopAndDestroy(wait); |
1658 CleanupStack::PopAndDestroy(wait); |
1691 /* request PIN using QT */ |
1760 /* request PIN using QT */ |
1692 { |
1761 { |
1693 CSecQueryUi *iSecQueryUi; |
1762 CSecQueryUi *iSecQueryUi; |
1694 RDEBUG("CSecQueryUi", 0); |
1763 RDEBUG("CSecQueryUi", 0); |
1695 iSecQueryUi = CSecQueryUi::NewL(); |
1764 iSecQueryUi = CSecQueryUi::NewL(); |
|
1765 iQueryCanceled = EFalse; |
1696 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1766 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1697 // TODO also support Emergency |
1767 // TODO also support Emergency |
1698 |
1768 |
1699 TBuf<0x100> title; |
1769 TBuf<0x100> title; |
1700 title.Zero(); |
1770 title.Zero(); |
1705 iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, |
1775 iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, |
1706 SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported |
1776 SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported |
1707 | ESecUiCancelSupported | ESecUiPukRequired); |
1777 | ESecUiCancelSupported | ESecUiPukRequired); |
1708 RDEBUG("iSecUi_password", 0); |
1778 RDEBUG("iSecUi_password", 0); |
1709 RDebug::Print(iSecUi_password); |
1779 RDebug::Print(iSecUi_password); |
|
1780 iQueryCanceled = ETrue; |
1710 delete iSecQueryUi; |
1781 delete iSecQueryUi; |
1711 RDEBUG("queryAccepted", queryAccepted); |
1782 RDEBUG("queryAccepted", queryAccepted); |
1712 |
1783 |
1713 if (queryAccepted != KErrNone) |
1784 if (queryAccepted != KErrNone) |
1714 { |
1785 { |
1720 { |
1791 { |
1721 /* request PIN using QT */ |
1792 /* request PIN using QT */ |
1722 CSecQueryUi *iSecQueryUi; |
1793 CSecQueryUi *iSecQueryUi; |
1723 RDEBUG("CSecQueryUi", 0); |
1794 RDEBUG("CSecQueryUi", 0); |
1724 iSecQueryUi = CSecQueryUi::NewL(); |
1795 iSecQueryUi = CSecQueryUi::NewL(); |
|
1796 iQueryCanceled = EFalse; |
1725 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1797 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1726 // TODO also support Emergency |
1798 // TODO also support Emergency |
1727 |
1799 |
1728 queryAccepted = iSecQueryUi->SecQueryDialog(_L( |
1800 queryAccepted = iSecQueryUi->SecQueryDialog(_L( |
1729 "UPuk-New|UPuk-Verif"), aNewPassword, |
1801 "UPuk-New|UPuk-Verif"), aNewPassword, |
1730 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1802 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1731 ESecUiAlphaNotSupported | ESecUiCancelSupported |
1803 ESecUiAlphaNotSupported | ESecUiCancelSupported |
1732 | ESecUiPukRequired); |
1804 | ESecUiPukRequired); |
1733 RDEBUG("aNewPassword", 0); |
1805 RDEBUG("aNewPassword", 0); |
1734 RDebug::Print(aNewPassword); |
1806 RDebug::Print(aNewPassword); |
|
1807 iQueryCanceled = ETrue; |
1735 delete iSecQueryUi; |
1808 delete iSecQueryUi; |
1736 RDEBUG("queryAccepted", queryAccepted); |
1809 RDEBUG("queryAccepted", queryAccepted); |
1737 if (queryAccepted != KErrNone) |
1810 if (queryAccepted != KErrNone) |
1738 { |
1811 { |
1739 CleanupStack::PopAndDestroy(wait); |
1812 CleanupStack::PopAndDestroy(wait); |