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