#include "common/security_registration.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/format.hpp>
-
#include <unistd.h>
#include <sys/types.h>
#include <manifest_parser/utils/logging.h>
#include "common/utils/file_util.h"
#include "common/utils/glist_range.h"
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace ci = common_installer;
namespace {
const std::vector<std::pair<const char*,
app_install_path_type>> kSecurityPolicies = {
- {"/", SECURITY_MANAGER_PATH_PUBLIC_RO},
+ {".", SECURITY_MANAGER_PATH_PUBLIC_RO},
{"bin", SECURITY_MANAGER_PATH_RO},
{"data", SECURITY_MANAGER_PATH_RW},
{"cache", SECURITY_MANAGER_PATH_RW},
bool PrepareAdditional(const std::string& author_id,
const std::string& api_version,
- const boost::filesystem::path& path,
+ const std::filesystem::path& path,
bool cross_app_rules) {
if (cross_app_rules) {
int error = security_manager_app_inst_req_set_hybrid(req_);
if (!path.empty()) {
app_install_type type = SM_APP_INSTALL_NONE;
for (auto& policy : kPathPolicies) {
- bf::path root = bf::path(policy.first);
+ fs::path root = fs::path(policy.first);
if (ci::IsSubDir(path, root)) {
type = policy.second;
break;
}
bool PreparePath(const std::string& pkg_type,
- const boost::filesystem::path& path, bool is_readonly_pkg,
+ const std::filesystem::path& path, bool is_readonly_pkg,
bool is_extonly) {
if (path.empty()) {
LOG(ERROR) << "Path is empty. This value must be set";
}
app_install_type type = SM_APP_INSTALL_NONE;
for (auto& policy : kPathPolicies) {
- bf::path root = bf::path(policy.first);
+ fs::path root = fs::path(policy.first);
if (ci::IsSubDir(path, root)) {
type = policy.second;
break;
else
policies = kSecurityPolicies;
for (auto& policy : policies) {
- bf::path subpath = path / policy.first;
+ fs::path subpath = path / policy.first;
if (is_extonly) {
// Now, this is for legacy migraton.
// do not try to access any file before changing label,
if (pkg_type == "wgt" && (subdir == "bin" || subdir == "lib"))
continue;
} else {
- if (!bf::exists(subpath))
+ if (!fs::exists(subpath))
continue;
- if (bf::is_symlink(symlink_status(subpath)) &&
+ if (fs::is_symlink(symlink_status(subpath)) &&
policy.second != SECURITY_MANAGER_PATH_OWNER_RW_OTHER_RO) {
LOG(DEBUG) << "Path " << subpath << " is a symlink."
<< "Path will not be registered";
// this is for lib rpk installation. set public RO for contents only.
if (pkg_type == "rpk" && std::string(policy.first) == "lib") {
- for (bf::directory_iterator iter(subpath);
- iter != bf::directory_iterator(); ++iter) {
+ for (fs::directory_iterator iter(subpath);
+ iter != fs::directory_iterator(); ++iter) {
error = security_manager_path_req_add_path(req_,
iter->path().string().c_str(), SECURITY_MANAGER_PATH_PUBLIC_RO);
if (error!= SECURITY_MANAGER_SUCCESS) {
std::string* error_message) {
std::string pkg_id = context->pkgid.get();
std::string pkg_type = context->pkg_type.get();
- bf::path path = context->GetPkgPath();
+ fs::path path = context->GetPkgPath();
uid_t uid = context->uid.get();
const ci::CertificateInfo* cert_info = &(context->certificate_info.get());
manifest_x* manifest = context->manifest_data.get();
}
bool RegisterSecurityContextForPath(const std::string &pkg_id,
- const std::string& pkg_type, const boost::filesystem::path& path,
+ const std::string& pkg_type, const std::filesystem::path& path,
uid_t uid, bool is_readonly_pkg, std::string* error_message) {
SecurityContextPathRequest req;
if (!req.IsValid()) {
}
bool RegisterSecurityContextForPathExternalOnly(const std::string &pkg_id,
- const std::string &pkg_type, const boost::filesystem::path& path,
+ const std::string &pkg_type, const std::filesystem::path& path,
uid_t uid, std::string* error_message) {
SecurityContextPathRequest req;
if (!req.IsValid()) {
return result;
}
-bool HasOwnerRwOtherRoPaths(const boost::filesystem::path& path) {
+bool HasOwnerRwOtherRoPaths(const std::filesystem::path& path) {
for (auto& policy : kSecurityPolicies) {
if (policy.second != SECURITY_MANAGER_PATH_OWNER_RW_OTHER_RO)
continue;
- bf::path subpath = path / policy.first;
+ fs::path subpath = path / policy.first;
LOG(ERROR) << "subpath : " << subpath;
- if (bf::exists(subpath))
+ if (fs::exists(subpath))
return true;
}