summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2015-05-04 01:51:40 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2015-05-04 01:51:40 +0000
commit9dcc1cb1d90d049c23e9365e65650d46d5ac4add (patch)
tree179e0e2c6571aaebbf804a3cebdce5a3f01bf48b /regress/usr.bin
parentfccf0f69b78793eee0d0bf1b5efd571a08f37322 (diff)
Specify regression test host keys so that this test will work without
SUDO (because it can't read the real host keys) and in -portable on systems where sshd hasn't been installed yet (because the keys don't exist yet).
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/cfgparse.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/regress/usr.bin/ssh/cfgparse.sh b/regress/usr.bin/ssh/cfgparse.sh
index 2046bb1674c..95bd9a8a45f 100644
--- a/regress/usr.bin/ssh/cfgparse.sh
+++ b/regress/usr.bin/ssh/cfgparse.sh
@@ -1,12 +1,20 @@
-# $OpenBSD: cfgparse.sh,v 1.3 2015/05/04 01:47:53 dtucker Exp $
+# $OpenBSD: cfgparse.sh,v 1.4 2015/05/04 01:51:39 dtucker Exp $
# Placed in the Public Domain.
tid="config parse"
-verbose "reparse default config"
-($SUDO ${SSHD} -T -f /dev/null >$OBJ/sshd_config.1 &&
+# We need to use the keys generated for the regression test because sshd -T
+# will fail if we're not running with SUDO (no permissions for real keys) or
+# if we are # running tests on a system that has never had sshd installed
+# (keys won't exist).
+
+grep "HostKey " $OBJ/sshd_config > $OBJ/sshd_config_minimal
+SSHD_KEYS="`cat $OBJ/sshd_config_minimal`"
+
+verbose "reparse minimal config"
+($SUDO ${SSHD} -T -f $OBJ/sshd_config_minimal >$OBJ/sshd_config.1 &&
$SUDO ${SSHD} -T -f $OBJ/sshd_config.1 >$OBJ/sshd_config.2 &&
- diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse default config"
+ diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse minimal config"
verbose "reparse regress config"
($SUDO ${SSHD} -T -f $OBJ/sshd_config >$OBJ/sshd_config.1 &&
@@ -24,6 +32,7 @@ EOD
# test input sets. should all result in the output above.
# test 1: addressfamily and port first
cat > $OBJ/sshd_config.1 <<EOD
+${SSHD_KEYS}
addressfamily any
port 1234
port 5678