In case of an integrity violation, tell the user how they can reset integrity data.
This commit is contained in:
parent
839a511c4d
commit
491b277cee
@ -205,5 +205,9 @@ bool KnownBlockVersions::blockShouldExist(const Key &key) const {
|
||||
return found->second != CLIENT_ID_FOR_DELETED_BLOCK;
|
||||
}
|
||||
|
||||
const bf::path &KnownBlockVersions::path() const {
|
||||
return _stateFilePath;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace blockstore {
|
||||
uint64_t getBlockVersion(uint32_t clientId, const Key &key) const;
|
||||
|
||||
uint32_t myClientId() const;
|
||||
const boost::filesystem::path &path() const;
|
||||
|
||||
private:
|
||||
std::unordered_map<ClientIdAndBlockKey, uint64_t> _knownVersions;
|
||||
|
@ -43,7 +43,11 @@ namespace blockstore {
|
||||
|
||||
void VersionCountingBlockStore::_checkNoPastIntegrityViolations() {
|
||||
if (_integrityViolationDetected) {
|
||||
throw std::runtime_error("There was an integrity violation detected. Preventing any further access to the file system.");
|
||||
throw std::runtime_error(string() +
|
||||
"There was an integrity violation detected. Preventing any further access to the file system. " +
|
||||
"If you want to reset the integrity data (i.e. accept changes made by a potential attacker), " +
|
||||
"please unmount the file system and delete the following file before re-mounting it: " +
|
||||
_knownBlockVersions.path().native());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,3 +335,8 @@ TEST_F(KnownBlockVersionsTest, blockShouldExist_deletedBlock) {
|
||||
testobj.markBlockAsDeleted(key);
|
||||
EXPECT_FALSE(testobj.blockShouldExist(key));
|
||||
}
|
||||
|
||||
TEST_F(KnownBlockVersionsTest, path) {
|
||||
KnownBlockVersions obj(stateFile.path());
|
||||
EXPECT_EQ(stateFile.path(), obj.path());
|
||||
}
|
Loading…
Reference in New Issue
Block a user