summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-03-28 03:34:54 +0200
committerJulian Andres Klode <jak@debian.org>2016-03-28 14:59:33 +0200
commit6a4958d3134a3a61c036bc9ccaccc393c2bb99f2 (patch)
tree67d712b14a18d0dcd78df349cc1b8dea9556982d /apt-pkg/contrib
parentf46a1d944896778ca705936e58a19a3a28bd1b95 (diff)
Allow lowering trust level of a hash via config
Introduces APT::Hashes::<NAME> with entries Untrusted and Weak which can be set to true to cause the hash to be treated as untrusted and/or weak.
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/hashes.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index f2b91501e..755ad2035 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -129,12 +129,21 @@ APT_PURE bool HashString::empty() const /*{{{*/
return (Type.empty() || Hash.empty());
}
/*}}}*/
+
+APT_PURE static bool IsConfigured(const char *name, const char *what)
+{
+ std::string option;
+ strprintf(option, "APT::Hashes::%s::%s", name, what);
+ return _config->FindB(option, false);
+}
+
APT_PURE bool HashString::usable() const /*{{{*/
{
return (
(Type != "Checksum-FileSize") &&
(Type != "MD5Sum") &&
- (Type != "SHA1")
+ (Type != "SHA1") &&
+ !IsConfigured(Type.c_str(), "Untrusted")
);
}
/*}}}*/