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"
9 #include "common/security_registration.h"
11 namespace common_installer {
14 Step::Status StepRevokeSecurity::precheck() {
15 if (context_->pkgid.get().empty()) {
16 LOG(ERROR) << "pkgid attribute is empty";
17 return Step::Status::PACKAGE_NOT_FOUND;
19 if (!context_->manifest_data.get()) {
20 LOG(ERROR) << "manifest_data attribute is empty";
21 return Step::Status::MANIFEST_NOT_FOUND;
24 return Step::Status::OK;
27 Step::Status StepRevokeSecurity::clean() {
28 std::string error_message;
29 if (!UnregisterSecurityContextForManifest(
30 context_->pkgid.get(), context_->pkg_type.get(), context_->uid.get(),
31 context_->manifest_data.get(),
33 LOG(ERROR) << "Failure on unregistering security context for app "
34 << context_->pkgid.get();
35 if (!error_message.empty()) {
36 LOG(ERROR) << "error_message: " << error_message;
37 on_error_->on_error(Status::SECURITY_ERROR, error_message);
40 LOG(DEBUG) << "Security context uninstalled";
45 } // namespace security
46 } // namespace common_installer