summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-09-09 00:06:10 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-09-09 00:06:10 +0000
commit2d4722e202421007bc34f5439ab4a7cd0bd1148f (patch)
tree41eec474ef846f8fb65ef9990fbce9b6679a90ed /apt-pkg
parent09af1a917c739e50e4e8590cc8402525b3f1f64d (diff)
* don't forget the final md5sum checking!
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index c4c0b73a9..8a9a4c5bb 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -375,9 +375,26 @@ void pkgAcqIndexDiffs::Finish(bool allDone)
// we restore the original name, this is required, otherwise
// the file will be cleaned
if(allDone) {
- // this is for the "real" finish
DestFile = _config->FindDir("Dir::State::lists");
DestFile += URItoFileName(RealURI);
+
+ // do the final md5sum checking
+ MD5Summation sum;
+ FileFd Fd(DestFile, FileFd::ReadOnly);
+ sum.AddFD(Fd.Fd(), Fd.Size());
+ Fd.Close();
+ string MD5 = (string)sum.Result();
+
+ if (!ExpectedMD5.empty() && MD5 != ExpectedMD5)
+ {
+ Status = StatAuthError;
+ ErrorText = _("MD5Sum mismatch");
+ Rename(DestFile,DestFile + ".FAILED");
+ Dequeue();
+ return;
+ }
+
+ // this is for the "real" finish
Complete = true;
Status = StatDone;
Dequeue();