summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2019-12-02 13:28:07 +0000
committerJulian Andres Klode <jak@debian.org>2019-12-02 13:28:07 +0000
commit203ed6e094e0e5a332ddae9e4f08df5694b84ba9 (patch)
tree667c4240b6f6fb9c91ae20b655478508b09d6214 /test
parent1690c3f87ae45a41e8d3e09bf0b1021c008460b9 (diff)
parent93f33052de84e9aeaf19c92291d043dad2665bbd (diff)
Merge branch 'pu/netrc-https' into 'master'
netrc: Restrict auth.conf data to https by default See merge request apt-team/apt!84
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-authentication-basic42
1 files changed, 33 insertions, 9 deletions
diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic
index 211c73e35..5aafaade0 100755
--- a/test/integration/test-authentication-basic
+++ b/test/integration/test-authentication-basic
@@ -65,35 +65,59 @@ runtest() {
authfile ''
testauthfailure "$1"
+ protocol="${1%%://*}"
+
# good auth
- authfile 'machine localhost
+ authfile "machine ${protocol}://localhost
login star@irc
-password hunter2'
+password hunter2"
testauthsuccess "$1"
# bad auth
- authfile 'machine localhost
+ authfile "machine ${protocol}://localhost
login anonymous
-password hunter2'
+password hunter2"
testauthfailure "$1"
# 2 stanzas: unmatching + good auth
- authfile 'machine debian.org
+ authfile "machine ${protocol}://debian.org
login debian
password jessie
-machine localhost
+machine ${protocol}://localhost
login star@irc
-password hunter2'
+password hunter2"
testauthsuccess "$1"
+ # no protocol specifier
+ authfile "machine localhost
+login star@irc
+password hunter2"
+ if [ "$protocol" = "https" ]; then
+ testauthsuccess "$1"
+ else
+ testauthfailure "$1"
+ fi
+
+ # wrong protocol specifier
+ if [ "$protocol" = "https" ]; then
+ authfile "machine http://localhost
+login star@irc
+password hunter2"
+ else
+ authfile "machine https://localhost
+login star@irc
+password hunter2"
+ fi
+ testauthfailure "$1"
+
# delete file, make sure it fails; add auth.conf.d snippet, works again.
rm rootdir/etc/apt/auth.conf
testauthfailure "$1"
- authfile 'machine localhost
+ authfile "machine ${protocol}://localhost
login star@irc
-password hunter2' rootdir/etc/apt/auth.conf.d/myauth.conf
+password hunter2" rootdir/etc/apt/auth.conf.d/myauth.conf
testauthsuccess "$1"
rm rootdir/etc/apt/auth.conf.d/myauth.conf
}