summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-get-download10
-rwxr-xr-xtest/integration/test-apt-get-install-deb11
-rwxr-xr-xtest/integration/test-apt-update-file17
-rw-r--r--test/libapt/configuration_test.cc6
4 files changed, 35 insertions, 9 deletions
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index 5c42c7e3c..3ad3b395d 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -30,14 +30,8 @@ find aptarchive/dists -name '*Release*' -type f | while read file; do
testaccessrights "$file" '640'
done
if [ "$(id -u)" = '0' ]; then
- # permission errors an everything
- testfailure aptget update
-
- find aptarchive/dists -name '*Packages*' -type f | while read file; do
- chmod 777 "$file"
- done
- # permission errors on Release
- testwarning aptget update
+ # Release file can't be accessed by _apt
+ testsuccesswithnotice aptget update -q=0
fi
#everything (too) permissive
diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb
index c41713a92..3f1aee5a0 100755
--- a/test/integration/test-apt-get-install-deb
+++ b/test/integration/test-apt-get-install-deb
@@ -103,3 +103,14 @@ createpkg 'trailing-newline' '' '
testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb
testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb
+
+# see if permission dropping is checked before usage
+if [ "$(id -u)" = '0' ]; then
+ apt clean
+ chmod 711 ./incoming
+ testsuccess aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb -q=0
+ chmod 710 ./incoming
+ testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb -q=0
+ chmod 700 ./incoming
+ testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb -q=0
+fi
diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file
index 04e26a8f4..78a8ca405 100755
--- a/test/integration/test-apt-update-file
+++ b/test/integration/test-apt-update-file
@@ -14,6 +14,7 @@ configcompression 'bz2' 'gz'
confighashes 'SHA512'
insertpackage 'unstable' 'foo' 'all' '1'
+insertpackage 'unstable' 'bar' 'amd64' '1'
insertsource 'unstable' 'foo' 'all' '1'
setupaptarchive --no-update
@@ -21,8 +22,22 @@ setupaptarchive --no-update
# ensure the archive is not writable
addtrap 'prefix' 'chmod 755 aptarchive/dists/unstable/main/binary-all;'
if [ "$(id -u)" = '0' ]; then
- chmod 550 aptarchive/dists/unstable/main/binary-all
+ # too deep to notice it, but it also unlikely that files in the same repo have different permissions
+ chmod 500 aptarchive/dists/unstable/main/binary-all
testfailure aptget update
+ rm -rf rootdir/var/lib/apt/lists
+ chmod 755 aptarchive/dists/unstable/main/binary-all
+ testsuccess aptget update
+ rm -rf rootdir/var/lib/apt/lists
+ chmod 511 aptarchive/dists/
+ testsuccess aptget update
+ rm -rf rootdir/var/lib/apt/lists
+ chmod 510 aptarchive/dists/
+ testsuccesswithnotice aptget update -q=0
+ rm -rf rootdir/var/lib/apt/lists
+ chmod 500 aptarchive/dists/
+ testsuccesswithnotice aptget update -q=0
+ exit
fi
chmod 555 aptarchive/dists/unstable/main/binary-all
testsuccess aptget update
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 6300b5256..9fb580a01 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -148,6 +148,7 @@ TEST(ConfigurationTest,Merge)
{
Configuration Cnf;
Cnf.Set("Binary::apt::option::foo", "bar");
+ Cnf.Set("Binary::apt::option::empty", "");
Cnf.Set("option::foo", "foo");
Cnf.MoveSubTree("Binary::apt", "Binary::apt2");
@@ -156,8 +157,13 @@ TEST(ConfigurationTest,Merge)
EXPECT_EQ("foo", Cnf.Find("option::foo"));
EXPECT_EQ("bar", Cnf.Find("Binary::apt2::option::foo"));
+ EXPECT_FALSE(Cnf.Exists("option::empty"));
+ EXPECT_TRUE(Cnf.Exists("Binary::apt2::option::empty"));
+ Cnf.Set("option::empty", "not");
+
Cnf.MoveSubTree("Binary::apt2", NULL);
EXPECT_FALSE(Cnf.Exists("Binary::apt2::option"));
EXPECT_TRUE(Cnf.Exists("option"));
EXPECT_EQ("bar", Cnf.Find("option::foo"));
+ EXPECT_EQ("", Cnf.Find("option::empty"));
}