Add privacy checker and modify build files
authorHyunwoo Kim <hwlove.kim@samsung.com>
Tue, 19 Mar 2013 12:57:04 +0000 (21:57 +0900)
committerHyunwoo Kim <hwlove.kim@samsung.com>
Tue, 19 Mar 2013 12:57:14 +0000 (21:57 +0900)
Change-Id: Ifc3d332b289074df27be36f40b5728ce89d1965b
Signed-off-by: Hyunwoo Kim <hwlove.kim@samsung.com>
16 files changed:
CMakeLists.txt
capi-security-privacy-manager.pc.in
capi/CMakeLists.txt
capi/src/privacy_manager.c [moved from capi/src/privacy-manager.c with 100% similarity]
client/CMakeLists.txt
client/inc/privacy_checker_client.h [new file with mode: 0644]
client/inc/privacy_manager_client.h
client/src/PrivacyManager.cpp
client/src/privacy_checker_client.cpp [new file with mode: 0644]
client/src/privacy_manager_client.cpp
common/inc/PrivacyIdInfo.h [new file with mode: 0644]
common/inc/PrivacyInfo.h [deleted file]
common/src/PrivacyIdInfo.cpp [new file with mode: 0644]
packaging/privacy-manager.spec
privacy-manager-client.pc.in
server/src/PrivacyManagerServer.cpp

index 5719ee7..e335471 100644 (file)
@@ -14,4 +14,4 @@ ADD_DEFINITIONS("-DUSE_IPC_EPOLL")
 ADD_SUBDIRECTORY(server)\r
 ADD_SUBDIRECTORY(client)\r
 #ADD_SUBDIRECTORY(test)\r
-#ADD_SUBDIRECTORY(capi)\r
+ADD_SUBDIRECTORY(capi)\r
index 516dca4..5e27298 100755 (executable)
@@ -11,5 +11,5 @@ Description: @PACKAGE_DESCRIPTION@
 Version: @VERSION@
 Requires: @PC_REQUIRED@ 
 Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @PC_CFLAGS@
 
index 162f60b..d495d2e 100755 (executable)
@@ -8,7 +8,10 @@ SET(CMAKE_INSTALL_PREFIX /usr)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
 SET(INC_DIR include)
-INCLUDE_DIRECTORIES(${INC_DIR} /usr/include/privacy_manager)
+
+INCLUDE_DIRECTORIES(${INC_DIR} 
+       "${CMAKE_SOURCE_DIR}/client/inc/"
+       "${CMAKE_SOURCE_DIR}/common/inc/")
 
 #SET(requires capi-base-common dlog privacy-manager-client glib-2.0)
 SET(pc_requires "capi-base-common")
