!1537 单框架适应双框架安全加固加log

Merge pull request !1537 from zhaoshuyuan/master
This commit is contained in:
openharmony_ci 2024-11-21 01:15:13 +00:00 committed by Gitee
commit 4d4f876d04
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 1 deletions

View File

@ -696,7 +696,7 @@ bool BaseKey::DoRestoreKey(const UserAuth &auth, const std::string &path)
std::string need_restore;
LoadStringFromFile(path + SUFFIX_NEED_RESTORE, need_restore);
uint32_t restore_version = std::atoi(need_restore.c_str());
UpdateVersion update_version = static_cast<UpdateVersion>(std::atoi(need_restore.c_str()) + 1);
UpdateVersion update_version = static_cast<UpdateVersion>(std::atoi(need_restore.c_str()));
LOGI("NeedRestore Path is: %{public}s, restore_version: %{public}u", path.c_str(), restore_version);
if (std::filesystem::exists(path + SUFFIX_NEED_RESTORE, errCode)) {
if (restore_version < 3) {

View File

@ -254,11 +254,13 @@ int32_t StorageDaemon::RestoreOneUserKey(int32_t userId, KeyType type)
std::string elNeedRestorePath = GetNeedRestoreFilePathByType(userId, type);
if (elNeedRestorePath.empty()) {
LOGI("elNeedRestorePath is empty, type = %{public}d", type);
return E_KEY_TYPE_INVAL;
}
std::error_code errCode;
if (!std::filesystem::exists(elNeedRestorePath, errCode)) {
LOGI("elNeedRestorePath not exist, type = %{public}d", type);
return E_OK;
}
std::string SINGLE_RESTORE_VERSION;