summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/sshcfgparse.sh51
1 files changed, 50 insertions, 1 deletions
diff --git a/regress/sshcfgparse.sh b/regress/sshcfgparse.sh
index 26d4a6f3c..e0ce568d7 100644
--- a/regress/sshcfgparse.sh
+++ b/regress/sshcfgparse.sh
@@ -1,8 +1,27 @@
1# $OpenBSD: sshcfgparse.sh,v 1.3 2018/04/06 04:18:35 dtucker Exp $ 1# $OpenBSD: sshcfgparse.sh,v 1.4 2018/07/04 13:51:12 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="ssh config parse" 4tid="ssh config parse"
5 5
6expect_result_present() {
7 _str="$1" ; shift
8 for _expect in "$@" ; do
9 echo "$f" | tr ',' '\n' | grep "^$_expect\$" >/dev/null
10 if test $? -ne 0 ; then
11 fail "missing expected \"$_expect\" from \"$_str\""
12 fi
13 done
14}
15expect_result_absent() {
16 _str="$1" ; shift
17 for _expect in "$@" ; do
18 echo "$f" | tr ',' '\n' | grep "^$_expect\$" >/dev/null
19 if test $? -eq 0 ; then
20 fail "unexpected \"$_expect\" present in \"$_str\""
21 fi
22 done
23}
24
6verbose "reparse minimal config" 25verbose "reparse minimal config"
7(${SSH} -G -F $OBJ/ssh_config somehost >$OBJ/ssh_config.1 && 26(${SSH} -G -F $OBJ/ssh_config somehost >$OBJ/ssh_config.1 &&
8 ${SSH} -G -F $OBJ/ssh_config.1 somehost >$OBJ/ssh_config.2 && 27 ${SSH} -G -F $OBJ/ssh_config.1 somehost >$OBJ/ssh_config.2 &&
@@ -36,5 +55,35 @@ test "$f" = "bar" || fail "user first match -l, expected 'bar' got '$f'"
36f=`${SSH} -GF $OBJ/ssh_config baz@host -o user=foo -l bar baz@host | awk '/^user /{print $2}'` 55f=`${SSH} -GF $OBJ/ssh_config baz@host -o user=foo -l bar baz@host | awk '/^user /{print $2}'`
37test "$f" = "baz" || fail "user first match user@host, expected 'baz' got '$f'" 56test "$f" = "baz" || fail "user first match user@host, expected 'baz' got '$f'"
38 57
58verbose "pubkeyacceptedkeytypes"
59# Default set
60f=`${SSH} -GF none host | awk '/^pubkeyacceptedkeytypes /{print $2}'`
61expect_result_present "$f" "ssh-ed25519" "ssh-ed25519-cert-v01.*"
62expect_result_absent "$f" "ssh-dss"
63# Explicit override
64f=`${SSH} -GF none -opubkeyacceptedkeytypes=ssh-ed25519 host | \
65 awk '/^pubkeyacceptedkeytypes /{print $2}'`
66expect_result_present "$f" "ssh-ed25519"
67expect_result_absent "$f" "ssh-ed25519-cert-v01.*" "ssh-dss"
68# Removal from default set
69f=`${SSH} -GF none -opubkeyacceptedkeytypes=-ssh-ed25519-cert* host | \
70 awk '/^pubkeyacceptedkeytypes /{print $2}'`
71expect_result_present "$f" "ssh-ed25519"
72expect_result_absent "$f" "ssh-ed25519-cert-v01.*" "ssh-dss"
73f=`${SSH} -GF none -opubkeyacceptedkeytypes=-ssh-ed25519 host | \
74 awk '/^pubkeyacceptedkeytypes /{print $2}'`
75expect_result_present "$f" "ssh-ed25519-cert-v01.*"
76expect_result_absent "$f" "ssh-ed25519" "ssh-dss"
77# Append to default set.
78# XXX this will break for !WITH_OPENSSL
79f=`${SSH} -GF none -opubkeyacceptedkeytypes=+ssh-dss-cert* host | \
80 awk '/^pubkeyacceptedkeytypes /{print $2}'`
81expect_result_present "$f" "ssh-ed25519" "ssh-dss-cert-v01.*"
82expect_result_absent "$f" "ssh-dss"
83f=`${SSH} -GF none -opubkeyacceptedkeytypes=+ssh-dss host | \
84 awk '/^pubkeyacceptedkeytypes /{print $2}'`
85expect_result_present "$f" "ssh-ed25519" "ssh-ed25519-cert-v01.*" "ssh-dss"
86expect_result_absent "$f" "ssh-dss-cert-v01.*"
87
39# cleanup 88# cleanup
40rm -f $OBJ/ssh_config.[012] 89rm -f $OBJ/ssh_config.[012]