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_
14 #include "common/installer_context.h"
16 namespace common_installer {
19 * Adapter interface for external Security module.
21 * Adapter interface for external Security module used for registering
22 * package to security context
24 * \param context installer context contains necessary information
25 * \param error_message extra/detailed error message
27 * \return true if success
29 bool RegisterSecurityContextForManifest(
30 const common_installer::InstallerContext* context,
31 std::string* error_message);
34 * Adapter interface for external Security module.
36 * Adapter interface for external Security module used for unregistering
37 * package from security context
39 * \param pkg_id pkgid of given package
40 * \param pkg_type type of given package*
42 * \param manifest pointer to manifest structure
43 * \param error_message extra/detailed error message
45 * \return true if success
47 bool UnregisterSecurityContextForManifest(const std::string& pkg_id,
48 const std::string& pkg_type, uid_t uid, manifest_x* manifest,
49 std::string* error_message);
52 * Adapter interface for external Security module.
54 * Adapter interface for external Security module used for unregistering
55 * package from security context
57 * \param pkg_id pkgid of given package
58 * \param pkg_type type of given package
60 * \param error_message extra/detailed error message
61 * \param ignore_data_absence optional, default set to false, indicate if
62 * failure of querying appids for pkgid should return
65 * \return true if success
67 bool UnregisterSecurityContextForPkgId(const std::string& pkg_id,
68 const std::string& pkg_type, uid_t uid, std::string* error_message,
69 bool ignore_data_absence = false);
72 * Adapter interface for external Security module.
74 * Adapter interface for external Security module used for registering
75 * package path to security context
77 * \param pkg_id pkgid of given package
78 * \param pkg_type pkg type of given package
79 * \param path path for registering
81 * \param is_readonly_pkg RO package flag
82 * \param error_message extra/detailed error message
84 * \return true if success
86 bool RegisterSecurityContextForPath(const std::string &pkg_id,
87 const std::string& pkg_type, const std::filesystem::path& path,
88 uid_t uid, bool is_readonly_pkg, std::string* error_message);
91 * Adapter interface for external Security module.
93 * Adapter interface for external Security module used for registering
94 * package external paths to security context
96 * \param pkg_id pkgid of given package
97 * \param pkg_type pkg type of given package
98 * \param path path for registering
100 * \param error_message extra/detailed error message
102 * \return true if success
104 bool RegisterSecurityContextForPathExternalOnly(const std::string &pkg_id,
105 const std::string &pkg_type, const std::filesystem::path& path,
106 uid_t uid, std::string* error_message);
108 bool HasOwnerRwOtherRoPaths(const std::filesystem::path& path);
110 } // namespace common_installer
112 #endif // COMMON_SECURITY_REGISTRATION_H_