summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-update-expected-size
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-10-07 20:40:37 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-10-07 20:51:35 +0200
commit27e6c17a18216e2a02de39a6d1722b83ac823d42 (patch)
tree91ac9a4c6584289591ff1442b26e14e7d870931e /test/integration/test-apt-update-expected-size
parent7e4dfb4349e909c15b1c777679fdae81d76eeb62 (diff)
Add new Acquire::MaxReleaseFileSize=10*1000*1000 option
This option controls the maximum size of Release/Release.gpg/InRelease files. The rational is that we do not know the size of these files in advance and we want to protect against a denial of service attack where someone sends us endless amounts of data until the disk is full (we do know the size all other files (Packages/Sources/debs)).
Diffstat (limited to 'test/integration/test-apt-update-expected-size')
-rwxr-xr-xtest/integration/test-apt-update-expected-size13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size
index c1eecc08a..f8ec24dcc 100755
--- a/test/integration/test-apt-update-expected-size
+++ b/test/integration/test-apt-update-expected-size
@@ -17,10 +17,17 @@ testsuccess aptget update
# make InRelease really big
mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good
-dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2
+dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null
touch -d '+1hour' aptarchive/dists/unstable/InRelease
-aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000))
-
+aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log
+msgtest 'Check that the max write warning is triggered'
+if grep -q "Writing more data than expected" output.log; then
+ msgpass
+else
+ cat output.log
+ msgfail
+fi
+mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease
# append junk at the end of the Packages.gz/Packages
SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"