#include <string>
#include "common/certificate_validation.h"
+#include "common/utils/file_util.h"
namespace bf = boost::filesystem;
namespace ci = common_installer;
PrivilegeLevel level = PrivilegeLevel::UNTRUSTED;
std::string error_message;
if (!signature_->GetPrivilegeLevel(GetSignatureRoot(),
- &level, error_message)) {
+ &level, &error_message)) {
on_error(Status::CERT_ERROR, error_message);
return Status::CERT_ERROR;
}
if (level == PrivilegeLevel::UNTRUSTED) {
- std::string error_message =
- "Unsigned applications can not be installed";
- on_error(Status::CERT_ERROR, error_message);
+ error_message = "Unsigned applications can not be installed";
+ on_error(Status::SIGNATURE_ERROR, error_message);
return Status::SIGNATURE_ERROR;
}
return status;
if (!signature_->CheckMetadataPrivilege(level, context_->manifest_data.get(),
- error_message)) {
+ &error_message)) {
if (!error_message.empty()) {
LOG(ERROR) << "error_message: " << error_message;
on_error(Status::SIGNATURE_ERROR, error_message);
}
Step::Status StepSignature::undo() {
+ if (signature_ == nullptr)
+ return Step::Status::OK;
+
bf::remove(signature_->GetFilePath());
if (bf::exists(signature_->GetBackupPath()))
bf::rename(signature_->GetBackupPath(), signature_->GetFilePath());
}
Step::Status StepSignature::clean() {
- if (bf::exists(signature_->GetBackupPath()))
- bf::remove(signature_->GetBackupPath());
+ Remove(signature_->GetBackupPath());
return Step::Status::OK;
}