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