]>
Commit | Line | Data |
---|---|---|
daff4aa3 MV |
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" | |
846bc058 | 13 | configcompression 'bz2' 'gz' |
c5ede4ca | 14 | confighashes 'SHA512' |
daff4aa3 | 15 | |
846bc058 DK |
16 | insertpackage 'unstable' 'foo' 'all' '1' |
17 | insertsource 'unstable' 'foo' 'all' '1' | |
daff4aa3 | 18 | |
daff4aa3 MV |
19 | setupaptarchive --no-update |
20 | ||
21 | # ensure the archive is not writable | |
30c8107e DK |
22 | addtrap 'prefix' 'chmod 755 aptarchive/dists/unstable/main/binary-all;' |
23 | if [ "$(id -u)" = '0' ]; then | |
24 | chmod 550 aptarchive/dists/unstable/main/binary-all | |
25 | testfailure aptget update | |
26 | fi | |
27 | chmod 555 aptarchive/dists/unstable/main/binary-all | |
846bc058 | 28 | testsuccess aptget update |
448c38bd DK |
29 | |
30 | # the release files aren't an IMS-hit, but the indexes are | |
31 | redatereleasefiles '+1 hour' | |
32 | ||
8d041b4f | 33 | # we don't download the index if it isn't updated |
846bc058 | 34 | testsuccess aptget update -o Debug::pkgAcquire::Auth=1 |
8d041b4f | 35 | # file:/ isn't shown in the log, so see if it was downloaded anyhow |
846bc058 | 36 | cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output |
1dd20368 | 37 | canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-all/Packages.bz2 | sha512sum |cut -f1 -d' ')" |
8d041b4f DK |
38 | testfailure grep -- "$canary" rootdir/tmp/update.output |
39 | ||
40 | testfoo() { | |
41 | # foo is still available | |
42 | testsuccess aptget install -s foo | |
43 | testsuccess aptcache showsrc foo | |
44 | testsuccess aptget source foo --print-uris | |
45 | } | |
46 | testfoo | |
47 | ||
48 | # the release file is new again, the index still isn't, but it is somehow gone now from disk | |
49 | redatereleasefiles '+2 hour' | |
50 | find rootdir/var/lib/apt/lists -name '*_Packages*' -delete | |
23d0a6fb | 51 | |
8d041b4f DK |
52 | testsuccess aptget update -o Debug::pkgAcquire::Auth=1 |
53 | # file:/ isn't shown in the log, so see if it was downloaded anyhow | |
54 | cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output | |
1dd20368 | 55 | canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-all/Packages.bz2 | sha512sum |cut -f1 -d' ')" |
846bc058 | 56 | testsuccess grep -- "$canary" rootdir/tmp/update.output |
23d0a6fb | 57 | |
8d041b4f | 58 | testfoo |