First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Ensure that old insecure Trk debug agent cannot be installed
15 // as it should be blocked from SWInstall'ing by a trkdummyapp.exe contained within
16 // the base OS with the same SID as the insecure Trk.
21 #include <e32base_private.h>
26 #include <e32cmn_private.h>
29 #include "t_trkdummyapp.h"
31 LOCAL_D RTest test(_L("T_TRKDUMMYAPP"));
33 CTrkDummyAppTest::CTrkDummyAppTest()
35 // CTrkDummyAppTest constructor
41 CTrkDummyAppTest* CTrkDummyAppTest::NewL()
43 // CRunModeAgent::NewL
46 CTrkDummyAppTest* self = new(ELeave) CTrkDummyAppTest();
53 CTrkDummyAppTest::~CTrkDummyAppTest()
55 // CTrkDummyAppTest destructor
61 void CTrkDummyAppTest::ConstructL()
63 // CTrkDummyAppTest::ConstructL
70 CTrkDummyAppTest *TrkDummyTest;
72 //----------------------------------------------------------------------------------------------
73 //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-0792
76 //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed
77 //! by ensuring the existence of a Symbian OS common app called trkdummyapp.exe
78 //! already exists with the same Secure ID as the insecure app.
81 //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp.exe. Fail if unsuccessful.
83 //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp.exe.
85 //! 3. Close the process derived from z:\sys\bin\trkdummyapp.exe.
87 //! @SYMTestExpectedResults
89 //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp.exe.
91 //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x101F7159. Fail otherwise.
93 //! @SYMTestPriority High
94 //! @SYMTestStatus Implemented
95 //----------------------------------------------------------------------------------------------
97 // Names of some test programs used for testing security
98 _LIT(KRMDebugSecurityTrkDummyApp,"z:\\sys\\bin\\trkdummyapp.exe");
100 void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent(void)
103 test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x101F7159\n"));
106 TInt err = process.Create(KRMDebugSecurityTrkDummyApp, KNullDesC, EOwnerProcess);
107 test (err == KErrNone);
109 // rendezvous with process
110 TRequestStatus status;
111 process.Rendezvous(status);
113 // obtain the secure ID for the process
114 TSecurityInfo secInfo(process);
116 static const TSecureId KTrkDummyAppSID = 0x101F7159;
118 test(secInfo.iSecureId.iId == KTrkDummyAppSID);
120 // Kill the process, as we don't need it anymore
121 process.Kill(KErrNone);
126 //----------------------------------------------------------------------------------------------
127 //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-0793
129 //! @SYMPREQ PREQ1426
130 //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed
131 //! by ensuring the existence of a Symbian OS common app called trkdummyapp.exe
132 //! already exists with the same Secure ID as the insecure app.
135 //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp2.exe. Fail if unsuccessful.
137 //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp2.exe.
139 //! 3. Close the process derived from z:\sys\bin\trkdummyapp2.exe.
141 //! @SYMTestExpectedResults
143 //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp2.exe.
145 //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x2000a7dd. Fail otherwise.
147 //! @SYMTestPriority High
148 //! @SYMTestStatus Implemented
149 //----------------------------------------------------------------------------------------------
151 // Names of some test programs used for testing security
152 _LIT(KRMDebugSecurityTrkDummyApp2,"z:\\sys\\bin\\trkdummyapp2.exe");
154 void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent2(void)
157 test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent2, SID 0x2000a7dd\n"));
160 TInt err = process.Create(KRMDebugSecurityTrkDummyApp2, KNullDesC, EOwnerProcess);
161 test (err == KErrNone);
163 // rendezvous with process
164 TRequestStatus status;
165 process.Rendezvous(status);
167 // obtain the secure ID for the process
168 TSecurityInfo secInfo(process);
170 static const TSecureId KTrkDummyAppSID2 = 0x2000a7dd;
172 test(secInfo.iSecureId.iId == KTrkDummyAppSID2);
174 // Kill the process, as we don't need it anymore
175 process.Kill(KErrNone);
180 //----------------------------------------------------------------------------------------------
181 //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-2396
183 //! @SYMPREQ PREQ1426
184 //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed
185 //! by ensuring the existence of a Symbian OS common app called trkdummyapp200159D8.exe
186 //! already exists with the same Secure ID as the insecure app.
189 //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp200159D8.exe. Fail if unsuccessful.
191 //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp200159D8.exe.
193 //! 3. Close the process derived from z:\sys\bin\trkdummyapp200159D8.exe.
195 //! @SYMTestExpectedResults
197 //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp200159D8.exe.
199 //! 2. The Secure ID of trkdummyapp200159D8.exe has the Secure ID 0x200159D8. Fail otherwise.
201 //! @SYMTestPriority High
202 //! @SYMTestStatus Implemented
203 //----------------------------------------------------------------------------------------------
205 // Names of some test programs used for testing security
206 _LIT(KRMDebugSecurityTrkDummyApp200159D8,"z:\\sys\\bin\\trkdummyapp200159D8.exe");
208 void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent200159D8(void)
210 test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x200159D8\n"));
213 TInt err = process.Create(KRMDebugSecurityTrkDummyApp200159D8, KNullDesC, EOwnerProcess);
214 test (err == KErrNone);
216 // rendezvous with process
217 TRequestStatus status;
218 process.Rendezvous(status);
220 // obtain the secure ID for the process
221 TSecurityInfo secInfo(process);
223 static const TSecureId KTrkDummyAppSID2 = 0x200159D8;
225 test(secInfo.iSecureId.iId == KTrkDummyAppSID2);
227 // Kill the process, as we don't need it anymore
228 process.Kill(KErrNone);
233 //----------------------------------------------------------------------------------------------
234 //! @SYMTestCaseID KBase-T-TRKDUMMYAPP-2397
236 //! @SYMPREQ PREQ1426
237 //! @SYMTestCaseDesc Tests that a known insecure debug agent trkapp.sis cannot be installed
238 //! by ensuring the existence of a Symbian OS common app called trkdummyapp200170BC.exe
239 //! already exists with the same Secure ID as the insecure app.
242 //! 1. Calls RProcess.Create() on z:\sys\bin\trkdummyapp200170BC.exe. Fail if unsuccessful.
244 //! 2. Obtain the Secure ID of the process derived from z:\sys\bin\trkdummyapp200170BC.exe.
246 //! 3. Close the process derived from z:\sys\bin\trkdummyapp200170BC.exe.
248 //! @SYMTestExpectedResults
250 //! 1. Fails if unable to create a process from z:\sys\bin\trkdummyapp200170BC.exe.
252 //! 2. The Secure ID of trkdummyapp.exe has the Secure ID 0x200170BC. Fail otherwise.
254 //! @SYMTestPriority High
255 //! @SYMTestStatus Implemented
256 //----------------------------------------------------------------------------------------------
258 // Names of some test programs used for testing security
259 _LIT(KRMDebugSecurityTrkDummyApp200170BC,"z:\\sys\\bin\\trkdummyapp200170BC.exe");
261 void CTrkDummyAppTest::TestSecurityCheckPreventInsecureTrkDebugAgent200170BC(void)
264 test.Next(_L("TestSecurityCheckPreventInsecureTrkDebugAgent, SID 0x200170BC\n"));
267 TInt err = process.Create(KRMDebugSecurityTrkDummyApp200170BC, KNullDesC, EOwnerProcess);
268 test (err == KErrNone);
270 // rendezvous with process
271 TRequestStatus status;
272 process.Rendezvous(status);
274 // obtain the secure ID for the process
275 TSecurityInfo secInfo(process);
277 static const TSecureId KTrkDummyAppSID2 = 0x200170BC;
279 test(secInfo.iSecureId.iId == KTrkDummyAppSID2);
281 // Kill the process, as we don't need it anymore
282 process.Kill(KErrNone);
287 void CTrkDummyAppTest::ClientAppL()
289 // Performs each test in turn
292 test.Start(_L("ClientAppL"));
294 TestSecurityCheckPreventInsecureTrkDebugAgent();
296 TestSecurityCheckPreventInsecureTrkDebugAgent2();
298 TestSecurityCheckPreventInsecureTrkDebugAgent200159D8();
300 TestSecurityCheckPreventInsecureTrkDebugAgent200170BC();
307 GLDEF_C TInt E32Main()
309 // Entry point for run mode debug driver test
315 CTrapCleanup* trap = CTrapCleanup::New();
320 TrkDummyTest = CTrkDummyAppTest::NewL();
321 if (TrkDummyTest != NULL)
324 TRAP(ret,TrkDummyTest->ClientAppL());
335 // End of file - t_trkdummyapp.cpp