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 #include "common/step/security/step_revoke_security.h"
7 #include <boost/filesystem.hpp>
10 #include "common/security_registration.h"
12 namespace common_installer {
15 Step::Status StepRevokeSecurity::precheck() {
16 if (context_->pkgid.get().empty()) {
17 LOG(ERROR) << "pkgid attribute is empty";
18 return Step::Status::PACKAGE_NOT_FOUND;
20 if (!context_->manifest_data.get()) {
21 LOG(ERROR) << "manifest_data attribute is empty";
22 return Step::Status::MANIFEST_NOT_FOUND;
25 return Step::Status::OK;
28 Step::Status StepRevokeSecurity::clean() {
29 std::string error_message;
30 if (!UnregisterSecurityContextForManifest(
31 context_->pkgid.get(), context_->pkg_type.get(), context_->uid.get(),
32 context_->manifest_data.get(),
34 LOG(ERROR) << "Failure on unregistering security context for app "
35 << context_->pkgid.get();
36 if (!error_message.empty()) {
37 LOG(ERROR) << "error_message: " << error_message;
38 on_error(Status::SECURITY_ERROR, error_message);
41 LOG(DEBUG) << "Security context uninstalled";
46 } // namespace security
47 } // namespace common_installer