1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1012 which will be set when the server is started. The variable will be used to registry |
1012 which will be set when the server is started. The variable will be used to registry |
1013 composition receiver instances. The caller doesn't acquire the ownership of this instance, |
1013 composition receiver instances. The caller doesn't acquire the ownership of this instance, |
1014 thus mustn't delete it. The pointer will be valid until server is operating, |
1014 thus mustn't delete it. The pointer will be valid until server is operating, |
1015 i.e. system is up. |
1015 i.e. system is up. |
1016 |
1016 |
1017 @panic KErrAccessDenied If is called from process other than WSERV. |
|
1018 @return KErrNone if an operation is successful, any other system error codes otherwise |
1017 @return KErrNone if an operation is successful, any other system error codes otherwise |
1019 */ |
1018 */ |
1020 EXPORT_C TInt StartSurfaceUpdateServer(MSurfaceUpdateServerProvider*& aSurfaceUpdateServerProvider) |
1019 EXPORT_C TInt StartSurfaceUpdateServer(MSurfaceUpdateServerProvider*& aSurfaceUpdateServerProvider) |
1021 { |
1020 { |
1022 #ifndef TEST_SURFACE_UPDATE |
1021 #ifndef TEST_SURFACE_UPDATE |
1023 RProcess process; |
1022 TPtrC serverName(KSurfaceUpdateServerName); |
1024 TUidType uidType = process.Type(); |
|
1025 const TInt32 KWservUid = 268450592; |
|
1026 const TUid& uid1 = uidType[2]; |
|
1027 |
|
1028 if(uid1.iUid != KWservUid) //only wserv process can start the server |
|
1029 {// some malicious client tries to launch the server |
|
1030 process.Panic(_L("Access denied"), KErrAccessDenied); |
|
1031 return KErrAccessDenied; |
|
1032 } |
|
1033 TPtrC serverName(KSurfaceUpdateServerName); |
|
1034 #else |
1023 #else |
1035 TPtrC serverName(KTestSurfaceUpdateServerName); |
1024 TPtrC serverName(KTestSurfaceUpdateServerName); |
1036 #endif |
1025 #endif |
1037 TAny *provider = Dll::Tls(); |
1026 TAny *provider = Dll::Tls(); |
1038 if(provider) |
1027 if(provider) |
1039 { |
1028 { |
1040 aSurfaceUpdateServerProvider = static_cast <MSurfaceUpdateServerProvider*> (provider); |
1029 aSurfaceUpdateServerProvider = static_cast <MSurfaceUpdateServerProvider*> (provider); |
1041 return KErrNone; |
1030 return KErrNone; |