From 7c8206bf26b8ef6020b543bbc027305dee8f2308 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 31 Aug 2015 11:00:12 +0200 Subject: if file is inaccessible for _apt, disable privilege drop in acquire We had a very similar method previously for our own private usage, but with some generalisation we can move this check into the acquire system proper so that all frontends profit from this compatibility change. As we are disabling a security feature here a warning is issued and frontends are advised to consider reworking their download logic if possible. Note that this is implemented as an all or nothing situation: We can't just (not) drop privileges for a subset of the files in a fetcher, so in case you have to download some files with and some without you need to use two fetchers. --- test/integration/test-acquire-same-file-multiple-times | 3 +-- test/integration/test-apt-get-changelog | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-acquire-same-file-multiple-times b/test/integration/test-acquire-same-file-multiple-times index 526765521..a850f897c 100755 --- a/test/integration/test-acquire-same-file-multiple-times +++ b/test/integration/test-acquire-same-file-multiple-times @@ -14,10 +14,9 @@ filedown() { msgtest 'Downloading the same URI twice over file' "$1" testsuccess --nomsg apthelper download-file file:///$APTARCHIVE/foo ./downloaded/foo1 '' file:///$APTARCHIVE/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 cp rootdir/tmp/testsuccess.output download.log - #cat download.log testsuccess cmp $TESTFILE ./downloaded/foo1 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2 - #testequal '1' grep -c '200%20URI%20Start' ./download.log + testequal '1' grep -c '200%20URI%20Start' ./download.log testequal '1' grep -c '201%20URI%20Done' ./download.log rm -f ./downloaded/foo1 ./downloaded/foo2 } diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 6ca05d0fa..502920617 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -47,8 +47,12 @@ testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0.changelog' foo.chang 'http://localhost:8080/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Override::Label::Debian='http://localhost:8080/CHANGEPATH.changelog' releasechanger 'Changelogs' 'no' -testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0 -' aptget changelog foo -qq -d +if [ "$(id -u)" = '0' ]; then + testfailuremsg "W: Can't drop privileges for downloading as file 'foo.changelog' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) +E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0" aptget changelog foo -d +else + testfailuremsg 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0' aptget changelog foo -d +fi sed -i '/^Changelogs: / d' $(find rootdir/var/lib/apt/lists -name '*Release') releasechanger 'Label' 'Testcases' -- cgit v1.2.3