]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-method.cc
rework hashsum verification in the acquire system
[apt.git] / apt-pkg / acquire-method.cc
index 330854e752adc655b6fa6f111a45c71acbd74757..b77096efd652b319676dbfec109a5e64f3e1752f 100644 (file)
@@ -102,7 +102,10 @@ void pkgAcqMethod::Fail(string Err,bool Transient)
    if (Queue != 0)
    {
       std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n"
-               << "Message: " << Err << " " << IP << "\n";
+               << "Message: " << Err;
+      if (IP.empty() == false && _config->FindB("Acquire::Failure::ShowIP", true) == true)
+        std::cout << " " << IP;
+      std::cout << "\n";
       Dequeue();
    }
    else
@@ -124,7 +127,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient)
 /* */
 void pkgAcqMethod::DropPrivsOrDie()
 {
-   if (!DropPrivs()) {
+   if (!DropPrivileges()) {
       Fail(false);
       exit(112);       /* call the european emergency number */
    }
@@ -373,7 +376,10 @@ int pkgAcqMethod::Run(bool Single)
                  Tmp->ExpectedHashes.push_back(HashString(*t, hash));
            }
             char *End;
-            Tmp->ExpectedSize = strtoll(LookupTag(Message, "Expected-Size", "0").c_str(), &End, 10);
+           if (Tmp->ExpectedHashes.FileSize() > 0)
+              Tmp->MaximumSize = Tmp->ExpectedHashes.FileSize();
+           else
+              Tmp->MaximumSize = strtoll(LookupTag(Message, "Maximum-Size", "0").c_str(), &End, 10);
            Tmp->Next = 0;
            
            // Append it to the list
@@ -474,3 +480,5 @@ void pkgAcqMethod::Dequeue() {                                              /*{{{*/
    delete Tmp;
 }
                                                                        /*}}}*/
+
+pkgAcqMethod::~pkgAcqMethod() {}