650 // Status : Approved |
652 // Status : Approved |
651 // --------------------------------------------------------- |
653 // --------------------------------------------------------- |
652 // |
654 // |
653 void CSCPServer::ValidateConfigurationL( TInt aMode ) |
655 void CSCPServer::ValidateConfigurationL( TInt aMode ) |
654 { |
656 { |
655 if (aMode == KSCPInitial) { |
657 Dprint( (_L("--> CSCPServer::ValidateConfigurationL()") )); |
656 // Return here, must be checked by complete mode |
658 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()")); |
657 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@@aMode == KSCPInitial ")); |
659 TInt startupReason(ENormalStartup); |
658 User::Leave(KErrAccessDenied); |
660 RProperty::Get(KPSUidStartup, KPSStartupReason, startupReason); |
659 } |
661 Dprint( (_L("CSCPServer::ValidateConfigurationL(): startupReason = %d"), startupReason)); |
660 |
662 if((startupReason == ENormalRFSReset)||(startupReason == EDeepRFSReset)||(startupReason == EFirmwareUpdate)||(iConfiguration.iConfigFlag == KSCPConfigUnknown)) |
661 RMobilePhone::TMobilePassword storedCode; |
663 { |
|
664 |
|
665 RMobilePhone::TMobilePassword storedCode; |
662 storedCode.Zero(); |
666 storedCode.Zero(); |
663 User::LeaveIfError(GetCode(storedCode)); |
667 User::LeaveIfError(GetCode(storedCode)); |
664 TBool isDefaultLockcode = ETrue; |
668 |
665 TInt err = KErrNone; |
669 |
666 |
670 Dprint( (_L("CSCPServer::ValidateConfigurationL(): Checking code: %s"), storedCode.PtrZ() )); |
667 RMobilePhone::TMobilePassword defaultLockcode; |
671 // Check that the ISA code is stored correctly |
668 defaultLockcode.Zero(); |
672 TRAPD( err, CheckISACodeL( storedCode ) ); |
669 defaultLockcode.Copy(KSCPDefaultSecCode); |
673 //Bool for the correction of Defaultlockcode cenrep |
670 if (storedCode.Compare(KSCPDefaultSecCode) == 0) { |
674 TBool lCorrectDefaultlockcode = EFalse; |
671 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@config has KSCPDefaultSecCode ")); |
675 |
672 TRAP( err, CheckISACodeL( defaultLockcode ) ); |
676 Dprint( (_L("CSCPServer::ValidateConfigurationL(): iConfigFlag = %d, iConfigChecked = %d"), iConfiguration.iConfigFlag, iConfiguration.iConfigChecked)); |
673 if (err == KErrNone) { |
677 |
674 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@ISA also has KSCPDefaultSecCode ")); |
678 if ((iConfiguration.iConfigFlag == KSCPConfigOK) |
675 iConfiguration.iConfigFlag = KSCPConfigOK; |
679 && (iConfiguration.iConfigChecked) && (err == KErrNone)) |
676 isDefaultLockcode = ETrue; |
680 { |
677 } |
681 // The configuration has already been checked, exit |
678 else { |
682 Dprint( (_L("CSCPServer::ValidateConfigurationL(): Configuration is non-default.") )); |
679 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@ISA doesn't has KSCPDefaultSecCode ")); |
683 User::Leave( KErrNone ); |
680 iConfiguration.iConfigFlag = KSCPConfigInvalid; |
684 } |
681 iConfiguration.iFailedAttempts++; |
685 else if ( aMode == KSCPInitial ) |
682 isDefaultLockcode = EFalse; |
686 { |
683 } |
687 // Return here, must be checked by complete mode |
684 } |
688 User::Leave( KErrAccessDenied ); |
685 else { |
689 } |
686 RDebug::Print(_L("CSCPServer::CheckISACodeL(): config lock code %s"), storedCode.PtrZ()); |
690 |
687 TRAP( err, CheckISACodeL( storedCode ) ); |
691 |
688 if (err == KErrNone) { |
692 TInt hashedISAcode; |
689 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@ISA and config are in SYNC !! ")); |
693 TSCPSecCode hashedCode; |
690 iConfiguration.iConfigFlag = KSCPConfigOK; |
694 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS |
691 isDefaultLockcode = EFalse; |
695 if(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
692 } |
696 { |
693 else { |
697 /*TInt*/ hashedISAcode = HashISACode( iConfiguration.iEnhSecCode ); |
694 iConfiguration.iSecCode.Zero(); |
698 // TSCPSecCode hashedCode; |
695 iConfiguration.iSecCode.Append(KSCPDefaultSecCode); |
699 hashedCode.Zero(); |
696 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@May be ISA has KSCPDefaultSecCode ")); |
700 hashedCode.AppendNum( hashedISAcode ); |
697 TRAP(err,ChangeISACodeL(storedCode)); |
701 } |
698 if (err == KErrNone) { |
702 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
699 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()chnaged ISA code with config value ")); |
703 |
|
704 |
|
705 |
|
706 |
|
707 if (err != KErrNone) |
|
708 { |
|
709 lCorrectDefaultlockcode = ETrue; |
|
710 } |
|
711 if ( err == KErrNone ) |
|
712 { |
|
713 iConfiguration.iConfigFlag = KSCPConfigOK; |
|
714 } |
|
715 else if ( err == KErrAccessDenied ) |
|
716 { |
|
717 iConfiguration.iConfigFlag = KSCPConfigInvalid; |
|
718 } |
|
719 else if ( err == KErrLocked ) |
|
720 { |
|
721 Dprint( (_L("CSCPServer::ValidateConfigurationL(): ISA code locked.") )); |
|
722 } |
|
723 else |
|
724 { |
|
725 Dprint( (_L("CSCPServer::ValidateConfigurationL(): ERROR in validation.") )); |
|
726 } |
|
727 |
|
728 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
729 if(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
730 { |
|
731 if ( err == KErrNone ) |
|
732 { |
|
733 // Check that the codes are in-sync with each other. Especially the default ISA code must |
|
734 // be changed according to the default enhanced code. |
|
735 if ( storedCode.Compare( hashedCode ) != 0 ) |
|
736 { |
|
737 Dprint( (_L("CSCPServer::ValidateConfigurationL(): Correct ISA code stored.\ |
|
738 Changing ISA code to match enhanced code => %d"), hashedISAcode )); |
|
739 |
|
740 storedCode.Copy( hashedCode ); |
|
741 // Change the ISA code to match the hashed code |
|
742 ChangeISACodeL( storedCode ); |
|
743 } |
|
744 } |
|
745 else if ( ( err == KErrAccessDenied ) && ( storedCode.Compare( hashedCode ) != 0 ) ) |
|
746 { |
|
747 // Try again with the hashed code |
|
748 TRAP( err, CheckISACodeL( hashedCode ) ); |
|
749 |
|
750 if ( err == KErrNone ) |
|
751 { |
|
752 Dprint( (_L("CSCPServer::ValidateConfigurationL(): Hashed code is correct.\ |
|
753 Storing hashed code(%d)"), hashedISAcode )); |
|
754 |
|
755 if ( StoreCode( hashedCode ) == KErrNone ) |
|
756 { |
700 iConfiguration.iConfigFlag = KSCPConfigOK; |
757 iConfiguration.iConfigFlag = KSCPConfigOK; |
701 isDefaultLockcode = EFalse; |
758 lCorrectDefaultlockcode = ETrue; |
702 } |
759 } |
703 else |
760 } |
704 { |
761 } |
705 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()it shouldn't reach this :( ")); |
762 |
706 } |
763 //If Correction of Defaultlockcode cenrep is required for the mismatch between Config and ISA |
707 } |
764 if (lCorrectDefaultlockcode) |
708 } |
765 { |
709 |
766 TInt lDefCode = -1; |
710 CRepository* repository = CRepository::NewL(KCRUidSCPLockCode); |
767 CRepository* lRepository = CRepository::NewL(KCRUidSCPLockCode); |
711 CleanupStack::PushL(repository); |
768 CleanupStack::PushL(lRepository); |
712 if (isDefaultLockcode ) { |
769 TInt lRet = lRepository->Get(KSCPLockCodeDefaultLockCode, |
713 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()setting def. lockcode to 12345 ")); |
770 lDefCode); |
714 repository->Set(KSCPLockCodeDefaultLockCode, 12345); |
771 if (lRet == KErrNone && lDefCode != -1) |
715 } |
772 { |
716 else { |
773 if (lDefCode == 12345) |
717 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()setting def. lockcode to 0 ")); |
774 { |
718 repository->Set(KSCPLockCodeDefaultLockCode, 0); |
775 //Although lock code is already set, due to some unexpected condition |
719 } |
776 //like C drive wipe, cenrep status is wrongly shown. Correcting it here. |
720 CleanupStack::PopAndDestroy(repository); |
777 lRepository->Set(KSCPLockCodeDefaultLockCode, 0); |
721 |
778 Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 0") )); |
722 TRAP( err, iConfiguration.WriteSetupL() ); |
779 } |
723 if (err != KErrNone) { |
780 else if (lDefCode == 0) |
|
781 { |
|
782 //If only ISA side is formatted, then the lock code on ISA side is default; |
|
783 //Cenrep status remains wrongly as the lock code is already set. Correcting it here. |
|
784 lRepository->Set(KSCPLockCodeDefaultLockCode, 12345); |
|
785 Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 12345") )); |
|
786 } |
|
787 } |
|
788 CleanupStack::PopAndDestroy(lRepository); |
|
789 } |
|
790 } |
|
791 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
792 //Set the flag to True, after config is validated |
|
793 iConfiguration.iConfigChecked = ETrue; |
|
794 |
|
795 TRAPD( err2, iConfiguration.WriteSetupL() ); |
|
796 if ( err2 != KErrNone ) |
|
797 { |
724 Dprint( (_L("CSCPServer::ValidateConfigurationL(): WARNING: failed to write configuration\ |
798 Dprint( (_L("CSCPServer::ValidateConfigurationL(): WARNING: failed to write configuration\ |
725 : %d"), err )); |
799 : %d"), err2 )); |
726 } |
800 } |
727 |
801 |
728 if (iConfiguration.iConfigFlag == KSCPConfigOK) { |
802 User::LeaveIfError( err ); |
729 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@iConfigFlag == KSCPConfigOK ")); |
803 } |
730 err = KErrNone; |
804 Dprint( (_L("<-- CSCPServer::ValidateConfigurationL()") )); |
731 } |
805 } |
732 else { |
|
733 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()@iConfigFlag == KErrAccessDenied ")); |
|
734 err = KErrAccessDenied; |
|
735 } |
|
736 |
|
737 User::LeaveIfError(err); |
|
738 } |
|
739 |
|
740 |
806 |
741 |
807 |
742 |
808 |
743 |
809 |
744 // --------------------------------------------------------- |
810 // --------------------------------------------------------- |
794 Dprint( (_L("CSCPServer::CheckISACodeL(): ISA code NOT OK") )); |
857 Dprint( (_L("CSCPServer::CheckISACodeL(): ISA code NOT OK") )); |
795 if (iConfiguration.iBlockedInOOS == 1) |
858 if (iConfiguration.iBlockedInOOS == 1) |
796 { |
859 { |
797 iConfiguration.iBlockedInOOS = 0; |
860 iConfiguration.iBlockedInOOS = 0; |
798 Dprint( (_L("CSCPServer::CheckISACodeL():iBlockedInOOS = 0, KErrAccessDenied") )); |
861 Dprint( (_L("CSCPServer::CheckISACodeL():iBlockedInOOS = 0, KErrAccessDenied") )); |
799 RDebug::Print(_L("--> CSCPServer::CheckISACodeL()@@iBlockedInOOS = 0, KErrAccessDenie")); |
|
800 } |
862 } |
801 ret = KErrAccessDenied; |
863 ret = KErrAccessDenied; |
802 } |
864 } |
803 else if ( ( ret == KErrGsmSSPasswordAttemptsViolation ) || ( ret == KErrLocked ) ) |
865 else if ( ( ret == KErrGsmSSPasswordAttemptsViolation ) || ( ret == KErrLocked ) ) |
804 { |
866 { |
805 Dprint( (_L("CSCPServer::CheckISACodeL(): ISA code BLOCKED") )); |
867 Dprint( (_L("CSCPServer::CheckISACodeL(): ISA code BLOCKED") )); |
806 if (ret==KErrGsmSSPasswordAttemptsViolation) |
868 if (ret==KErrGsmSSPasswordAttemptsViolation) |
807 { |
869 { |
808 Dprint( (_L("CSCPServer::CheckISACodeL(): KErrGsmSSPasswordAttemptsViolation") )); |
870 Dprint( (_L("CSCPServer::CheckISACodeL(): KErrGsmSSPasswordAttemptsViolation") )); |
809 RDebug::Print(_L("--> CSCPServer::CheckISACodeL()@@KErrGsmSSPasswordAttemptsViolation")); |
|
810 } |
871 } |
811 else |
872 else |
812 { |
873 { |
813 Dprint( (_L("CSCPServer::CheckISACodeL(): KErrLocked") )); |
874 Dprint( (_L("CSCPServer::CheckISACodeL(): KErrLocked") )); |
814 RDebug::Print(_L("--> CSCPServer::CheckISACodeL()@@KErrLocked")); |
|
815 } |
875 } |
816 ret = KErrLocked; |
876 ret = KErrLocked; |
817 if (iConfiguration.iBlockedInOOS == 0) |
877 if (iConfiguration.iBlockedInOOS == 0) |
818 { |
878 { |
819 iConfiguration.iBlockedInOOS = 1; |
879 iConfiguration.iBlockedInOOS = 1; |
820 Dprint( (_L("CSCPServer::CheckISACodeL():iBlockedInOOS = 1, KSCPErrCodeBlockStarted") )); |
880 Dprint( (_L("CSCPServer::CheckISACodeL():iBlockedInOOS = 1, KSCPErrCodeBlockStarted") )); |
821 RDebug::Print(_L("--> CSCPServer::CheckISACodeL()@@@@@")); |
|
822 ret = KSCPErrCodeBlockStarted; |
881 ret = KSCPErrCodeBlockStarted; |
823 } |
882 } |
824 } |
883 } |
825 else |
884 else |
826 { |
885 { |
827 Dprint( (_L("CSCPServer::CheckISACodeL(): ERROR reply checking ISA code: %d"), |
886 Dprint( (_L("CSCPServer::CheckISACodeL(): ERROR reply checking ISA code: %d"), |
828 status.Int() )); |
887 status.Int() )); |
829 RDebug::Print(_L("--> CSCPServer::ValidateConfigurationL()")); |
|
830 } |
888 } |
831 } |
889 } |
832 TRAPD( err, iConfiguration.WriteSetupL() ); |
890 TRAPD( err, iConfiguration.WriteSetupL() ); |
833 if ( err != KErrNone ) |
891 if ( err != KErrNone ) |
834 { |
892 { |
1278 #endif // __SCP_DEBUG |
1335 #endif // __SCP_DEBUG |
1279 |
1336 |
1280 TInt lRetStatus(KErrNone); |
1337 TInt lRetStatus(KErrNone); |
1281 Dprint(_L("[CSCPServer]-> Initiating branching on parameter...")); |
1338 Dprint(_L("[CSCPServer]-> Initiating branching on parameter...")); |
1282 |
1339 |
1283 switch(aID) { |
1340 switch ( aID ) |
1284 case ESCPAutolockPeriod: |
1341 { |
1285 case ESCPMaxAutolockPeriod: { |
1342 case ( ESCPAutolockPeriod ): |
|
1343 // Flow through |
|
1344 case ( ESCPMaxAutolockPeriod ): |
|
1345 { |
1286 // Convert the value, and set it |
1346 // Convert the value, and set it |
1287 TInt value; |
1347 TInt value; |
1288 TLex lex(aValue); |
1348 TLex lex(aValue); |
1289 lRetStatus = lex.Val(value); |
1349 lRetStatus = lex.Val(value); |
|
1350 |
1290 |
1351 |
1291 if((lRetStatus != KErrNone ) || ( value < 0) || ( value > KSCPAutolockPeriodMaximum )) { |
1352 if((lRetStatus != KErrNone ) || ( value < 0) || ( value > KSCPAutolockPeriodMaximum )) { |
1292 lRetStatus = KErrArgument; |
1353 lRetStatus = KErrArgument; |
1293 break; |
1354 break; |
1294 } |
1355 } |
1295 |
1356 |
1296 //Check if the device memory is encrypted or not. |
1357 //Check if the device memory is encrypted or not. |
1297 TBool encryptionEnabled = IsDeviceMemoryEncrypted(); |
1358 TBool encryptionEnabled = IsDeviceMemoryEncrypted(); |
1298 CSCPParamDBController* lParamDB = CSCPParamDBController :: NewLC(); |
|
1299 |
1359 |
1300 // Value OK |
1360 // Value OK |
1301 if(aID == ESCPMaxAutolockPeriod) { |
1361 if(aID == ESCPMaxAutolockPeriod) |
1302 if( encryptionEnabled ) { |
1362 { |
1303 Dprint(_L("[CSCPServer]-> Memory is encrypted")); |
1363 if ( encryptionEnabled ) |
|
1364 { |
|
1365 Dprint(_L("Memory is encrypted")); |
|
1366 if (( 0 == value) || value > KMaxAutolockPeriod) |
|
1367 { |
|
1368 Dprint((_L("Denying setting of max auto lock as value is %d"), value)); |
|
1369 User::Leave( KErrPermissionDenied ); |
|
1370 } |
|
1371 |
|
1372 } |
|
1373 else |
|
1374 { |
|
1375 Dprint(_L("Memory is decrypted, hence no restrictions to max autolock")); |
|
1376 } |
1304 |
1377 |
1305 if(( 0 == value) || value > KMaxAutolockPeriod) { |
1378 Dprint(_L("[CSCPServer]-> Branched to ESCPMaxAutolockPeriod...")); |
1306 Dprint((_L("[CSCPServer]-> Denying setting of max auto lock as value is %d"), value)); |
1379 CSCPParamDBController* lParamDB = CSCPParamDBController :: NewLC(); |
1307 User :: Leave( KErrPermissionDenied ); |
|
1308 } |
|
1309 } |
|
1310 else { |
|
1311 Dprint(_L("Memory is decrypted, hence no restrictions to max autolock")); |
|
1312 } |
|
1313 |
|
1314 Dprint(_L("[CSCPServer]-> Branched to ESCPMaxAutolockPeriod...")); |
|
1315 lRetStatus = SetBestPolicyL(RTerminalControl3rdPartySession :: EMaxTimeout, aValue, aCallerIdentity, lParamDB); |
1380 lRetStatus = SetBestPolicyL(RTerminalControl3rdPartySession :: EMaxTimeout, aValue, aCallerIdentity, lParamDB); |
1316 |
1381 |
1317 if(lRetStatus == KErrNone) { |
1382 if(lRetStatus == KErrNone) |
|
1383 { |
1318 // Do we have to change the Autolock period as well? |
1384 // Do we have to change the Autolock period as well? |
1319 TInt currentALperiod; |
1385 TInt currentALperiod; |
1320 lRetStatus = GetAutolockPeriodL(currentALperiod); |
1386 lRetStatus = GetAutolockPeriodL(currentALperiod); |
1321 |
1387 |
1322 if(lRetStatus == KErrNone) { |
1388 if(lRetStatus == KErrNone) |
1323 if( (iConfiguration.iMaxTimeout > 0) && |
1389 { |
1324 ((iConfiguration.iMaxTimeout < currentALperiod) || |
1390 if((iConfiguration.iMaxTimeout > 0) && ((iConfiguration.iMaxTimeout < currentALperiod) || (currentALperiod == 0))) |
1325 (currentALperiod == 0))) { |
1391 { |
1326 |
|
1327 Dprint((_L("[CSCPServer]-> Changing AL period to Max. AL period (Current ALP: %d, Max. ALP: %d)"), currentALperiod, value)); |
1392 Dprint((_L("[CSCPServer]-> Changing AL period to Max. AL period (Current ALP: %d, Max. ALP: %d)"), currentALperiod, value)); |
1328 //lRetStatus = SetAutolockPeriodL(value); |
1393 lRetStatus = SetAutolockPeriodL(value); |
1329 /* |
|
1330 * Call to SetBestPolicyL will not check for Stronger/Weaker. The value of ETimeout just gets stored in |
|
1331 * both the internal DB and the CenRep |
|
1332 */ |
|
1333 lRetStatus = SetBestPolicyL(RTerminalControl3rdPartySession :: ETimeout, aValue, aCallerIdentity, lParamDB); |
|
1334 } |
1394 } |
1335 } |
1395 } |
1336 else { |
1396 else |
|
1397 { |
1337 Dprint((_L("[CSCPServer]-> ERROR: Couldn't get the Autolock period: %d"), lRetStatus)); |
1398 Dprint((_L("[CSCPServer]-> ERROR: Couldn't get the Autolock period: %d"), lRetStatus)); |
1338 } |
1399 } |
1339 } |
1400 } |
1340 } |
1401 |
1341 // Autolock Period |
1402 CleanupStack :: PopAndDestroy(); //lParamDB |
1342 else { |
1403 } |
1343 //Code is commented as it is already taken care by the below condition #1343 irrespective of the drive encryption state. |
1404 |
1344 /* if ( 0 == value ) { |
1405 else |
1345 if(encryptionEnabled) { |
1406 { // Autolock Period |
|
1407 |
|
1408 //Code is commented as it is already taken care by the below condition #1343 irrespective of the drive encryption state. |
|
1409 /* if ( 0 == value ) |
|
1410 { |
|
1411 if ( encryptionEnabled ) |
|
1412 { |
1346 Dprint(_L("Permission denied!")); |
1413 Dprint(_L("Permission denied!")); |
1347 User :: Leave(KErrPermissionDenied); |
1414 User::Leave( KErrPermissionDenied ); |
1348 } |
1415 } |
1349 }*/ |
1416 }*/ |
1350 |
1417 |
1351 Dprint(_L("[CSCPServer]-> Branched to ESCPAutolockPeriod...")); |
1418 Dprint(_L("[CSCPServer]-> Branched to ESCPAutolockPeriod...")); |
1352 // Check if this value is not allowed by the Max. Autolock period |
1419 // Check if this value is not allowed by the Max. Autolock period |
1353 if ((iConfiguration.iMaxTimeout > 0) && ((iConfiguration.iMaxTimeout < value) || (value == 0))) { |
1420 if ((iConfiguration.iMaxTimeout > 0) && ((iConfiguration.iMaxTimeout < value) || (value == 0))) { |
1354 Dprint((_L("[CSCPServer]-> ERROR: The value %d for AL period not allowed (Max. AL period: %d)"), value, iConfiguration.iMaxTimeout)); |
1421 Dprint((_L("[CSCPServer]-> ERROR: The value %d for AL period not allowed (Max. AL period: %d)"), value, iConfiguration.iMaxTimeout)); |
1355 |
1422 |
1356 lRetStatus = KErrArgument; |
1423 lRetStatus = KErrArgument; |
1357 } |
1424 } |
1358 else { |
1425 else { |
1359 //lRetStatus = SetAutolockPeriodL(value); |
1426 lRetStatus = SetAutolockPeriodL(value); |
1360 /* |
|
1361 * Call to SetBestPolicyL will not check for Stronger/Weaker. The value of ETimeout just gets stored in |
|
1362 * both the internal DB and the CenRep |
|
1363 */ |
|
1364 lRetStatus = SetBestPolicyL(RTerminalControl3rdPartySession :: ETimeout, aValue, aCallerIdentity, lParamDB); |
|
1365 |
1427 |
1366 if(lRetStatus != KErrNone) { |
1428 if(lRetStatus != KErrNone) { |
1367 Dprint((_L("[CSCPServer]-> ERROR: Couldn't set the Autolock period: %d"), lRetStatus)); |
1429 Dprint((_L("[CSCPServer]-> ERROR: Couldn't set the Autolock period: %d"), lRetStatus)); |
1368 } |
1430 } |
1369 } |
1431 } |
1370 } |
1432 } |
1371 |
|
1372 CleanupStack :: PopAndDestroy(); //lParamDB |
|
1373 } |
1433 } |
1374 break; |
1434 break; |
1375 case ESCPCodeChangePolicy: |
1435 case ESCPCodeChangePolicy: |
1376 Dprint(_L("[CSCPServer]-> Branched to ESCPCodeChangePolicy...")); |
1436 Dprint(_L("[CSCPServer]-> Branched to ESCPCodeChangePolicy...")); |
1377 lRetStatus = ChangeCodePolicy( aValue ); |
1437 lRetStatus = ChangeCodePolicy( aValue ); |
2123 } |
2177 } |
2124 } |
2178 } |
2125 else |
2179 else |
2126 { |
2180 { |
2127 // iConfiguration.iConfigFlag == KSCPConfigInvalid or KSCPConfigUnknown |
2181 // iConfiguration.iConfigFlag == KSCPConfigInvalid or KSCPConfigUnknown |
2128 |
2182 |
2129 // We might be out-of-sync, no idea about the real code. |
2183 // We might be out-of-sync, no idea about the real code. |
2130 // Check if the DOS code hashed from the given code is correct. |
2184 // Check if the DOS code hashed from the given code is correct. |
2131 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): Attempting to correct OoS situation.") )); |
2185 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): Attempting to correct OoS situation.") )); |
2132 if (IsCodeBlocked()) { |
2186 |
2133 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): OOS ->KErrLocked ") )); |
|
2134 return KErrLocked; |
|
2135 } |
|
2136 TRAP( ret, CheckISACodeL( pswCandidate ) ); |
2187 TRAP( ret, CheckISACodeL( pswCandidate ) ); |
2137 |
2188 |
2138 if (ret == KErrNone) { |
2189 if ( ret == KErrNone ) |
|
2190 { |
2139 // OK, we must assume that this is the correct code, since |
2191 // OK, we must assume that this is the correct code, since |
2140 // the hashed DOS code is correct. Save the codes, and return OK. |
2192 // the hashed DOS code is correct. Save the codes, and return OK. |
2141 |
2193 |
2142 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): Given code has the correct hash (%d)\ |
2194 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): Given code has the correct hash (%d)\ |
2143 , saving codes."), ISACode )); |
2195 , saving codes."), ISACode )); |
2144 |
2196 |
2145 iConfiguration.iEnhSecCode.Zero(); |
2197 iConfiguration.iEnhSecCode.Zero(); |
2146 iConfiguration.iEnhSecCode.Copy(hashBuf); |
2198 iConfiguration.iEnhSecCode.Copy( hashBuf ); |
2147 |
2199 |
2148 iConfiguration.iSecCode.Zero(); |
2200 iConfiguration.iSecCode.Zero(); |
2149 iConfiguration.iSecCode.AppendNum(ISACode); |
2201 iConfiguration.iSecCode.AppendNum( ISACode ); |
2150 |
2202 |
2151 // Unset the invalid configuration flag |
2203 // Unset the invalid configuration flag |
2152 iConfiguration.iConfigFlag = KSCPConfigOK; |
2204 iConfiguration.iConfigFlag = KSCPConfigOK; |
2153 writeSetup = ETrue; |
2205 writeSetup = ETrue; |
2154 } |
2206 } |
2155 else { |
2207 else |
2156 ret = KErrAccessDenied; |
2208 { |
2157 |
2209 |
2158 iConfiguration.iFailedAttempts++; |
2210 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): Given code does not have the \ |
2159 Dprint( (_L("CSCPServer::IsCorrectEnhCode():@@@: iFailedAttempts (%d)."), iConfiguration.iFailedAttempts )); |
2211 correct hash: ret; %d user enter password: %d"), ret )); |
|
2212 TRAP( ret, CheckISACodeL( aCode ) ); |
|
2213 if (ret == KErrNone) |
|
2214 { |
|
2215 //store this code in our interal storage as it is used as oldpassword while changing at ISA side in next command |
|
2216 //ChangeISACodeL. |
|
2217 iConfiguration.iSecCode.Zero(); |
|
2218 iConfiguration.iSecCode.Append( aCode ); |
|
2219 TRAP(ret,ChangeISACodeL(pswCandidate)); |
|
2220 } |
|
2221 if (ret == KErrNone) |
|
2222 { |
|
2223 iConfiguration.iEnhSecCode.Zero(); |
|
2224 iConfiguration.iEnhSecCode.Copy( hashBuf ); |
|
2225 |
|
2226 iConfiguration.iSecCode.Zero(); |
|
2227 iConfiguration.iSecCode.AppendNum( ISACode ); |
|
2228 |
|
2229 // Unset the invalid configuration flag |
|
2230 iConfiguration.iConfigFlag = KSCPConfigOK; |
2160 writeSetup = ETrue; |
2231 writeSetup = ETrue; |
2161 |
2232 } |
2162 if (iConfiguration.iFailedAttempts == KSCPCodeBlockLimit) { |
2233 } |
2163 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): KSCPCodeBlockLimit ") )); |
2234 } |
2164 // Block the code |
|
2165 TTime curTime; |
|
2166 curTime.UniversalTime(); |
|
2167 |
|
2168 iConfiguration.iBlockedAtTime.Zero(); |
|
2169 iConfiguration.iBlockedAtTime.AppendNum(curTime.Int64()); |
|
2170 |
|
2171 // The code will be blocked for now on |
|
2172 ret = KSCPErrCodeBlockStarted; |
|
2173 } |
|
2174 } |
|
2175 |
|
2176 } |
|
2177 |
2235 |
2178 // Write setup if needed |
2236 // Write setup if needed |
2179 if ( writeSetup ) |
2237 if ( writeSetup ) |
2180 { |
2238 { |
2181 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): 7 ") )); |
|
2182 TRAPD( err, iConfiguration.WriteSetupL() ); |
2239 TRAPD( err, iConfiguration.WriteSetupL() ); |
2183 if ( err != KErrNone ) |
2240 if ( err != KErrNone ) |
2184 { |
2241 { |
2185 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): WARNING:\ |
2242 Dprint( (_L("CSCPServer::IsCorrectEnhCode(): WARNING:\ |
2186 failed to write configuration: %d"), err )); |
2243 failed to write configuration: %d"), err )); |
2187 } |
2244 } |
2188 } |
2245 } |
2189 |
2246 Dprint( (_L("CSCPServer::IsCorrectEnhCode %d"), ret )); |
2190 return ret; |
2247 return ret; |
2191 } |
2248 } |
2192 |
2249 |
2193 |
2250 |
2194 |
2251 |
2324 inParams->Set( KSCPParamStatus, KErrNone ); |
2381 inParams->Set( KSCPParamStatus, KErrNone ); |
2325 inParams->Set( KSCPParamContext, KSCPContextChangePsw ); |
2382 inParams->Set( KSCPParamContext, KSCPContextChangePsw ); |
2326 CSCPParamObject* repParams = |
2383 CSCPParamObject* repParams = |
2327 iPluginManager->PostEvent( KSCPEventAuthenticationAttempted, *inParams ); |
2384 iPluginManager->PostEvent( KSCPEventAuthenticationAttempted, *inParams ); |
2328 |
2385 |
2329 if ( repParams != NULL ) |
2386 if ( repParams != NULL ) { |
|
2387 // Ignore the return params at this point |
|
2388 delete repParams; |
|
2389 } |
|
2390 |
|
2391 CleanupStack::PopAndDestroy(inParams); |
|
2392 |
|
2393 ret = ValidateLockcodeAgainstPoliciesL(aNewPass, aRetParams); |
|
2394 |
|
2395 if(ret != KErrNone) { |
|
2396 Dprint(_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() failed in CheckAndChangeEnhCodeL() ret=%d"), ret); |
|
2397 return ret; |
|
2398 } |
|
2399 |
|
2400 |
|
2401 if ( IsValidEnhCode( aNewPass ) ) |
|
2402 { |
|
2403 ret = StoreEnhCode( aNewPass, &aNewDOSCode ); |
|
2404 } |
|
2405 else |
|
2406 { |
|
2407 // Invalid code format! Should not happen at this point, but make sure. |
|
2408 ret = KErrArgument; |
|
2409 } |
|
2410 |
|
2411 if ( ret == KErrNone ) |
|
2412 { |
|
2413 CSCPParamObject* inParams = CSCPParamObject::NewL(); |
|
2414 CleanupStack::PushL( inParams ); |
|
2415 inParams->Set( KSCPParamPassword, aNewPass ); |
|
2416 |
|
2417 CSCPParamObject* repParams = |
|
2418 iPluginManager->PostEvent( KSCPEventPasswordChanged, *inParams ); |
|
2419 |
|
2420 CleanupStack::PopAndDestroy( inParams ); |
|
2421 |
|
2422 if ( repParams != NULL ) |
2330 { |
2423 { |
2331 // Ignore the return params at this point |
2424 // Ignore the return params at this point |
2332 delete repParams; |
2425 delete repParams; |
2333 } |
|
2334 |
|
2335 inParams->Reset(); |
|
2336 |
|
2337 // Validate the code |
|
2338 inParams->Set( KSCPParamPassword, aNewPass ); |
|
2339 |
|
2340 repParams = iPluginManager->PostEvent( KSCPEventValidate, *inParams ); |
|
2341 |
|
2342 CleanupStack::PopAndDestroy( inParams ); |
|
2343 |
|
2344 if ( repParams != NULL ) |
|
2345 { |
|
2346 // Check if the validation failed |
|
2347 TInt status; |
|
2348 if ( repParams->Get( KSCPParamStatus, status ) == KErrNone ) |
|
2349 { |
|
2350 if ( status != KErrNone ) |
|
2351 { |
|
2352 ret = status; |
|
2353 } |
|
2354 } |
2426 } |
2355 |
|
2356 aRetParams = repParams; // pointer ownership changed |
|
2357 } |
|
2358 |
|
2359 // Set the new code, if it was OK |
|
2360 if ( ret == KErrNone ) |
|
2361 { |
|
2362 if ( IsValidEnhCode( aNewPass ) ) |
|
2363 { |
|
2364 ret = StoreEnhCode( aNewPass, &aNewDOSCode ); |
|
2365 } |
|
2366 else |
|
2367 { |
|
2368 // Invalid code format! Should not happen at this point, but make sure. |
|
2369 ret = KErrArgument; |
|
2370 } |
|
2371 |
|
2372 if ( ret == KErrNone ) |
|
2373 { |
|
2374 CSCPParamObject* inParams = CSCPParamObject::NewL(); |
|
2375 CleanupStack::PushL( inParams ); |
|
2376 inParams->Set( KSCPParamPassword, aNewPass ); |
|
2377 |
|
2378 CSCPParamObject* repParams = |
|
2379 iPluginManager->PostEvent( KSCPEventPasswordChanged, *inParams ); |
|
2380 |
|
2381 CleanupStack::PopAndDestroy( inParams ); |
|
2382 |
|
2383 if ( repParams != NULL ) |
|
2384 { |
|
2385 // Ignore the return params at this point |
|
2386 delete repParams; |
|
2387 } |
|
2388 } |
|
2389 } |
2427 } |
2390 } |
2428 } |
2391 else |
2429 else |
2392 { |
2430 { |
2393 if ( ( ret == KErrAccessDenied ) || ( ret == KSCPErrCodeBlockStarted ) ) |
2431 if ( ( ret == KErrAccessDenied ) || ( ret == KSCPErrCodeBlockStarted ) ) |
2589 * |
2626 * |
2590 * @return TInt: KErrNone is successful, otherwise a system error code |
2627 * @return TInt: KErrNone is successful, otherwise a system error code |
2591 */ |
2628 */ |
2592 TInt CSCPServer :: SetBestPolicyL( TInt aID, const TDesC& aValue, TUint32 aCallerIdentity, CSCPParamDBController* aParamDB ) { |
2629 TInt CSCPServer :: SetBestPolicyL( TInt aID, const TDesC& aValue, TUint32 aCallerIdentity, CSCPParamDBController* aParamDB ) { |
2593 Dprint( (_L("[CSCPServer]-> SetBestPolicyL() >>>"))); |
2630 Dprint( (_L("[CSCPServer]-> SetBestPolicyL() >>>"))); |
2594 Dprint( (_L("[CSCPServer]-> ParamID=%d "), aID, aValue)); |
|
2595 Dprint( (_L("[CSCPServer]-> ParamValue=%d "), aValue)); |
|
2596 |
|
2597 TBool lFirstTime(EFalse); |
2631 TBool lFirstTime(EFalse); |
2598 TInt32 lNumValue (-1); |
2632 TInt32 lNumValue (-1); |
2599 TInt32 lNumValDB (-1); |
2633 TInt32 lNumValDB (-1); |
2600 TInt lRetStatus = KErrNone; |
2634 TInt32 lRetStatus = KErrNone; |
2601 |
2635 |
2602 switch(aID) { |
2636 switch(aID) { |
2603 case RTerminalControl3rdPartySession :: ETimeout: |
|
2604 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2637 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2605 case RTerminalControl3rdPartySession :: EPasscodeMinLength: |
2638 case RTerminalControl3rdPartySession :: EPasscodeMinLength: |
2606 case RTerminalControl3rdPartySession :: EPasscodeMaxLength: |
2639 case RTerminalControl3rdPartySession :: EPasscodeMaxLength: |
2607 case RTerminalControl3rdPartySession :: EPasscodeRequireUpperAndLower: |
2640 case RTerminalControl3rdPartySession :: EPasscodeRequireUpperAndLower: |
2608 case RTerminalControl3rdPartySession :: EPasscodeRequireCharsAndNumbers: |
2641 case RTerminalControl3rdPartySession :: EPasscodeRequireCharsAndNumbers: |
2770 * from iPluginEventHandler->GetParameters() fails. |
2794 * from iPluginEventHandler->GetParameters() fails. |
2771 * (WriteToFileL() is called in some destructor when the SCPServer terminates) |
2795 * (WriteToFileL() is called in some destructor when the SCPServer terminates) |
2772 */ |
2796 */ |
2773 if (lRetStatus == KErrNone) { |
2797 if (lRetStatus == KErrNone) { |
2774 switch (aID) { |
2798 switch (aID) { |
2775 case RTerminalControl3rdPartySession :: ETimeout: |
|
2776 lRetStatus = SetAutolockPeriodL(TInt(lNumValue)); |
|
2777 Dprint(_L("[CSCPServer]-> After setting ETimeout lRetStatus = %d "), lRetStatus); |
|
2778 break; |
|
2779 |
|
2780 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2799 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2781 iConfiguration.iMaxTimeout = lNumValue; |
2800 iConfiguration.iMaxTimeout = lNumValue; |
2782 lRetStatus = iConfiguration.WriteSetupL(); |
2801 lRetStatus = iConfiguration.WriteSetupL(); |
2783 Dprint(_L("[CSCPServer]-> After setting EMaxTimeout lRetStatus = %d "), lRetStatus); |
2802 Dprint(_L("[CSCPServer]-> After setting EMaxTimeout lRetStatus = %d "), lRetStatus); |
2784 break; |
2803 break; |
2785 |
|
2786 default: |
2804 default: |
2787 TUint16* ptr = const_cast<TUint16*>(aValue.Ptr()); |
2805 TUint16* ptr = const_cast<TUint16*>(aValue.Ptr()); |
2788 TPtr valBuf(ptr, aValue.Length(), aValue.Length()); |
2806 TPtr valBuf(ptr, aValue.Length(), aValue.Length()); |
2789 lRetStatus = iPluginEventHandler->GetParameters().Set(aID, valBuf); |
2807 lRetStatus = iPluginEventHandler->GetParameters().Set(aID, valBuf); |
2790 Dprint(_L("[CSCPServer]-> After setting (%d ) lRetStatus = %d "), aID, lRetStatus); |
2808 Dprint(_L("[CSCPServer]-> After setting (%d ) lRetStatus = %d "), aID, lRetStatus); |
2875 lParamIds[lMinTolIndex] = RTerminalControl3rdPartySession :: EPasscodeHistoryBuffer; |
2893 lParamIds[lMinTolIndex] = RTerminalControl3rdPartySession :: EPasscodeHistoryBuffer; |
2876 Dprint(_L("[CSCPServer]-> Switching the cleanup order of EPasscodeHistoryBuffer and EPasscodeMinChangeTolerance")); |
2894 Dprint(_L("[CSCPServer]-> Switching the cleanup order of EPasscodeHistoryBuffer and EPasscodeMinChangeTolerance")); |
2877 Dprint(_L("[CSCPServer]-> Old Index of EPasscodeHistoryBuffer=%d"), lHistBuffIndex); |
2895 Dprint(_L("[CSCPServer]-> Old Index of EPasscodeHistoryBuffer=%d"), lHistBuffIndex); |
2878 Dprint(_L("[CSCPServer]-> Old Index of EPasscodeMinChangeTolerance=%d"), lMinTolIndex); |
2896 Dprint(_L("[CSCPServer]-> Old Index of EPasscodeMinChangeTolerance=%d"), lMinTolIndex); |
2879 } |
2897 } |
2880 |
|
2881 /* |
|
2882 * If both ETimeout and EMaxTimeout are marked for cleanup then interchange the cleanup order of |
|
2883 * ETimeout and EMaxTimeout since AutoLock (ETimeout) cannot be disabled |
|
2884 * if MaxAutolock (EMaxTimeout) is still enabled |
|
2885 */ |
|
2886 if( lParamIds[0] == RTerminalControl3rdPartySession :: ETimeout && |
|
2887 lParamIds[1] == RTerminalControl3rdPartySession :: EMaxTimeout) { |
|
2888 |
|
2889 lParamIds[0] = RTerminalControl3rdPartySession :: EMaxTimeout; |
|
2890 lParamIds[1] = RTerminalControl3rdPartySession :: ETimeout; |
|
2891 } |
|
2892 } |
2898 } |
2893 |
2899 |
2894 for(TInt j=0; j < lCount; j++) { |
2900 for(TInt j=0; j < lCount; j++) { |
2895 TInt lCurrParamID = lParamIds[j]; |
2901 TInt lCurrParamID = lParamIds[j]; |
2896 lDefValueBuf->Des().Zero(); |
2902 lDefValueBuf->Des().Zero(); |
2897 lDefValueBuf->Des().Format(_L("%d "), 0); |
2903 lDefValueBuf->Des().Format(_L("%d "), 0); |
2898 |
|
2899 // Initialize the default values here... |
2904 // Initialize the default values here... |
2900 switch(lCurrParamID) { |
2905 switch(lCurrParamID) { |
2901 case RTerminalControl3rdPartySession :: ETimeout: |
|
2902 // lDefValueBuf already has the default value, 0 initialized... |
|
2903 lCurrParamID = ESCPAutolockPeriod; |
|
2904 break; |
|
2905 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2906 case RTerminalControl3rdPartySession :: EMaxTimeout: |
2906 // lDefValueBuf already has the default value, 0 initialized... |
2907 // lDefValueBuf already has the default value, 0 initialized... |
2907 lCurrParamID = ESCPMaxAutolockPeriod; |
2908 lCurrParamID = ESCPMaxAutolockPeriod; |
2908 break; |
2909 break; |
2909 case RTerminalControl3rdPartySession :: EPasscodeMinLength: |
2910 case RTerminalControl3rdPartySession :: EPasscodeMinLength: |
3007 Dprint( (_L("[CSCPServer]-> PerformCleanupL() <<<"))); |
2972 Dprint( (_L("[CSCPServer]-> PerformCleanupL() <<<"))); |
3008 CleanupStack :: PopAndDestroy(4); // lParamIds lParamDB lBufReadStream lDefValueBuf |
2973 CleanupStack :: PopAndDestroy(4); // lParamIds lParamDB lBufReadStream lDefValueBuf |
3009 return (lSubOpsFailed) ? KErrGeneral : KErrNone; |
2974 return (lSubOpsFailed) ? KErrGeneral : KErrNone; |
3010 } |
2975 } |
3011 |
2976 |
|
2977 void CSCPServer :: GetPoliciesL(HBufC8* aAppIDBuffer, TUint32 aCallerIdentity) { |
|
2978 TInt lValue; |
|
2979 TInt lRet = KErrNone; |
|
2980 TBuf<25> lParamValBuf; |
|
2981 TPtr8 lBufPtr = aAppIDBuffer->Des(); |
|
2982 RDesWriteStream lWriteStream(lBufPtr); |
|
2983 CleanupClosePushL(lWriteStream); |
|
2984 |
|
2985 lRet = GetAutolockPeriodL(lValue); |
|
2986 |
|
2987 if(lRet != KErrNone) { |
|
2988 User :: Leave(lRet); |
|
2989 } |
|
2990 |
|
2991 Dprint((_L("[CSCPServer]-> appending AutoLockPeriod value=%d"), lValue)); |
|
2992 lWriteStream.WriteInt32L(lValue); |
|
2993 |
|
2994 Dprint((_L("[CSCPServer]-> appending MaxAutoLockPeriod value=%d"), iConfiguration.iMaxTimeout)); |
|
2995 lWriteStream.WriteInt32L(iConfiguration.iMaxTimeout); |
|
2996 |
|
2997 if(FeatureManager :: FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { |
|
2998 Dprint(_L("[CSCPServer]-> (FeatureManager :: FeatureSupported() complete. Fetching values now...")); |
|
2999 /* Fetch parameters starting from RTerminalControl3rdPartySession :: EPasscodeMinLength to |
|
3000 * RTerminalControl3rdPartySession :: EPasscodeMinChangeInterval |
|
3001 */ |
|
3002 TInt lPID = RTerminalControl3rdPartySession :: EPasscodeMinLength; |
|
3003 |
|
3004 for(; lPID <= RTerminalControl3rdPartySession :: EPasscodeDisallowSimple; lPID++) { |
|
3005 switch(lPID) { |
|
3006 default: |
|
3007 break; |
|
3008 case RTerminalControl3rdPartySession :: EPasscodeCheckSpecificStrings: |
|
3009 case RTerminalControl3rdPartySession :: EPasscodeAllowSpecific: |
|
3010 case RTerminalControl3rdPartySession :: EPasscodeClearSpecificStrings: |
|
3011 // No need to fetch these three parameters |
|
3012 continue; |
|
3013 case RTerminalControl3rdPartySession :: EPasscodeDisallowSpecific: |
|
3014 Dprint(_L("[CSCPServer]-> appending EPasscodeDisallowSpecific value...")); |
|
3015 // Get on EPasscodeDisallowSpecific returning -1 instead |
|
3016 lWriteStream.WriteInt32L(-1); |
|
3017 continue; |
|
3018 case RTerminalControl3rdPartySession :: EPasscodeDisallowSimple: |
|
3019 Dprint(_L("[CSCPServer]-> appending EPasscodeDisallowSimple value...")); |
|
3020 lWriteStream.WriteInt32L(1); |
|
3021 lWriteStream.WriteInt32L(1); |
|
3022 continue; |
|
3023 } |
|
3024 |
|
3025 //lRet = GetParameterValueL(lPID, lParamValBuf, aCallerIdentity); |
|
3026 lRet = iPluginEventHandler->GetParameters().Get(lPID, lValue); |
|
3027 |
|
3028 switch(lRet) { |
|
3029 |
|
3030 |
|
3031 case KErrNotFound: { |
|
3032 switch(lPID) { |
|
3033 case RTerminalControl3rdPartySession :: EPasscodeMinLength: |
|
3034 lValue = KSCPPasscodeMinLength; |
|
3035 break; |
|
3036 case RTerminalControl3rdPartySession :: EPasscodeMaxLength: |
|
3037 lValue = KSCPPasscodeMaxLength; |
|
3038 break; |
|
3039 default: |
|
3040 lValue = 0; |
|
3041 break; |
|
3042 } |
|
3043 } |
|
3044 break; |
|
3045 case KErrNone: { |
|
3046 // TLex lLex(lParamValBuf); |
|
3047 // lRet = lLex.Val(lValue); |
|
3048 // User :: LeaveIfError(lRet); |
|
3049 } |
|
3050 break; |
|
3051 default: |
|
3052 User :: Leave(lRet); |
|
3053 } |
|
3054 |
|
3055 Dprint((_L("[CSCPServer]-> appending value for lPID=%d"), lPID)); |
|
3056 Dprint((_L("[CSCPServer]-> lValue=%d"), lValue)); |
|
3057 |
|
3058 switch(lPID) { |
|
3059 default: |
|
3060 lWriteStream.WriteInt32L(lValue); |
|
3061 break; |
|
3062 case RTerminalControl3rdPartySession :: EPasscodeDisallowSimple: |
|
3063 lWriteStream.WriteInt32L(1); |
|
3064 lWriteStream.WriteInt32L(1); |
|
3065 break; |
|
3066 } |
|
3067 } |
|
3068 } |
|
3069 else { |
|
3070 Dprint(_L("[CSCPServer]-> (FeatureManager :: FeatureSupported() failed!!...")); |
|
3071 } |
|
3072 |
|
3073 CleanupStack :: PopAndDestroy(1); // lWriteStream |
|
3074 } |
|
3075 |
|
3076 TInt CSCPServer :: ValidateLockcodeAgainstPoliciesL(TDes& aLockcode, CSCPParamObject*& aRetParams) { |
|
3077 Dprint( (_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() >>>"))); |
|
3078 |
|
3079 TInt ret = KErrNone; |
|
3080 CSCPParamObject* inParams = CSCPParamObject :: NewL(); |
|
3081 inParams->Set(KSCPParamPassword, aLockcode); |
|
3082 CSCPParamObject* repParams = iPluginManager->PostEvent(KSCPEventValidate, *inParams); |
|
3083 delete inParams; |
|
3084 |
|
3085 if (repParams != NULL) { |
|
3086 // Check if the validation failed |
|
3087 TInt status; |
|
3088 |
|
3089 if (repParams->Get(KSCPParamStatus, status) == KErrNone) { |
|
3090 if (status != KErrNone) { |
|
3091 ret = status; |
|
3092 } |
|
3093 } |
|
3094 |
|
3095 aRetParams = repParams; // pointer ownership changed |
|
3096 } |
|
3097 |
|
3098 Dprint( (_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() <<<"))); |
|
3099 return ret; |
|
3100 } |
|
3101 |
3012 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
3102 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
3013 // <<<< ********************** NEW FEATURES ******************** |
3103 // <<<< ********************** NEW FEATURES ******************** |
3014 |
3104 |
3015 // ================= OTHER EXPORTED FUNCTIONS ============== |
3105 // ================= OTHER EXPORTED FUNCTIONS ============== |
3016 |
3106 |