mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-28 04:03:21 -04:00
better messages for cache newer than repo, fixes #1700
This commit is contained in:
parent
a0df60e1b8
commit
4fc5a35572
1 changed files with 8 additions and 2 deletions
|
|
@ -20,8 +20,11 @@ import msgpack
|
|||
class Cache:
|
||||
"""Client Side cache
|
||||
"""
|
||||
class RepositoryIDNotUnique(Error):
|
||||
"""Cache is newer than repository - do you have multiple, independently updated repos with same ID?"""
|
||||
|
||||
class RepositoryReplay(Error):
|
||||
"""Cache is newer than repository, refusing to continue"""
|
||||
"""Cache is newer than repository - this is either an attack or unsafe (multiple repos with same ID)"""
|
||||
|
||||
class CacheInitAbortedError(Error):
|
||||
"""Cache initialization aborted"""
|
||||
|
|
@ -81,7 +84,10 @@ class Cache:
|
|||
if sync and self.manifest.id != self.manifest_id:
|
||||
# If repository is older than the cache something fishy is going on
|
||||
if self.timestamp and self.timestamp > manifest.timestamp:
|
||||
raise self.RepositoryReplay()
|
||||
if isinstance(key, PlaintextKey):
|
||||
raise self.RepositoryIDNotUnique()
|
||||
else:
|
||||
raise self.RepositoryReplay()
|
||||
# Make sure an encrypted repository has not been swapped for an unencrypted repository
|
||||
if self.key_type is not None and self.key_type != str(key.TYPE):
|
||||
raise self.EncryptionMethodMismatch()
|
||||
|
|
|
|||
Loading…
Reference in a new issue