]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/hashes.cc
support compression and by-hash for .diff/Index files
[apt.git] / apt-pkg / contrib / hashes.cc
index f2b91501e5a5aed23e2cab77ad666eec1485ea1b..755ad20351443d321a6372ad614f2e1e2218e0fe 100644 (file)
@@ -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")
    );
 }
                                                                        /*}}}*/