Step::Status StepRecoverSecurity::RecoveryNew() {
if (!Check(false))
return Status::OK;
+ recovery::RecoveryFile* recovery_file =
+ context_->recovery_info.get().recovery_file.get();
+ if (!recovery_file->security_operation_done()) {
+ LOG(DEBUG) << "security_operation_done false skip recover security";
+ return Status::OK;
+ }
std::string error_message;
if (!context_->manifest_data.get()) {
if (!UnregisterSecurityContextForPkgId(context_->pkgid.get(),
- context_->uid.get(), &error_message, true)) {
+ context_->pkg_type.get(), context_->uid.get(), &error_message, true)) {
LOG(ERROR) << "Unsuccessful install";
if (!error_message.empty()) {
LOG(ERROR) << "error_message: " << error_message;
return Status::RECOVERY_ERROR;
}
} else if (!UnregisterSecurityContextForManifest(
- context_->pkgid.get(), context_->uid.get(),
+ context_->pkgid.get(), context_->pkg_type.get(), context_->uid.get(),
context_->manifest_data.get(), &error_message)) {
LOG(ERROR) << "Unsuccessful install";
if (!error_message.empty()) {
LOG(ERROR) << "Invalid parameters";
return Status::INVALID_VALUE;
}
+ recovery::RecoveryFile* recovery_file =
+ context_->recovery_info.get().recovery_file.get();
+ if (!recovery_file->security_operation_done()) {
+ LOG(DEBUG) << "security_operation_done false skip recover security";
+ return Status::OK;
+ }
std::string error_message;
- if (!RegisterSecurityContextForManifest(
- context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(),
- &context_->certificate_info.get(), context_->manifest_data.get(),
- context_->cross_app_rules.get(), &error_message)) {
+ if (!RegisterSecurityContextForManifest(context_, &error_message)) {
LOG(ERROR) << "Unsuccessful update";
if (!error_message.empty()) {
LOG(ERROR) << "error_message: " << error_message;
}
return Status::RECOVERY_ERROR;
}
- if (!RegisterSecurityContextForPath(
- context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(),
+
+ if (!HasOwnerRwOtherRoPaths(context_->GetPkgPath()))
+ return Status::OK;
+
+ if (!RegisterSecurityContextForPath(context_->pkgid.get(),
+ context_->pkg_type.get(), context_->GetPkgPath(), context_->uid.get(),
context_->is_readonly_package.get(), &error_message)) {
if (!error_message.empty()) {
LOG(ERROR) << "error_message: " << error_message;
- on_error(Status::SECURITY_ERROR, error_message);
+ on_error(Status::RECOVERY_ERROR, error_message);
}
return Status::RECOVERY_ERROR;
}
LOG(ERROR) << "Invalid parameters";
return Status::INVALID_VALUE;
}
+ recovery::RecoveryFile* recovery_file =
+ context_->recovery_info.get().recovery_file.get();
+ if (!recovery_file->security_operation_done()) {
+ LOG(DEBUG) << "security_operation_done false skip recover security";
+ return Status::OK;
+ }
std::string error_message;
- if (!RegisterSecurityContextForManifest(
- context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(),
- &context_->certificate_info.get(), context_->manifest_data.get(),
- context_->cross_app_rules.get(), &error_message)) {
+ if (!RegisterSecurityContextForManifest(context_, &error_message)) {
LOG(ERROR) << "Unsuccessful update";
if (!error_message.empty()) {
LOG(ERROR) << "error_message: " << error_message;