sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Ensure that old insecure Trk debug agent cannot be installed sl@0: // as it should be blocked from SWInstall'ing by a trkdummyapp.exe contained within sl@0: // the base OS with the same SID as the insecure Trk. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_trkdummyapp.h" sl@0: sl@0: LOCAL_D RTest test(_L("T_TRKDUMMYAPP")); sl@0: sl@0: CTrkDummyAppTest::CTrkDummyAppTest() sl@0: // sl@0: // CTrkDummyAppTest constructor sl@0: // sl@0: { sl@0: // nothing to do sl@0: } sl@0: sl@0: CTrkDummyAppTest* CTrkDummyAppTest::NewL() sl@0: // sl@0: // CRunModeAgent::NewL sl@0: // sl@0: { sl@0: CTrkDummyAppTest* self = new(ELeave) CTrkDummyAppTest(); sl@0: sl@0: self->ConstructL(); sl@0: sl@0: return self; sl@0: } sl@0: sl@0: CTrkDummyAppTest::~CTrkDummyAppTest() sl@0: // sl@0: // CTrkDummyAppTest destructor sl@0: // sl@0: { sl@0: // Nothing to do sl@0: } sl@0: sl@0: void CTrkDummyAppTest::ConstructL() sl@0: // sl@0: // CTrkDummyAppTest::ConstructL sl@0: // sl@0: { sl@0: // nothing to do here sl@0: } sl@0: sl@0: sl@0: CTrkDummyAppTest *TrkDummyTest; sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-0792 sl@0: //! @SYMTestType sl@0: //! @SYMPREQ PREQ1426 sl@0: //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed sl@0: //! by ensuring the existence of a Symbian OS common app called trkdummyapp.exe sl@0: //! already exists with the same Secure ID as the insecure app. sl@0: //! @SYMTestActions sl@0: //! sl@0: //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp.exe. Fail if unsuccessful. sl@0: //! sl@0: //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp.exe. sl@0: //! sl@0: //! 3. Close the process derived from z:\sys\bin\trkdummyapp.exe. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! sl@0: //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp.exe. sl@0: //! sl@0: //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x101F7159. Fail otherwise. sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: sl@0: // Names of some test programs used for testing security sl@0: _LIT(KRMDebugSecurityTrkDummyApp,"z:\\sys\\bin\\trkdummyapp.exe"); sl@0: sl@0: void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent(void) sl@0: { sl@0: sl@0: test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x101F7159\n")); sl@0: sl@0: RProcess process; sl@0: TInt err = process.Create(KRMDebugSecurityTrkDummyApp, KNullDesC, EOwnerProcess); sl@0: test (err == KErrNone); sl@0: sl@0: // rendezvous with process sl@0: TRequestStatus status; sl@0: process.Rendezvous(status); sl@0: sl@0: // obtain the secure ID for the process sl@0: TSecurityInfo secInfo(process); sl@0: sl@0: static const TSecureId KTrkDummyAppSID = 0x101F7159; sl@0: sl@0: test(secInfo.iSecureId.iId == KTrkDummyAppSID); sl@0: sl@0: // Kill the process, as we don't need it anymore sl@0: process.Kill(KErrNone); sl@0: sl@0: process.Close(); sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-0793 sl@0: //! @SYMTestType sl@0: //! @SYMPREQ PREQ1426 sl@0: //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed sl@0: //! by ensuring the existence of a Symbian OS common app called trkdummyapp.exe sl@0: //! already exists with the same Secure ID as the insecure app. sl@0: //! @SYMTestActions sl@0: //! sl@0: //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp2.exe. Fail if unsuccessful. sl@0: //! sl@0: //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp2.exe. sl@0: //! sl@0: //! 3. Close the process derived from z:\sys\bin\trkdummyapp2.exe. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! sl@0: //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp2.exe. sl@0: //! sl@0: //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x2000a7dd. Fail otherwise. sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: sl@0: // Names of some test programs used for testing security sl@0: _LIT(KRMDebugSecurityTrkDummyApp2,"z:\\sys\\bin\\trkdummyapp2.exe"); sl@0: sl@0: void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent2(void) sl@0: { sl@0: sl@0: test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent2, SID 0x2000a7dd\n")); sl@0: sl@0: RProcess process; sl@0: TInt err = process.Create(KRMDebugSecurityTrkDummyApp2, KNullDesC, EOwnerProcess); sl@0: test (err == KErrNone); sl@0: sl@0: // rendezvous with process sl@0: TRequestStatus status; sl@0: process.Rendezvous(status); sl@0: sl@0: // obtain the secure ID for the process sl@0: TSecurityInfo secInfo(process); sl@0: sl@0: static const TSecureId KTrkDummyAppSID2 = 0x2000a7dd; sl@0: sl@0: test(secInfo.iSecureId.iId == KTrkDummyAppSID2); sl@0: sl@0: // Kill the process, as we don't need it anymore sl@0: process.Kill(KErrNone); sl@0: sl@0: process.Close(); sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-2396 sl@0: //! @SYMTestType sl@0: //! @SYMPREQ PREQ1426 sl@0: //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed sl@0: //! by ensuring the existence of a Symbian OS common app called trkdummyapp200159D8.exe sl@0: //! already exists with the same Secure ID as the insecure app. sl@0: //! @SYMTestActions sl@0: //! sl@0: //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp200159D8.exe. Fail if unsuccessful. sl@0: //! sl@0: //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp200159D8.exe. sl@0: //! sl@0: //! 3. Close the process derived from z:\sys\bin\trkdummyapp200159D8.exe. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! sl@0: //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp200159D8.exe. sl@0: //! sl@0: //! 2. The Secure ID of trkdummyapp200159D8.exe has the Secure ID 0x200159D8. Fail otherwise. sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: sl@0: // Names of some test programs used for testing security sl@0: _LIT(KRMDebugSecurityTrkDummyApp200159D8,"z:\\sys\\bin\\trkdummyapp200159D8.exe"); sl@0: sl@0: void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent200159D8(void) sl@0: { sl@0: test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x200159D8\n")); sl@0: sl@0: RProcess process; sl@0: TInt err = process.Create(KRMDebugSecurityTrkDummyApp200159D8, KNullDesC, EOwnerProcess); sl@0: test (err == KErrNone); sl@0: sl@0: // rendezvous with process sl@0: TRequestStatus status; sl@0: process.Rendezvous(status); sl@0: sl@0: // obtain the secure ID for the process sl@0: TSecurityInfo secInfo(process); sl@0: sl@0: static const TSecureId KTrkDummyAppSID2 = 0x200159D8; sl@0: sl@0: test(secInfo.iSecureId.iId == KTrkDummyAppSID2); sl@0: sl@0: // Kill the process, as we don't need it anymore sl@0: process.Kill(KErrNone); sl@0: sl@0: process.Close(); sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-2397 sl@0: //! @SYMTestType sl@0: //! @SYMPREQ PREQ1426 sl@0: //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed sl@0: //! by ensuring the existence of a Symbian OS common app called trkdummyapp200170BC.exe sl@0: //! already exists with the same Secure ID as the insecure app. sl@0: //! @SYMTestActions sl@0: //! sl@0: //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp200170BC.exe. Fail if unsuccessful. sl@0: //! sl@0: //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp200170BC.exe. sl@0: //! sl@0: //! 3. Close the process derived from z:\sys\bin\trkdummyapp200170BC.exe. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! sl@0: //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp200170BC.exe. sl@0: //! sl@0: //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x200170BC. Fail otherwise. sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: sl@0: // Names of some test programs used for testing security sl@0: _LIT(KRMDebugSecurityTrkDummyApp200170BC,"z:\\sys\\bin\\trkdummyapp200170BC.exe"); sl@0: sl@0: void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent200170BC(void) sl@0: { sl@0: sl@0: test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x200170BC\n")); sl@0: sl@0: RProcess process; sl@0: TInt err = process.Create(KRMDebugSecurityTrkDummyApp200170BC, KNullDesC, EOwnerProcess); sl@0: test (err == KErrNone); sl@0: sl@0: // rendezvous with process sl@0: TRequestStatus status; sl@0: process.Rendezvous(status); sl@0: sl@0: // obtain the secure ID for the process sl@0: TSecurityInfo secInfo(process); sl@0: sl@0: static const TSecureId KTrkDummyAppSID2 = 0x200170BC; sl@0: sl@0: test(secInfo.iSecureId.iId == KTrkDummyAppSID2); sl@0: sl@0: // Kill the process, as we don't need it anymore sl@0: process.Kill(KErrNone); sl@0: sl@0: process.Close(); sl@0: } sl@0: sl@0: void CTrkDummyAppTest::ClientAppL() sl@0: // sl@0: // Performs each test in turn sl@0: // sl@0: { sl@0: test.Start(_L("ClientAppL")); sl@0: sl@0: TestSecurityCheckPreventInsecureTrkDebugAgent(); sl@0: sl@0: TestSecurityCheckPreventInsecureTrkDebugAgent2(); sl@0: sl@0: TestSecurityCheckPreventInsecureTrkDebugAgent200159D8(); sl@0: sl@0: TestSecurityCheckPreventInsecureTrkDebugAgent200170BC(); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: // sl@0: // Entry point for run mode debug driver test sl@0: // sl@0: { sl@0: TInt ret = KErrNone; sl@0: sl@0: // client sl@0: CTrapCleanup* trap = CTrapCleanup::New(); sl@0: if (!trap) sl@0: return KErrNoMemory; sl@0: sl@0: test.Title(); sl@0: TrkDummyTest = CTrkDummyAppTest::NewL(); sl@0: if (TrkDummyTest != NULL) sl@0: { sl@0: __UHEAP_MARK; sl@0: TRAP(ret,TrkDummyTest->ClientAppL()); sl@0: __UHEAP_MARKEND; sl@0: sl@0: delete TrkDummyTest; sl@0: } sl@0: sl@0: delete trap; sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: // End of file - t_trkdummyapp.cpp sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: