1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_SECURITY_REGISTRATION_H_
6 #define COMMON_SECURITY_REGISTRATION_H_
8 #include <boost/filesystem/path.hpp>
10 #include <sys/types.h>
15 #include "common/installer_context.h"
17 namespace common_installer {
20 * Adapter interface for external Security module.
22 * Adapter interface for external Security module used for registering
23 * package to security context
25 * \param context installer context contains necessary information
26 * \param error_message extra/detailed error message
28 * \return true if success
30 bool RegisterSecurityContextForManifest(
31 const common_installer::InstallerContext* context,
32 std::string* error_message);
35 * Adapter interface for external Security module.
37 * Adapter interface for external Security module used for unregistering
38 * package from security context
40 * \param pkg_id pkgid of given package
41 * \param pkg_type type of given package*
43 * \param manifest pointer to manifest structure
44 * \param error_message extra/detailed error message
46 * \return true if success
48 bool UnregisterSecurityContextForManifest(const std::string& pkg_id,
49 const std::string& pkg_type, uid_t uid, manifest_x* manifest,
50 std::string* error_message);
53 * Adapter interface for external Security module.
55 * Adapter interface for external Security module used for unregistering
56 * package from security context
58 * \param pkg_id pkgid of given package
59 * \param pkg_type type of given package
61 * \param error_message extra/detailed error message
62 * \param ignore_data_absence optional, default set to false, indicate if
63 * failure of querying appids for pkgid should return
66 * \return true if success
68 bool UnregisterSecurityContextForPkgId(const std::string& pkg_id,
69 const std::string& pkg_type, uid_t uid, std::string* error_message,
70 bool ignore_data_absence = false);
73 * Adapter interface for external Security module.
75 * Adapter interface for external Security module used for registering
76 * package path to security context
78 * \param pkg_id pkgid of given package
79 * \param pkg_type pkg type of given package
80 * \param path path for registering
82 * \param is_readonly_pkg RO package flag
83 * \param error_message extra/detailed error message
85 * \return true if success
87 bool RegisterSecurityContextForPath(const std::string &pkg_id,
88 const std::string& pkg_type, const boost::filesystem::path& path,
89 uid_t uid, bool is_readonly_pkg, std::string* error_message);
92 * Adapter interface for external Security module.
94 * Adapter interface for external Security module used for registering
95 * package external paths to security context
97 * \param pkg_id pkgid of given package
98 * \param pkg_type pkg type of given package
99 * \param path path for registering
101 * \param error_message extra/detailed error message
103 * \return true if success
105 bool RegisterSecurityContextForPathExternalOnly(const std::string &pkg_id,
106 const std::string &pkg_type, const boost::filesystem::path& path,
107 uid_t uid, std::string* error_message);
109 bool HasOwnerRwOtherRoPaths(const boost::filesystem::path& path);
111 } // namespace common_installer
113 #endif // COMMON_SECURITY_REGISTRATION_H_