}
}
- if (!path.empty()) {
- for (auto& policy : kSecurityPolicies) {
- bf::path subpath = path / policy.first;
- if (bf::exists(subpath)) {
- if (bf::is_symlink(symlink_status(subpath))) {
- LOG(DEBUG) << "Path " << subpath << " is a symlink."
- << "Path will not be registered";
- continue;
- }
- if (policy.second == SECURITY_MANAGER_PATH_TRUSTED_RW &&
- author_id.empty()) {
- LOG(WARNING) << "the path " << policy.first
- << " exists, but author_id is empty";
- continue;
- }
- error = security_manager_app_inst_req_add_path(req, subpath.c_str(),
- policy.second);
- if (error != SECURITY_MANAGER_SUCCESS) {
- std::string errnum = boost::str(boost::format("%d") % error);
- *error_message =
- security_manager_strerror(static_cast<lib_retcode>(error));
- *error_message += ":<" + errnum + ">";
- return false;
- }
- }
- }
- }
-
for (auto& priv : privileges) {
security_manager_app_inst_req_add_privilege(req, priv.c_str());
}
}
return Status::RECOVERY_ERROR;
}
+ if (!RegisterSecurityContextForPath(
+ context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(),
+ &error_message)) {
+ if (!error_message.empty()) {
+ LOG(ERROR) << "error_message: " << error_message;
+ on_error(Status::SECURITY_ERROR, error_message);
+ }
+ return Status::RECOVERY_ERROR;
+ }
return Status::OK;
}
} // namespace security
}
return Status::SECURITY_ERROR;
}
+ if (!RegisterSecurityContextForPath(
+ context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(),
+ &error_message)) {
+ if (!error_message.empty()) {
+ LOG(ERROR) << "error_message: " << error_message;
+ on_error(Status::SECURITY_ERROR, error_message);
+ }
+ return Status::SECURITY_ERROR;
+ }
LOG(DEBUG) << "Security context installed";
return Status::OK;
}
}
return Status::SECURITY_ERROR;
}
+ if (!RegisterSecurityContextForPath(
+ context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(),
+ &error_message)) {
+ if (!error_message.empty()) {
+ LOG(ERROR) << "error_message: " << error_message;
+ on_error(Status::SECURITY_ERROR, error_message);
+ }
+ return Status::SECURITY_ERROR;
+ }
LOG(DEBUG) << "Security context installed";
return Status::OK;
}
} // namespace security
} // namespace common_installer
-
}
return Status::SECURITY_ERROR;
}
+ if (!RegisterSecurityContextForPath(
+ context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(),
+ &error_message)) {
+ if (!error_message.empty()) {
+ LOG(ERROR) << "error_message: " << error_message;
+ on_error(Status::SECURITY_ERROR, error_message);
+ }
+ return Status::SECURITY_ERROR;
+ }
LOG(DEBUG) << "Security context updated";
return Status::OK;
}
}
return Status::SECURITY_ERROR;
}
+ if (!RegisterSecurityContextForPath(
+ context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(),
+ &error_message)) {
+ if (!error_message.empty()) {
+ LOG(ERROR) << "error_message: " << error_message;
+ on_error(Status::SECURITY_ERROR, error_message);
+ }
+ return Status::SECURITY_ERROR;
+ }
LOG(DEBUG) << "Security context reverted";
return Status::OK;
}