Просмотр исходного кода

Fixed MD5 checking on source archives
Author: jgg
Date: 1999-09-01 07:01:14 GMT
Fixed MD5 checking on source archives

Arch Librarian лет назад: 22
Родитель
Сommit
b3c39978a1
2 измененных файлов с 17 добавлено и 5 удалено
  1. 14 2
      apt-pkg/acquire-item.cc
  2. 3 3
      apt-pkg/acquire-item.h

+ 14 - 2
apt-pkg/acquire-item.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: acquire-item.cc,v 1.36 1999/08/28 03:22:34 jgg Exp $
+// $Id: acquire-item.cc,v 1.37 1999/09/01 07:01:14 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -565,7 +565,7 @@ void pkgAcqArchive::Finished()
 /* The file is added to the queue */
 pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
 		       unsigned long Size,string Dsc,string ShortDesc) :
-                       Item(Owner), MD5(MD5)
+                       Item(Owner), Md5Hash(MD5)
 {
    DestFile = flNotDir(URI);
    
@@ -597,6 +597,18 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
 /* */
 void pkgAcqFile::Done(string Message,unsigned long Size,string MD5)
 {
+   // Check the md5
+   if (Md5Hash.empty() == false && MD5.empty() == false)
+   {
+      if (Md5Hash != MD5)
+      {
+	 Status = StatError;
+	 ErrorText = "MD5Sum mismatch";
+	 Rename(DestFile,DestFile + ".FAILED");
+	 return;
+      }
+   }
+   
    Item::Done(Message,Size,MD5);
 
    string FileName = LookupTag(Message,"Filename");

+ 3 - 3
apt-pkg/acquire-item.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: acquire-item.h,v 1.20 1999/05/24 03:39:37 jgg Exp $
+// $Id: acquire-item.h,v 1.21 1999/09/01 07:01:15 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -150,13 +150,13 @@ class pkgAcqArchive : public pkgAcquire::Item
 class pkgAcqFile : public pkgAcquire::Item
 {
    pkgAcquire::ItemDesc Desc;
-   string MD5;
+   string Md5Hash;
    
    public:
    
    // Specialized action members
    virtual void Done(string Message,unsigned long Size,string Md5Hash);
-   virtual string MD5Sum() {return MD5;};
+   virtual string MD5Sum() {return Md5Hash;};
    virtual string DescURI() {return Desc.URI;};
    
    pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,unsigned long Size,