test/integration/test-apt-update-file: improve test
[ntk/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"
13configcompression 'bz2' 'gz'
14
15insertpackage 'unstable' 'foo' 'all' '1.0'
16
17umask 022
18setupaptarchive --no-update
19
20# ensure the archive is not writable
21chmod 550 aptarchive/dists/unstable/main/binary-amd64
22
23testsuccess aptget update -qq
24testsuccess aptget update -qq
23d0a6fb
MV
25aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log
26
27# ensure that the hash of the uncompressed file was verified even on a local
28# ims hit
29canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
30grep -q "RecivedHash: $canary" output.log
31
8b451962
MV
32# foo is still available
33testsuccess aptget install -s foo
daff4aa3
MV
34
35# the cleanup should still work
36chmod 750 aptarchive/dists/unstable/main/binary-amd64