diff options
Diffstat (limited to 'apt-pkg/deb/debmetaindex.cc')
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index f6c50742e..1d3754b00 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1,4 +1,5 @@ // ijones, walters +#include <config.h> #include <apt-pkg/debmetaindex.h> #include <apt-pkg/debindexfile.h> @@ -142,11 +143,13 @@ string debReleaseIndex::TranslationIndexURI(const char *Type, const string &Sect return URI + "dists/" + Dist + "/" + TranslationIndexURISuffix(Type, Section); } -debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) { - this->URI = URI; - this->Dist = Dist; - this->Indexes = NULL; - this->Type = "deb"; +debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) : + metaIndex(URI, Dist, "deb"), Trusted(CHECK_TRUST) +{} + +debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist, bool const Trusted) : + metaIndex(URI, Dist, "deb") { + SetTrusted(Trusted); } debReleaseIndex::~debReleaseIndex() { @@ -252,8 +255,22 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const return true; } +void debReleaseIndex::SetTrusted(bool const Trusted) +{ + if (Trusted == true) + this->Trusted = ALWAYS_TRUSTED; + else + this->Trusted = NEVER_TRUSTED; +} + bool debReleaseIndex::IsTrusted() const { + if (Trusted == ALWAYS_TRUSTED) + return true; + else if (Trusted == NEVER_TRUSTED) + return false; + + if(_config->FindB("APT::Authentication::TrustCDROM", false)) if(URI.substr(0,strlen("cdrom:")) == "cdrom:") return true; @@ -349,6 +366,7 @@ class debSLTypeDebian : public pkgSourceList::Type vector<string> const Archs = (arch != Options.end()) ? VectorizeString(arch->second, ',') : APT::Configuration::getArchitectures(); + map<string, string>::const_iterator const trusted = Options.find("trusted"); for (vector<metaIndex *>::const_iterator I = List.begin(); I != List.end(); ++I) @@ -358,6 +376,9 @@ class debSLTypeDebian : public pkgSourceList::Type continue; debReleaseIndex *Deb = (debReleaseIndex *) (*I); + if (trusted != Options.end()) + Deb->SetTrusted(StringToBool(trusted->second, false)); + /* This check insures that there will be only one Release file queued for all the Packages files and Sources files it corresponds to. */ @@ -375,9 +396,14 @@ class debSLTypeDebian : public pkgSourceList::Type return true; } } + // No currently created Release file indexes this entry, so we create a new one. - // XXX determine whether this release is trusted or not - debReleaseIndex *Deb = new debReleaseIndex(URI, Dist); + debReleaseIndex *Deb; + if (trusted != Options.end()) + Deb = new debReleaseIndex(URI, Dist, StringToBool(trusted->second, false)); + else + Deb = new debReleaseIndex(URI, Dist); + if (IsSrc == true) Deb->PushSectionEntry ("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); else |