From 85f4a655cdc4d16c1b95de6fad7f3cd955265e46 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 24 Jul 2017 13:04:58 +0200 Subject: send weak-only hashes to methods Weak hashes like filesize can be used by methods for basic checks and early refusals even if we can't use them for hard security proposes. Normal apt operations are not affected by this as they fail if no strong hash is available, but if apt is forced to work with weak-only files or e.g. in apt-helper context it can have benefits as weak is better than no hash for the methods. --- apt-pkg/acquire.cc | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 05f22f243..5e5e146a8 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1133,22 +1133,15 @@ HashStringList pkgAcquire::Queue::QItem::GetExpectedHashes() const /*{{{*/ for (pkgAcquire::Queue::QItem::owner_iterator O = Owners.begin(); O != Owners.end(); ++O) { HashStringList const hsl = (*O)->GetExpectedHashes(); - if (hsl.usable() == false) - continue; - if (superhsl.usable() == false) - superhsl = hsl; - else - { - // we merge both lists - if we find disagreement send no hashes - HashStringList::const_iterator hs = hsl.begin(); - for (; hs != hsl.end(); ++hs) - if (superhsl.push_back(*hs) == false) - break; - if (hs != hsl.end()) - { - superhsl.clear(); + // we merge both lists - if we find disagreement send no hashes + HashStringList::const_iterator hs = hsl.begin(); + for (; hs != hsl.end(); ++hs) + if (superhsl.push_back(*hs) == false) break; - } + if (hs != hsl.end()) + { + superhsl.clear(); + break; } } return superhsl; -- cgit v1.2.3