INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CAPI} DESTINATION ${INCLUDE_INSTALL_DIR}/dpm)
-
-#Tizen Device Security Monitor Client Library
-ADD_SUBDIRECTORY(dsm)
+++ /dev/null
-#
-# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-PROJECT(dsm)
-SET(LIB_VERSION "${VERSION}")
-SET(LIB_SOVERSION "0")
-
-SET(PC_FILE "${PROJECT_NAME}.pc")
-
-SET(FOUNDATION ../policy-client.cpp
- ../dpm/client-handle.cpp
-)
-
-SET(SECURITY_MONITOR smack.cpp
- dsm/smack.cpp
-)
-
-SET(CAPI dsm/smack.h
-)
-
-SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${FOUNDATION} ${SECURITY_MONITOR})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${LIB_SOVERSION})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${LIB_VERSION})
-
-PKG_CHECK_MODULES(DSM_LIBS_DEPS REQUIRED
- klay
- glib-2.0
-)
-
-INCLUDE_DIRECTORIES(SYSTEM ${DSM_LIBS_DEPS_INCLUDE_DIRS} ../ ../dpm dsm)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${DSM_LIBS_DEPS_LIBRARIES} pthread)
-
-CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
-
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CAPI} DESTINATION ${INCLUDE_INSTALL_DIR}/dsm)
+++ /dev/null
-# Package Information for pkg-config
-
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
-
-Name: dsm
-Description: Tizen Device Security Monitor Client library
-Version: @VERSION@
-Libs: -L${libdir} -ldsm
-Cflags: -I${includedir}/dpm -I${includedir}/dsm
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-/**
- * @file smack.cpp
- * @brief Implementation of SMACK agent module.
- * @author Dmytro Logachev (d.logachev@samsung.com)
- * @date Created Oct 13, 2016
- * @par In Samsung Ukraine R&D Center (SRK) under a contract between
- * @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
- * @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- * @par Copyright: (c) Samsung Electronics Co, Ltd 2016. All rights reserved.
-**/
-
-#include <cstring>
-#include <cassert>
-
-#include "smack.h"
-#include "smack.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_smack_get_report(device_policy_manager_h handle, char **report)
-{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
- RET_ON_FAILURE(report, DPM_ERROR_INVALID_PARAMETER);
-
- DevicePolicyContext &client = GetDevicePolicyContext(handle);
- SmackSecurityMonitor smack = client.createPolicyInterface<SmackSecurityMonitor>();
-
- try {
- std::string str = smack.getReport();
- if (!str.empty()) {
- if (str.compare("[]") == 0) {
- return DPM_ERROR_INVALID_PARAMETER;
- }
- *report = ::strdup(str.c_str());
- if (*report == 0)
- return DPM_ERROR_OUT_OF_MEMORY;
- } else {
- return DPM_ERROR_TIMED_OUT;
- }
-
- return DPM_ERROR_NONE;
- } catch (...) {
- return -1;
- }
-}
-
-EXPORT_API int dpm_smack_release_report(char **report)
-{
- RET_ON_FAILURE(*report, DPM_ERROR_INVALID_PARAMETER);
-
- free(*report);
- *report = nullptr;
- return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_smack_get_issue_count(device_policy_manager_h handle, int *count)
-{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
- RET_ON_FAILURE(count, DPM_ERROR_INVALID_PARAMETER);
-
- DevicePolicyContext &client = GetDevicePolicyContext(handle);
- SmackSecurityMonitor smack = client.createPolicyInterface<SmackSecurityMonitor>();
-
- try {
- int issueCount = smack.getIssueCount();
- if (issueCount == -1) {
- return DPM_ERROR_OUT_OF_MEMORY;
- }
-
- *count = issueCount;
-
- return DPM_ERROR_NONE;
- } catch (...) {
- return -1;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-/**
- * @file smack.h
- * @brief Smack agent module external C API.
- * @author Dmytro Logachev (d.logachev@samsung.com)
- * @date Created Oct 13, 2016
- * @par In Samsung Ukraine R&D Center (SRK) under a contract between
- * @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
- * @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- * @par Copyright: (c) Samsung Electronics Co, Ltd 2016. All rights reserved.
-**/
-
-#ifndef __CAPI_SMACK_SECURITY_MONITOR_H__
-#define __CAPI_SMACK_SECURITY_MONITOR_H__
-
-#include <sys/types.h>
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file smack.h
- * @brief This file provides APIs to get/release the smack report and issue count
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_DSM_SMACK_SECURITY_MONITOR_MODULE
- * @{
- */
-
-/**
- * @brief Returns SMACK report.
- * @details This API can be used for requesting current SMACK report
- * @remarks The SMACK report output should be freed using dpm_smart_security_release_report()
- * @param[in] handle SMACK report handle
- * @param[out] report SMACK report string
- * @return #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval #DPM_ERROR_NONE Successful
- * @retval #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #DPM_ERROR_TIMED_OUT Time out
- * @retval #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @pre handle must be created by dpm_context_create()
- */
-int dpm_smack_get_report(device_policy_manager_h handle, char **report);
-
-/**
- * @brief Releases SMACK report.
- * @details This API can be used for releasing previously got SMACK report
- * @remarks The SMACK report should be got using tsm_smack_get_report()
- * @param[in] report SMACK report output
- * @return #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval #DPM_ERROR_NONE Successful
- * @retval #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #DPM_ERROR_TIMED_OUT Time out
- * @retval #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @pre The handle must be created by dpm_context_create().
- */
-int dpm_smack_release_report(char **report);
-
-/**
- * @brief Returns number of SMACK issues.
- * @details This API can be used for requesting current number of
- SMACK issues
- * @param[in] handle SMACK report handle
- * @param[out] count Number of SMACK Issues
- * @return #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval #DPM_ERROR_NONE Successful
- * @retval #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #DPM_ERROR_TIMED_OUT Time out
- * @retval #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @pre The handle must be created by dpm_context_create().
- */
-int dpm_smack_get_issue_count(device_policy_manager_h handle, int *count);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__CAPI_SMACK_SECURITY_MONITOR_H__
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-#include "status.h"
-#include "smack.hxx"
-
-namespace DevicePolicyManager {
-
-struct SmackSecurityMonitor::Private {
- Private(PolicyControlContext &ctx) : context(ctx) {}
- PolicyControlContext &context;
-};
-
-SmackSecurityMonitor::SmackSecurityMonitor(SmackSecurityMonitor &&rhs) = default;
-SmackSecurityMonitor &SmackSecurityMonitor::operator=(SmackSecurityMonitor &&rhs) = default;
-
-SmackSecurityMonitor::SmackSecurityMonitor(const SmackSecurityMonitor &rhs) :
- pimpl(nullptr)
-{
- if (rhs.pimpl) {
- pimpl.reset(new Private(*rhs.pimpl));
- }
-}
-
-SmackSecurityMonitor &SmackSecurityMonitor::operator=(const SmackSecurityMonitor &rhs)
-{
- if (!rhs.pimpl) {
- pimpl.reset();
- } else {
- pimpl.reset(new Private(*rhs.pimpl));
- }
-
- return *this;
-}
-
-SmackSecurityMonitor::SmackSecurityMonitor(PolicyControlContext &ctx) :
- pimpl(new Private(ctx))
-{
-}
-
-SmackSecurityMonitor::~SmackSecurityMonitor()
-{
-}
-
-std::string SmackSecurityMonitor::getReport()
-{
- PolicyControlContext &context = pimpl->context;
-
- Status<std::string> status { std::string() };
-
- status = context.methodCall<std::string>("SmackSecurityMonitor::getReport");
-
- return status.get();
-}
-
-int SmackSecurityMonitor::getIssueCount()
-{
- PolicyControlContext &context = pimpl->context;
-
- Status<int> status { -1 };
-
- status = context.methodCall<int>("SmackSecurityMonitor::getIssueCount");
-
- return status.get();
-}
-
-} // namespace DevicePolicyManager
%{_libdir}/libdpm.so
%{_includedir}/dpm
%{_libdir}/pkgconfig/dpm.pc
-
-## DSM Client Package ######################################################
-%package -n libdsm
-Summary: Tizen Device Security Monitor Client Library
-Group: Development/Libraries
-
-%description -n libdsm
-Tizen Device Security Monitor Client Library.
-
-%post -n libdsm -p /sbin/ldconfig
-
-%postun -n libdsm -p /sbin/ldconfig
-
-%files -n libdsm
-%manifest device-policy-client.manifest
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libdsm.so.%{version}
-%{_libdir}/libdsm.so.0
-
-## DSM Devel Package ##############################################################
-%package -n libdsm-devel
-Summary: Libraries and header files for device security monitor client development
-Group: Development/Libraries
-
-%description -n libdsm-devel
-The libdsm-devel package includes the libraries and header files necessary for
-developing the DSM client program.
-
-%files -n libdsm-devel
-%manifest device-policy-client.manifest
-%defattr(644,root,root,755)
-%{_libdir}/libdsm.so
-%{_includedir}/dsm
-%{_libdir}/pkgconfig/dsm.pc
\ No newline at end of file