Fix prohibit access of app-service
authorJoohyun Kim <joohyune.kim@samsung.com>
Thu, 30 May 2013 10:59:25 +0000 (19:59 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Thu, 30 May 2013 10:59:25 +0000 (19:59 +0900)
Change-Id: I3351d9a4b1d04fae904bc8b9647b46952396ba96
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system/FSys_CommunicationDispatcherClient.cpp

index 4ef0ca8..6e472d4 100644 (file)
@@ -19,6 +19,7 @@
  * @brief              This is the implementation file for _CommunicationDispatcherClient class.
  */
 
+#include <FApp_AppInfo.h>
 #include <FBaseSysLog.h>
 #include <unistd.h>
 #include <sys/types.h>
 
 #include "FSys_CommunicationDispatcherClient.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Io;
 
 namespace Tizen { namespace System
 {
-
+static const wchar_t* _APPLICATION_ID_APP_SERVICE = L"aospd000043.osp-app-service";
 bool ipcReady = false;
 static const wchar_t* _COMMUNICATION_DISPATCHER_IPC_ID = L"osp.app.ipcserver.communicationdispatcher";
 
@@ -45,7 +47,7 @@ _CommunicationDispatcherClient::_CommunicationDispatcherClient()
 
        result r = E_SUCCESS;
 
-       if(getuid() != 0)
+       if(_AppInfo::GetAppInfo()->GetApplicationId() != _APPLICATION_ID_APP_SERVICE)
        {
                __pIpcClient = new (std::nothrow) _IpcClient();
                SysTryCatch(NID_SYS, __pIpcClient != null, , r, "It is failed to create IPC client");
@@ -55,7 +57,11 @@ _CommunicationDispatcherClient::_CommunicationDispatcherClient()
                        ipcReady = false;
                else
                        ipcReady = true;
-       SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "Propagated. [%s]", GetErrorMessage(r));
+               SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "Propagated. [%s]", GetErrorMessage(r));
+       }
+       else
+       {
+               SysLogException(NID_SYS, E_SYSTEM, "It is required by osp-app-service.");
        }
 
 CATCH: