]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-file
do not request files if we expect an IMS hit
[apt.git] / test / integration / test-apt-update-file
CommitLineData
daff4aa3
MV
1#!/bin/sh
2#
3# Ensure that we do not modify file:/// uris (regression test for
4# CVE-2014-0487
5#
6set -e
7
8TESTDIR=$(readlink -f $(dirname $0))
9. $TESTDIR/framework
10
11setupenvironment
12configarchitecture "amd64"
846bc058 13configcompression 'bz2' 'gz'
daff4aa3 14
846bc058
DK
15insertpackage 'unstable' 'foo' 'all' '1'
16insertsource 'unstable' 'foo' 'all' '1'
daff4aa3 17
daff4aa3
MV
18setupaptarchive --no-update
19
20# ensure the archive is not writable
846bc058 21addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;'
daff4aa3
MV
22chmod 550 aptarchive/dists/unstable/main/binary-amd64
23
846bc058 24testsuccess aptget update
448c38bd
DK
25
26# the release files aren't an IMS-hit, but the indexes are
27redatereleasefiles '+1 hour'
28
8d041b4f 29# we don't download the index if it isn't updated
846bc058 30testsuccess aptget update -o Debug::pkgAcquire::Auth=1
8d041b4f 31# file:/ isn't shown in the log, so see if it was downloaded anyhow
846bc058 32cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
8d041b4f
DK
33canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
34testfailure grep -- "$canary" rootdir/tmp/update.output
35
36testfoo() {
37 # foo is still available
38 testsuccess aptget install -s foo
39 testsuccess aptcache showsrc foo
40 testsuccess aptget source foo --print-uris
41}
42testfoo
43
44# the release file is new again, the index still isn't, but it is somehow gone now from disk
45redatereleasefiles '+2 hour'
46find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
23d0a6fb 47
8d041b4f
DK
48testsuccess aptget update -o Debug::pkgAcquire::Auth=1
49# file:/ isn't shown in the log, so see if it was downloaded anyhow
50cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
23d0a6fb 51canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
846bc058 52testsuccess grep -- "$canary" rootdir/tmp/update.output
23d0a6fb 53
8d041b4f 54testfoo