diff options
author | David Kalnischkies <david@kalnischkies.de> | 2017-07-24 13:04:58 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2017-07-26 19:07:56 +0200 |
commit | 85f4a655cdc4d16c1b95de6fad7f3cd955265e46 (patch) | |
tree | 9eee2a3ef357b9cbbb8b1364e4dc5e32fa4f4c71 /apt-pkg/acquire.cc | |
parent | 1c5f13d489688e5fbbcdd3d0d2dd766769639939 (diff) |
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.
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 23 |
1 files 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; |