]>
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 | |
846bc058 | 22 | addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;' |
daff4aa3 MV |
23 | chmod 550 aptarchive/dists/unstable/main/binary-amd64 |
24 | ||
846bc058 | 25 | testsuccess aptget update |
448c38bd DK |
26 | |
27 | # the release files aren't an IMS-hit, but the indexes are | |
28 | redatereleasefiles '+1 hour' | |
29 | ||
8d041b4f | 30 | # we don't download the index if it isn't updated |
846bc058 | 31 | testsuccess aptget update -o Debug::pkgAcquire::Auth=1 |
8d041b4f | 32 | # file:/ isn't shown in the log, so see if it was downloaded anyhow |
846bc058 | 33 | cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output |
8d041b4f DK |
34 | canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/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 | |
23d0a6fb | 48 | |
8d041b4f DK |
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 | |
23d0a6fb | 52 | canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" |
846bc058 | 53 | testsuccess grep -- "$canary" rootdir/tmp/update.output |
23d0a6fb | 54 | |
8d041b4f | 55 | testfoo |