summaryrefslogtreecommitdiffstats
path: root/regress
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2020-05-27 22:35:19 +0000
committerdjm <djm@openbsd.org>2020-05-27 22:35:19 +0000
commit502088be4e4a2bfe8480faa389ce3328af447516 (patch)
tree3a798dee320cf9cc87897888e16261ebfb8a4e99 /regress
parentmore tests after getopt_long.c rev. 1.32; (diff)
downloadwireguard-openbsd-502088be4e4a2bfe8480faa389ce3328af447516.tar.xz
wireguard-openbsd-502088be4e4a2bfe8480faa389ce3328af447516.zip
two new tests for Include in sshd_config, checking whether Port
directives are processed correctly and handling of Include directives that appear before Match. Both tests currently fail. bz#3122 and bz#3169 - patch from Jakub Jelen
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/servcfginclude.sh36
1 files changed, 35 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/servcfginclude.sh b/regress/usr.bin/ssh/servcfginclude.sh
index b25c8faa850..b6a9a248ff2 100644
--- a/regress/usr.bin/ssh/servcfginclude.sh
+++ b/regress/usr.bin/ssh/servcfginclude.sh
@@ -146,9 +146,43 @@ Include
_EOF
trace "disallow invalid with no argument"
-${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i.x \
+${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i.x -T \
-C "host=x,user=test,addr=127.0.0.1" 2>/dev/null && \
fail "sshd allowed Include with no argument"
+# Ensure the Include before any Match block works as expected (bug #3122)
+cat > $OBJ/sshd_config.i << _EOF
+Banner /xx
+HostKey $OBJ/host.ssh-ed25519
+Include $OBJ/sshd_config.i.2
+Match host a
+ Banner /aaaa
+_EOF
+cat > $OBJ/sshd_config.i.2 << _EOF
+Match host a
+ Banner /aa
+_EOF
+
+trace "Include before match blocks"
+trial a /aa "included file before match blocks is properly evaluated"
+
+# Port in included file is correctly interpretted (bug #3169)
+cat > $OBJ/sshd_config.i << _EOF
+Include $OBJ/sshd_config.i.2
+Port 7722
+_EOF
+cat > $OBJ/sshd_config.i.2 << _EOF
+HostKey $OBJ/host.ssh-ed25519
+_EOF
+
+trace "Port after included files"
+${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i -T \
+ -C "host=x,user=test,addr=127.0.0.1" > $OBJ/sshd_config.out || \
+ fail "failed to parse Port after included files"
+_port=`grep -i '^port ' $OBJ/sshd_config.out | awk '{print $2}'`
+if test "x7722" != "x$_port" ; then
+ fail "The Port in included file was intertepretted wrongly. Expected 7722, got $_port"
+fi
+
# cleanup
rm -f $OBJ/sshd_config.i $OBJ/sshd_config.i.* $OBJ/sshd_config.out