diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-01-09 19:37:16 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-01-09 19:37:16 +0000 |
commit | 0825b046af42257471d535cd3882f1301042606c (patch) | |
tree | 94cea85712402e1e84dab27c27612c2d07a861ec | |
parent | e942100f4b2152f5b948c994b166c0bd3c556fe9 (diff) | |
download | obnam-0825b046af42257471d535cd3882f1301042606c.tar.gz |
Check whole-file md5 for in-tree chunk validation
-rw-r--r-- | obnamlib/fmt_6/repo_fmt_6.py | 11 | ||||
-rw-r--r-- | test-gpghome/random_seed | bin | 600 -> 600 bytes |
2 files changed, 9 insertions, 2 deletions
diff --git a/obnamlib/fmt_6/repo_fmt_6.py b/obnamlib/fmt_6/repo_fmt_6.py index 06a9d807..9a7f5782 100644 --- a/obnamlib/fmt_6/repo_fmt_6.py +++ b/obnamlib/fmt_6/repo_fmt_6.py @@ -756,8 +756,15 @@ class RepositoryFormat6(obnamlib.RepositoryInterface): def validate_chunk_content(self, chunk_id): if self._is_in_tree_chunk_id(chunk_id): # pragma: no cover - # FIXME: Check whole-file md5 here - return True + gen_id, filename = self._unpack_in_tree_chunk_id(chunk_id) + client_name, gen_number = gen_id + client = self._open_client(client_name) + data = client.get_file_data(gen_number, filename) + checksum = hashlib.md5(data).hexdigest() + expected = self.get_file_key( + gen_id, filename, obnamlib.REPO_FILE_MD5) + return checksum == expected + try: content = self.get_chunk_content(chunk_id) except obnamlib.RepositoryChunkDoesNotExist: diff --git a/test-gpghome/random_seed b/test-gpghome/random_seed Binary files differindex 6c3f20e0..19a89568 100644 --- a/test-gpghome/random_seed +++ b/test-gpghome/random_seed |