index 90c578f..80c4c9e 100644 (file)
@@ -47,9 +47,11 @@ INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS} ${client_include_dir} ${common_include_
 SET(PRIVACY_MANAGER_CLIENT_SOURCES 
        ${common_src_dir}/SocketConnection.cpp
        ${common_src_dir}/SocketStream.cpp
+       ${common_src_dir}/PrivacyIdInfo.cpp
        ${client_src_dir}/SocketClient.cpp
        ${client_src_dir}/PrivacyManager.cpp
        ${client_src_dir}/PrivacyChecker.cpp
+       ${client_src_dir}/privacy_checker_client.cpp
        ${client_src_dir}/privacy_info_client.cpp
        ${client_src_dir}/privacy_manager_client.cpp
        )
@@ -59,14 +61,13 @@ SET(PRIVACY_MANAGER_CLIENT_HEADERS
        ${client_include_dir}/PrivacyChecker.h
        ${client_include_dir}/privacy_info_client.h
        ${client_include_dir}/privacy_manager_client.h
+       ${client_include_dir}/privacy_checker_client.h
        ${common_include_dir}/privacy_manager_client_types.h
 )
 SET(PRIVACY_MANAGER_CLIENT_LDFLAGS " -module -avoid-version ")
 SET(PRIVACY_MANAGER_CLIENT_CFLAGS  " ${CFLAGS} -fPIC ")
 #SET(PRIVACY_MANAGER_CLIENT_LIBADD " ")
 
-SET(PC_CFLAGS -I\${includedir}/privacy_manager)
-
 ADD_DEFINITIONS("-DLOG_TAG=\"PRIVACY-MANAGER-CLIENT\"")
 ADD_LIBRARY(privacy-manager-client SHARED ${PRIVACY_MANAGER_CLIENT_SOURCES})
 TARGET_LINK_LIBRARIES(privacy-manager-client ${pkgs_LDFLAGS} ${pkgs_LIBRARIES})
@@ -75,6 +76,11 @@ SET_TARGET_PROPERTIES(privacy-manager-client PROPERTIES SOVERSION ${VERSION_MAJO
 SET_TARGET_PROPERTIES(privacy-manager-client PROPERTIES VERSION ${VERSION})
 ###################################################################################################
 
+SET(PC_NAME privacy-manager-client)
+SET(PC_DESCRIPTION "Privacy Manager Client API")
+SET(PC_LDFLAGS -lprivacy-manager-client)
+SET(PC_CFLAGS -I\${includedir}/privacy_manager)
+
 CONFIGURE_FILE(../privacy-manager-client.pc.in privacy-manager-client.pc @ONLY)
 
 INSTALL(TARGETS privacy-manager-client DESTINATION ../lib COMPONENT RuntimeLibraries)
diff --git a/client/inc/privacy_checker_client.h b/client/inc/privacy_checker_client.h
new file mode 100644 (file)
index 0000000..aa453f6
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License. \r
+ */\r
+\r
+#ifndef _PRIVACY_INFO_CLIENT_H\r
+#define _PRIVACY_INFO_CLIENT_H\r
+\r
+#include <privacy_manager_client_types.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+EXTERN_API int privacy_checker_initialize(const char *package_id);\r
+EXTERN_API int privacy_checker_check_privacy(const char *privacy_id);\r
+EXTERN_API int privacy_checker_check_privacy_by_privilege(const char *privilege_id);\r
+EXTERN_API int privacy_checker_check_privacy_by_device_cap(const char *device_cap);\r
+EXTERN_API int privacy_checker_finalize(void);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif //_PRIVACY_INFO_CLIENT_H\r
index 5611c79..a67f6c5 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License. \r
  */\r
 \r
-#ifndef __TIZEN_PRIVACYMGR_PRIVACY_MANAGER_CLIENT_H\r
-#define __TIZEN_PRIVACYMGR_PRIVACY_MANAGER_CLIENT_H\r
+#ifndef _PRIVACY_MANAGER_CLIENT_H\r
+#define _PRIVACY_MANAGER_CLIENT_H\r
 \r
 #include <privacy_info_client.h>\r
 #include <privacy_manager_client_types.h>\r
index fd6115a..fca7d71 100644 (file)
@@ -16,6 +16,7 @@
 \r
 #include <PrivacyManager.h>\r
 #include <SocketClient.h>\r
+#include <PrivacyIdInfo.h>\r
 #include <algorithm> \r
 #include <memory>\r
 #include <Utils.h>\r
@@ -43,8 +44,18 @@ int
 PrivacyManager::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& pList)\r
 {\r
        int result;\r
+\r
+       std::list < std::string > privacyList;\r
+\r
+       result = PrivacyIdInfo::getPrivacyIdListFromPrivilegeList(pList, privacyList);\r
+       if (result != PRIV_MGR_ERROR_SUCCESS )\r
+               return result;\r
+\r
+       if (privacyList.size() == 0)\r
+               return PRIV_MGR_ERROR_SUCCESS;\r
+\r
        m_pSocketClient->connect();\r
-       m_pSocketClient->call("addPrivacyInfo", pkgId, pList, &result);\r
+       m_pSocketClient->call("addPrivacyInfo", pkgId, privacyList, &result);\r
        m_pSocketClient->disconnect();\r
 \r
        return result;\r
diff --git a/client/src/privacy_checker_client.cpp b/client/src/privacy_checker_client.cpp
new file mode 100644 (file)
index 0000000..87a01e8
--- /dev/null
@@ -0,0 +1,67 @@
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License. \r
+ */\r
+\r
+#include <string.h>\r
+#include <string>\r
+#include <memory>\r
+#include <PrivacyManager.h>\r
+#include <privacy_manager_client.h>\r
+#include <privacy_manager_client_types.h>\r
+#include "privacy_manager_client_internal_types.h"\r
+#include <PrivacyChecker.h>\r
+#include <privacy_checker_client.h>\r
+#include <privacy_info_client.h>\r
+#include <PrivacyIdInfo.h>\r
+\r
+int privacy_checker_initialize(const char *package_id)\r
+{\r
+       return PrivacyChecker::initialize(std::string(package_id));\r
+}\r
+\r
+int privacy_checker_check_privacy(const char *privacy_id)\r
+{\r
+       return PrivacyChecker::check(std::string(privacy_id));\r
+}\r
+int privacy_checker_check_privacy_by_privilege(const char *privilege_id)\r
+{\r
+       int res;\r
+       std::string privacyId;\r
+\r
+       res = PrivacyIdInfo::getPrivacyIdFromPrivilege(std::string(privilege_id), privacyId);\r
+       if (res != PRIV_MGR_ERROR_SUCCESS)\r
+               return res;\r
+\r
+       return PrivacyChecker::check(privacyId);\r
+\r
+}\r
+\r
+int privacy_checker_check_privacy_by_device_cap(const char *device_cap)\r
+{\r
+       int res;\r
+       std::string privacyId;\r
+\r
+       res = PrivacyIdInfo::getPrivacyIdFromDeviceCap(std::string(device_cap), privacyId);\r
+       if (res != PRIV_MGR_ERROR_SUCCESS)\r
+               return res;\r
+\r
+       return PrivacyChecker::check(privacyId);\r
+\r
+}\r
+\r
+int privacy_checker_finalize(void)\r
+{\r
+       return PrivacyChecker::finalize();\r
+}\r
index 84fc2a5..eb9c155 100644 (file)
@@ -50,9 +50,8 @@ int privacy_manager_client_install_privacy(const char *package_id, const char**
        std::list < std::string > privacyList;\r
 \r
        while (*privacy_list != NULL)\r
-       {\r
                privacyList.push_back(std::string(*privacy_list ++));\r
-       }\r
+\r
        retval = pInst->addAppPackagePrivacyInfo(std::string(package_id), privacyList);\r
 \r
        return retval;\r
diff --git a/common/inc/PrivacyIdInfo.h b/common/inc/PrivacyIdInfo.h
new file mode 100644 (file)
index 0000000..6e75092
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ *    Licensed under the Apache License, Version 2.0 (the "License");\r
+ *    you may not use this file except in compliance with the License.\r
+ *    You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ */\r
+\r
+#ifndef _PRIVACY_ID_INFO_H_\r
+#define _PRIVACY_ID_INFO_H_\r
+\r
+#include <string>\r
+#include <map>\r
+#include <list>\r
+\r
+class PrivacyIdInfo\r
+{\r
+private:\r
+       static std::map <std::string, std::string> m_privilegeToPrivacyMap;\r
+       static std::map <std::string, std::string> m_deviceCapToPrivacyMap;\r
+       static bool m_isInitialized;\r
+\r
+public:\r
+       static void initialize(void);\r
+       static int getPrivacyIdFromPrivilege(const std::string privilege, std::string& privacyId);\r
+       static int getPrivacyIdFromDeviceCap(const std::string deviceCap, std::string& privacyId);\r
+\r
+       static int getPrivacyIdListFromPrivilegeList(const std::list < std::string> privilegeList, std::list < std::string> & privacyIdList);\r
+};\r
+\r
+#endif //_PRIVACY_ID_INFO_H_
\ No newline at end of file
diff --git a/common/inc/PrivacyInfo.h b/common/inc/PrivacyInfo.h
deleted file mode 100644 (file)
index 6ab6629..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*\r
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- *    Licensed under the Apache License, Version 2.0 (the "License");\r
- *    you may not use this file except in compliance with the License.\r
- *    You may obtain a copy of the License at\r
- *\r
- *        http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *    Unless required by applicable law or agreed to in writing, software\r
- *    distributed under the License is distributed on an "AS IS" BASIS,\r
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *    See the License for the specific language governing permissions and\r
- *    limitations under the License.\r
- */\r
-\r
-#ifndef _PRIVACY_INFO_H_\r
-#define _PRIVACY_INFO_H_\r
-\r
-#include <string>\r
-\r
-struct PrivacyPrivilegePair\r
-{\r
-       char privilege[128];\r
-       char privacy[128];\r
-\r
-};\r
-\r
-struct PrivacyPrivilegePair PrivilegeToPrivacyTable[] =\r
-{\r
-       {"http://tizendev.org/privilege/contact.read", "http://tizendev.org/privilege/contact"},\r
-       {"http://tizendev.org/privilege/contact.write", "http://tizendev.org/privilege/contact"},\r
-       {NULL, NULL}\r
-};\r
-\r
-class PrivacyInfo\r
-{\r
-public:\r
-       static std::string GetPrivacyId(const std::string& privilegeId)\r
-       {\r
-               int i = 0;\r
-               while (PrivilegeToPrivacyTable[i].privilege != NULL)            \r
-               {\r
-                       if ( strncmp(privilegeId.c_str(), PrivilegeToPrivacyTable[i].privilege, privilegeId.size()) == 0)\r
-                               return std::string(PrivilegeToPrivacyTable[i].privacy);\r
-               }\r
-               return std::string("");\r
-       }\r
-}\r
-#endif //_PRIVACY_INFO_H_
\ No newline at end of file
diff --git a/common/src/PrivacyIdInfo.cpp b/common/src/PrivacyIdInfo.cpp
new file mode 100644 (file)
index 0000000..ef8b260
--- /dev/null
@@ -0,0 +1,171 @@
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ *    Licensed under the Apache License, Version 2.0 (the "License");\r
+ *    you may not use this file except in compliance with the License.\r
+ *    You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ */\r
+\r
+#include <PrivacyIdInfo.h>\r
+#include <privacy_manager_client_types.h>\r
+#include <dlog.h>\r
+#include <set>\r
+\r
+\r
+std::map <std::string, std::string> PrivacyIdInfo::m_privilegeToPrivacyMap;\r
+std::map <std::string, std::string> PrivacyIdInfo::m_deviceCapToPrivacyMap;\r
+bool PrivacyIdInfo:: m_isInitialized;\r
+\r
+\r
+struct PrivacyPrivilegePair\r
+{\r
+       char privilege[128];\r
+       char privacy[128];\r
+};\r
+\r
+struct PrivacyDeviceCapPair\r
+{\r
+       char DeviceCap[128];\r
+       char privacy[128];\r
+};\r
+\r
+static struct PrivacyPrivilegePair DeviceCapToPrivacyTable[] =\r
+{\r
+       {"bluetooth.admin", "bluetooth"},\r
+       {"bluetooth.gap", "bluetooth"},\r
+       {"bluetooth.spp", "bluetooth"},\r
+       {"bluetoothmanager", "bluetooth"},\r
+\r
+       {"calendar.read", "calender"},\r
+       {"calendar.write", "calender"},\r
+\r
+       {"contact.read", "contact"},\r
+       {"contact.write", "contact"},\r
+\r
+       {"messaging.read", "messaging"},\r
+       {"messaging.write", "messaging"},\r
+       {"messaging.send", "messaging"},\r
+\r
+       {"nfc.admin", "nfc"},\r
+       {"nfcmanager.cardemulation", "nfc"},\r
+       {"nfc.common", "nfc"},\r
+       {"nfc.p2p", "nfc"},\r
+       {"nfc.tag", "nfc"},\r
+\r
+       {"XMLHttpRequest", "internet"},\r
+       {"externalNetworkAccess", "internet"},\r
+\r
+       {"\0", "\0"}\r
+};\r
+\r
+static struct PrivacyPrivilegePair PrivilegeToPrivacyTable[] =\r
+{\r
+       {"http://tizen.org/privilege/bluetooth.admin", "bluetooth"},\r
+       {"http://tizen.org/privilege/bluetooth.gap", "bluetooth"},\r
+       {"http://tizen.org/privilege/bluetooth.health", "bluetooth"},\r
+       {"http://tizen.org/privilege/bluetooth.opp", "bluetooth"},\r
+       {"http://tizen.org/privilege/bluetooth.spp", "bluetooth"},\r
+       {"http://tizen.org/privilege/bluetoothmanager", "bluetooth"},\r
+\r
+       {"http://tizen.org/privilege/calendar.read", "calender"},\r
+       {"http://tizen.org/privilege/calendar.write", "calender"},\r
+\r
+       {"http://tizen.org/privilege/contact.read", "contact"},\r
+       {"http://tizen.org/privilege/contact.write", "contact"},\r
+\r
+       {"http://tizen.org/privilege/contextmanager.privacy", "context"},\r
+       {"http://tizen.org/privilege/contextmanager.upload", "context"},\r
+\r
+       {"http://tizen.org/privilege/location", "location"},\r
+\r
+       {"http://tizen.org/privilege/messaging.read", "messaging"},\r
+       {"http://tizen.org/privilege/messaging.write", "messaging"},\r
+\r
+       {"http://tizen.org/privilege/nfc.admin", "nfc"},\r
+       {"http://tizen.org/privilege/nfcmanager.cardemulation", "nfc"},\r
+       {"http://tizen.org/privilege/nfc.common", "nfc"},\r
+       {"http://tizen.org/privilege/nfc.p2p", "nfc"},\r
+       {"http://tizen.org/privilege/nfc.tag", "nfc"},\r
+\r
+       {"http://tizen.org/privilege/http", "internet"},\r
+       {"http://tizen.org/privilege/socket", "internet"},\r
+       {"http://tizen.org/privilege/web.service", "internet"},\r
+\r
+       {"\0", "\0"}\r
+};\r
+\r
+\r
+void\r
+PrivacyIdInfo::initialize(void)\r
+{\r
+               int i = 0;\r
+               while (PrivilegeToPrivacyTable[i].privilege[0] != '\0')         \r
+               {\r
+                       m_privilegeToPrivacyMap.insert(std::map < std::string, std::string >::value_type(std::string(PrivilegeToPrivacyTable[i].privilege), std::string(PrivilegeToPrivacyTable[i].privacy)));\r
+                       ++i;\r
+               }\r
+\r
+               i = 0;\r
+               while (DeviceCapToPrivacyTable[i].privilege[0] != '\0')         \r
+               {\r
+                       m_deviceCapToPrivacyMap.insert(std::map < std::string, std::string >::value_type(std::string(DeviceCapToPrivacyTable[i].privilege), std::string(DeviceCapToPrivacyTable[i].privacy)));\r
+                       ++i;\r
+               }\r
+               m_isInitialized = true;\r
+}\r
+\r
+int\r
+PrivacyIdInfo::getPrivacyIdFromPrivilege(const std::string privilege, std::string& privacyId)\r
+{\r
+       if (!m_isInitialized)\r
+               initialize();\r
+       std::map < std::string, std::string >::iterator iter = m_privilegeToPrivacyMap.find(privilege);\r
+       if (iter == m_privilegeToPrivacyMap.end())\r
+               return PRIV_MGR_ERROR_NO_DATA;\r
+       privacyId =  iter->second;\r
+\r
+       return PRIV_MGR_ERROR_SUCCESS;\r
+}\r
+\r
+int\r
+PrivacyIdInfo::getPrivacyIdFromDeviceCap(const std::string deviceCap, std::string& privacyId)\r
+{\r
+       if (!m_isInitialized)\r
+               initialize();\r
+       std::map < std::string, std::string >::iterator iter = m_deviceCapToPrivacyMap.find(deviceCap);\r
+       if (iter == m_deviceCapToPrivacyMap.end())\r
+               return PRIV_MGR_ERROR_NO_DATA;\r
+       privacyId =  iter->second;\r
+       return PRIV_MGR_ERROR_SUCCESS;\r
+}\r
+\r
+int\r
+PrivacyIdInfo::getPrivacyIdListFromPrivilegeList(const std::list < std::string> privilegeList, std::list < std::string> & privacyIdList)\r
+{\r
+       privacyIdList.clear();\r
+\r
+       std::set <std::string> privacyIdSet;\r
+\r
+       for (std::list < std::string > ::const_iterator iter = privilegeList.begin(); iter != privilegeList.end(); ++iter)\r
+       {\r
+               std::string privacyId;\r
+               int res = getPrivacyIdFromPrivilege(*iter, privacyId);\r
+               if (res == PRIV_MGR_ERROR_SUCCESS)\r
+                       privacyIdSet.insert(privacyId);\r
+       }\r
+       \r
+       for (std::set < std::string >::iterator iter = privacyIdSet.begin(); iter != privacyIdSet.end(); ++iter)\r
+       {\r
+               privacyIdList.push_back(*iter);\r
+       }\r
+\r
+       return PRIV_MGR_ERROR_SUCCESS;\r
+}
\ No newline at end of file
index f1af038..80a6d04 100644 (file)
@@ -51,29 +51,29 @@ Requires:   privacy-manager-client = %{version}-%{release}
 %description -n privacy-manager-client-devel
 Privacy Management(development files)
 
-#%package -n capi-security-privacy-manager
-#Summary:    Privacy Manager API
-#Version:    0.0.1
-#Release:    0
-#Group:      TO_BE/FILLED_IN
-#License:    TO BE FILLED IN
-#BuildRequires:  cmake
-#BuildRequires:  pkgconfig(dlog)
-#BuildRequires:  pkgconfig(capi-base-common)
-#BuildRequires:  pkgconfig(glib-2.0)
-#Requires(post): /sbin/ldconfig  
-#Requires(postun): /sbin/ldconfig
-
-#%description -n capi-security-privacy-manager
-#The Privacy Manager API provides functions to get/set information about privacy information of installed packages.
-
-#%package  -n capi-security-privacy-manager-devel
-#Summary:  Privacy Manager API (Development)
-#Group:    TO_BE/FILLED_IN
-#Requires: %{name} = %{version}-%{release}
-
-#%description -n capi-security-privacy-manager-devel
-#The Privacy Manager API provides functions to get/set information about privacy information of installed packages.(DEV)
+%package -n capi-security-privacy-manager
+Summary:    Privacy Manager API
+Version:    0.0.1
+Release:    0
+Group:      TO_BE/FILLED_IN
+License:    TO BE FILLED IN
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(glib-2.0)
+Requires(post): /sbin/ldconfig  
+Requires(postun): /sbin/ldconfig
+
+%description -n capi-security-privacy-manager
+The Privacy Manager API provides functions to get/set information about privacy information of installed packages.
+
+%package  -n capi-security-privacy-manager-devel
+Summary:  Privacy Manager API (Development)
+Group:    TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description -n capi-security-privacy-manager-devel
+The Privacy Manager API provides functions to get/set information about privacy information of installed packages.(DEV)
 
 %prep
 %setup -q
@@ -109,8 +109,8 @@ install -D %{SOURCE2} %{buildroot}%{_datadir}/privacy-manager-client.manifest
 %make_install -n privacy-manager-server
 install -D %{SOURCE1} %{buildroot}%{_datadir}/privacy-manager-server.manifest
 
-#%make_install -n capi-security-privacy-manager
-#install -D %{SOURCE4} %{buildroot}%{_datadir}/capi-security-privacy-manager.manifest
+%make_install -n capi-security-privacy-manager
+install -D %{SOURCE4} %{buildroot}%{_datadir}/capi-security-privacy-manager.manifest
 
 #mkdir -p %{buildroot}/etc/rc.d/rc3.d
 #mkdir -p %{buildroot}/etc/rc.d/rc5.d
@@ -127,7 +127,7 @@ rm -rf %{buildroot}
 %post
 /sbin/ldconfig
 
-if [ ! -f /opt/dbspace/.ace.db ]
+if [ ! -f /opt/dbspace/.privacy.db ]
 then
        /usr/bin/privacy_manager_create_clean_db.sh
 fi
@@ -146,6 +146,9 @@ fi
 #/etc/rc.d/rc5.d/S10privacy-manager-server.sh
 /usr/share/license/privacy-manager-server
 
+%files -n privacy-manager-server-devel
+%{_libdir}/pkgconfig/privacy-manager-server.pc
+
 %files -n privacy-manager-client
 %defattr(-,root,root,-)
 %manifest %{_datadir}/privacy-manager-client.manifest
@@ -155,14 +158,14 @@ fi
 %files -n privacy-manager-client-devel
 %defattr(-,root,root,-)
 %{_includedir}/*
-%{_libdir}/pkgconfig/*
+%{_libdir}/pkgconfig/privacy-manager-client.pc
 
-#%files -n capi-security-privacy-manager
-#%{_libdir}/libcapi-security-privacy-manager.so.*
-#%manifest %{_datadir}/capi-security-privacy-manager.manifest
+%files -n capi-security-privacy-manager
+%{_libdir}/libcapi-security-privacy-manager.so.*
+%manifest %{_datadir}/capi-security-privacy-manager.manifest
 
-#%files -n capi-security-privacy-manager-devel
-#%{_includedir}/privacymgr/*.h
-#%{_libdir}/libcapi-security-privacy-manager.so
-#%{_libdir}/pkgconfig/*.pc
+%files -n capi-security-privacy-manager-devel
+%{_includedir}/privacymgr/*.h
+%{_libdir}/libcapi-security-privacy-manager.so
+%{_libdir}/pkgconfig/capi-security-privacy-manager.pc
 
index 4c6d5c4..6f117ea 100644 (file)
@@ -1,9 +1,11 @@
 prefix=@PREFIX@
 exec_prefix=@EXEC_PREFIX@
 libdir=@LIBDIR@
-includedir=/usr/lib/privacy_manager
+includedir=/usr/include
 
-Name: privacy-manager-client
-Description: Privacy Manager Client
+Name: @PC_NAME@
+Description: @PC_DESCRIPTION@
 Version: @VERSION@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: @PC_CFLAGS@
 Requires: 
index b95fe31..c54d87b 100644 (file)
@@ -223,7 +223,8 @@ PrivacyManagerServer::addAppPackagePrivacyInfo(const std::string pkgId, const st
                res = sqlite3_bind_text(pPrivacyStmt.get(), 2, iter->c_str(), -1, SQLITE_TRANSIENT);\r
                TryReturn( res == SQLITE_OK, PRIV_MGR_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);\r
                \r
-               res = sqlite3_bind_int(pPrivacyStmt.get(), 3, 0);\r
+               // Before setting app and popup is ready, default value is true\r
+               res = sqlite3_bind_int(pPrivacyStmt.get(), 3, 1);\r
                TryReturn( res == SQLITE_OK, PRIV_MGR_ERROR_DB_ERROR, , "sqlite3_bind_int : %d", res);\r
 \r
                res = sqlite3_step(pPrivacyStmt.get());\r