From 5a5f8f732419abeaaf078a9ce0212f3c3aa4a1c2 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sun, 10 Feb 2019 13:07:50 -0800 Subject: [PATCH] When trying to migrate a file system from CryFS 0.9.3 or older, show an error message suggesting to first open it with 0.9.10 because we can't load that anymore. --- ChangeLog.txt | 1 + src/cryfs/config/CryConfigLoader.cpp | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7bd093b5..74445b20 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,7 @@ Version 0.10.1 (unreleased) --------------- Fixed bugs: * If file system migration encounters files or folders with the wrong format in the base directory, it now just ignores them instead of crashing. +* When trying to migrate a file system from CryFS 0.9.3 or older, show an error message suggesting to first open it with 0.9.10 because we can't load that anymore. Version 0.10.0 diff --git a/src/cryfs/config/CryConfigLoader.cpp b/src/cryfs/config/CryConfigLoader.cpp index 8476c30e..1309cedb 100644 --- a/src/cryfs/config/CryConfigLoader.cpp +++ b/src/cryfs/config/CryConfigLoader.cpp @@ -43,12 +43,6 @@ optional CryConfigLoader::_loadConfig(bf::pat } #endif _checkVersion(*config->config(), allowFilesystemUpgrade); -#ifndef CRYFS_NO_COMPATIBILITY - //Since 0.9.3-alpha set the config value cryfs.blocksizeBytes wrongly to 32768 (but didn't use the value), we have to fix this here. - if (config->config()->Version() != "0+unknown" && VersionCompare::isOlderThan(config->config()->Version(), "0.9.3-rc1")) { - config->config()->SetBlocksizeBytes(32832); - } -#endif if (config->config()->Version() != CryConfig::FilesystemFormatVersion) { config->config()->SetVersion(CryConfig::FilesystemFormatVersion); config->save(); @@ -65,6 +59,9 @@ optional CryConfigLoader::_loadConfig(bf::pat } void CryConfigLoader::_checkVersion(const CryConfig &config, bool allowFilesystemUpgrade) { + if (gitversion::VersionCompare::isOlderThan(config.Version(), "0.9.4")) { + throw CryfsException("This filesystem is for CryFS " + config.Version() + ". This format is not supported anymore. Please migrate the file system to a supported version first by opening it with CryFS 0.9.x (x>=4).", ErrorCode::TooOldFilesystemFormat); + } if (gitversion::VersionCompare::isOlderThan(CryConfig::FilesystemFormatVersion, config.Version())) { if (!_console->askYesNo("This filesystem is for CryFS " + config.Version() + " or later and should not be opened with older versions. It is strongly recommended to update your CryFS version. However, if you have backed up your base directory and know what you're doing, you can continue trying to load it. Do you want to continue?", false)) { throw CryfsException("This filesystem is for CryFS " + config.Version() + " or later. Please update your CryFS version.", ErrorCode::TooNewFilesystemFormat);