summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 58bd6475e..bbbda3bd3 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -25,7 +25,6 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/metaindex.h>
-#include <apt-pkg/netrc.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/sourcelist.h>
@@ -2025,7 +2024,6 @@ void pkgAcqMetaClearSig::Failed(string const &Message,pkgAcquire::MethodConfig c
* they would be considered as trusted later on */
string const FinalRelease = GetFinalFileNameFromURI(DetachedDataTarget.URI);
string const PartialRelease = GetPartialFileNameFromURI(DetachedDataTarget.URI);
- string const FinalReleasegpg = GetFinalFileNameFromURI(DetachedSigTarget.URI);
string const FinalInRelease = GetFinalFilename();
Rename(DestFile, PartialRelease);
TransactionManager->TransactionStageCopy(this, PartialRelease, FinalRelease);
@@ -2225,6 +2223,11 @@ void pkgAcqMetaSig::Failed(string const &Message,pkgAcquire::MethodConfig const
return;
// ensures that a Release.gpg file in the lists/ is removed by the transaction
+ if (not MetaIndexFileSignature.empty())
+ {
+ DestFile = MetaIndexFileSignature;
+ MetaIndexFileSignature.clear();
+ }
TransactionManager->TransactionStageRemoval(this, DestFile);
// only allow going further if the user explicitly wants it
@@ -2586,14 +2589,18 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/
return false;
}
- for (auto const &patch: available_patches)
- if (patch.result_hashes.usable() == false ||
- patch.patch_hashes.usable() == false ||
- patch.download_hashes.usable() == false)
+ {
+ auto const patch = std::find_if(available_patches.cbegin(), available_patches.cend(), [](auto const &patch) {
+ return not patch.result_hashes.usable() ||
+ not patch.patch_hashes.usable() ||
+ not patch.download_hashes.usable();
+ });
+ if (patch != available_patches.cend())
{
- strprintf(ErrorText, "Provides no usable hashes for %s", patch.file.c_str());
+ strprintf(ErrorText, "Provides no usable hashes for %s", patch->file.c_str());
return false;
}
+ }
// patching with too many files is rather slow compared to a fast download
unsigned long const fileLimit = _config->FindI("Acquire::PDiffs::FileLimit", 0);
@@ -2655,13 +2662,15 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/
return false;
std::string const PartialFile = GetPartialFileNameFromURI(Target.URI);
std::string const PatchedFile = GetKeepCompressedFileName(PartialFile + "-patched", Target);
- if (RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PartialFile) == false ||
- RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PatchedFile) == false)
+ if (not RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PartialFile) ||
+ not RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PatchedFile))
return false;
- for (auto const &ext : APT::Configuration::getCompressorExtensions())
{
- if (RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PartialFile + ext) == false ||
- RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PatchedFile + ext) == false)
+ auto const exts = APT::Configuration::getCompressorExtensions();
+ if (not std::all_of(exts.cbegin(), exts.cend(), [&](auto const &ext) {
+ return RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PartialFile + ext) &&
+ RemoveFileForBootstrapLinking(ErrorText, CurrentPackagesFile, PatchedFile + ext);
+ }))
return false;
}
std::string const Ext = Final.substr(CurrentPackagesFile.length());
@@ -3260,19 +3269,14 @@ void pkgAcqIndex::StageDownloadDone(string const &Message)
// we need to verify the file against the current Release file again
// on if-modfied-since hit to avoid a stale attack against us
- if(StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ if (StringToBool(LookupTag(Message, "IMS-Hit"), false))
{
- // copy FinalFile into partial/ so that we check the hash again
- string const FinalFile = GetExistingFilename(GetFinalFileNameFromURI(Target.URI));
- if (symlink(FinalFile.c_str(), DestFile.c_str()) != 0)
- _error->WarningE("pkgAcqIndex::StageDownloadDone", "Symlinking final file %s back to %s failed", FinalFile.c_str(), DestFile.c_str());
- else
- {
- EraseFileName = DestFile;
- Filename = DestFile;
- }
+ Filename = GetExistingFilename(GetFinalFileNameFromURI(Target.URI));
+ EraseFileName = DestFile = flCombine(flNotFile(DestFile), flNotDir(Filename));
+ if (symlink(Filename.c_str(), DestFile.c_str()) != 0)
+ _error->WarningE("pkgAcqIndex::StageDownloadDone", "Symlinking file %s to %s failed", Filename.c_str(), DestFile.c_str());
Stage = STAGE_DECOMPRESS_AND_VERIFY;
- Desc.URI = "store:" + Filename;
+ Desc.URI = "store:" + DestFile;
QueueURI(Desc);
SetActiveSubprocess(::URI(Desc.URI).Access);
return;
@@ -3382,7 +3386,6 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc
Trusted = false;
StoreFilename.clear();
- std::vector<std::unique_ptr<FileFd>> authconfs;
for (auto Vf = Version.FileList(); Vf.end() == false; ++Vf)
{
auto const PkgF = Vf.File();
@@ -3390,8 +3393,6 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc
continue;
if (PkgF.Flagged(pkgCache::Flag::NotSource))
continue;
- if (PkgF.Flagged(pkgCache::Flag::PackagesRequireAuthorization) && !IsAuthorized(PkgF, authconfs))
- continue;
pkgIndexFile *Index;
if (Sources->FindIndex(PkgF, Index) == false)
continue;