Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / security / step_rollback_installation_security.cc
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #include "common/step/security/step_rollback_installation_security.h"
6
7 #include <string>
8
9 #include "common/security_registration.h"
10
11 namespace common_installer {
12 namespace security {
13
14 Step::Status StepRollbackInstallationSecurity::precheck() {
15   if (context_->pkgid.get().empty()) {
16     LOG(ERROR) << "pkgid attribute is empty";
17     return Step::Status::PACKAGE_NOT_FOUND;
18   }
19   if (!context_->manifest_data.get()) {
20     LOG(ERROR) << "manifest_data attribute is empty";
21     return Step::Status::MANIFEST_NOT_FOUND;
22   }
23
24   return Step::Status::OK;
25 }
26
27 Step::Status StepRollbackInstallationSecurity::undo() {
28   std::string error_message;
29   if (!UnregisterSecurityContextForManifest(
30       context_->pkgid.get(), context_->pkg_type.get(), context_->uid.get(),
31       context_->manifest_data.get(), &error_message)) {
32     if (!error_message.empty()) {
33       LOG(ERROR) << "error_message: " << error_message;
34     }
35     return Status::SECURITY_ERROR;
36   }
37   LOG(DEBUG) << "Security context uninstalled";
38   return Status::OK;
39 }
40
41 }  // namespace security
42 }  // namespace common_installer