summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-07-24 13:04:58 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-07-26 19:07:56 +0200
commit85f4a655cdc4d16c1b95de6fad7f3cd955265e46 (patch)
tree9eee2a3ef357b9cbbb8b1364e4dc5e32fa4f4c71
parent1c5f13d489688e5fbbcdd3d0d2dd766769639939 (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.
-rw-r--r--apt-pkg/acquire.cc23
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;