|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: javaregserverpolicycheck implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "javaregserver.h" |
|
20 #include "javaregserversession.h" |
|
21 #include "javaregserverallowedid.h" |
|
22 #include "logger.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS ============================== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CJavaRegServer::CustomSecurityCheckL |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 // using namespace Java::Utilities; |
|
31 using namespace Java::Manager::Registry; |
|
32 |
|
33 CPolicyServer::TCustomResult CJavaRegServer::CustomSecurityCheckL( |
|
34 const RMessage2& aMsg, |
|
35 TInt& aAction, |
|
36 TSecurityInfo& /*aMissing*/) |
|
37 { |
|
38 JELOG(EJavaStorage, "CJavaRegServer::CustomSecurityCheckL()"); |
|
39 switch (aMsg.Function()) |
|
40 { |
|
41 case EInitializeServerTransId: |
|
42 case ESetEntry: |
|
43 case ERemoveEntry: |
|
44 case ERemoveEntryFromAll: |
|
45 case EAllocateUids: |
|
46 // Pass if the client is Java Installer OR OSGi VM OR SDK debug agent |
|
47 if (aMsg.SecureId() == AllowedClientSecureId_Installer || |
|
48 aMsg.SecureId() == AllowedClientSecureId_OsgiVm || |
|
49 aMsg.SecureId() == AllowedClientSecureId_SDKDebugAgent) |
|
50 { |
|
51 return CPolicyServer::EPass; |
|
52 } |
|
53 // Pass if the client is using the legacy API AND |
|
54 // it's either JavaHelperServer OR AppInstUi. |
|
55 // Written as an 'elseif' only for better readability's sake. |
|
56 else if (((CJavaRegServerSession*)(aMsg.Session()))->IsLegacy() && |
|
57 (aMsg.SecureId() == AllowedClientSecureId_JavaHelperServer || |
|
58 aMsg.SecureId() == AllowedClientSecureId_AppInstUi)) |
|
59 { |
|
60 return CPolicyServer::EPass; |
|
61 } |
|
62 else |
|
63 { |
|
64 aAction = CPolicyServer::EFailClient; |
|
65 return CPolicyServer::EFail; |
|
66 } |
|
67 // falltrough not possible here |
|
68 case ESetBackupState: |
|
69 if (aMsg.SecureId() == AllowedClientSecureId_Backup) |
|
70 { |
|
71 return CPolicyServer::EPass; |
|
72 } |
|
73 else |
|
74 { |
|
75 aAction = CPolicyServer::EFailClient; |
|
76 return CPolicyServer::EFail; |
|
77 } |
|
78 // falltrough not possible here |
|
79 default: |
|
80 aAction = CPolicyServer::EFailClient; |
|
81 return CPolicyServer::EFail; |
|
82 // falltrough not possible here |
|
83 } |
|
84 } |