summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile6
-rw-r--r--regress/sftp-chroot.sh26
2 files changed, 31 insertions, 1 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 4ac5b4d42..b19c7ae22 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.64 2013/04/07 02:16:03 dtucker Exp $ 1# $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(REGRESS_TARGETS)
@@ -8,6 +8,7 @@ interop interop-tests: t-exec-interop
8 8
9clean: 9clean:
10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done 10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
11 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
11 rm -rf $(OBJ).putty 12 rm -rf $(OBJ).putty
12 13
13distclean: clean 14distclean: clean
@@ -38,6 +39,7 @@ LTESTS= connect \
38 key-options \ 39 key-options \
39 scp \ 40 scp \
40 sftp \ 41 sftp \
42 sftp-chroot \
41 sftp-cmds \ 43 sftp-cmds \
42 sftp-badcmds \ 44 sftp-badcmds \
43 sftp-batch \ 45 sftp-batch \
@@ -86,6 +88,8 @@ CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
86 ssh.log failed-ssh.log sshd.log failed-sshd.log \ 88 ssh.log failed-ssh.log sshd.log failed-sshd.log \
87 regress.log failed-regress.log ssh-log-wrapper.sh 89 regress.log failed-regress.log ssh-log-wrapper.sh
88 90
91SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
92
89# Enable all malloc(3) randomisations and checks 93# Enable all malloc(3) randomisations and checks
90TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" 94TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
91 95
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh
new file mode 100644
index 000000000..8c07979b4
--- /dev/null
+++ b/regress/sftp-chroot.sh
@@ -0,0 +1,26 @@
1# $OpenBSD: sftp-chroot.sh,v 1.1 2013/04/18 02:46:12 djm Exp $
2# Placed in the Public Domain.
3
4tid="sftp in chroot"
5
6COPY=${OBJ}/copy
7CHROOT=/var/run
8FILENAME=testdata_${USER}
9PRIVDATA=${CHROOT}/${FILENAME}
10
11if [ -z "$SUDO" ]; then
12 fatal "need SUDO to create file in /var/run, test won't work without"
13fi
14
15$SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
16 fatal "create $PRIVDATA failed"
17
18start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
19
20verbose "test $tid: get"
21rm -f ${COPY}
22${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \
23 fatal "Fetch ${FILENAME} failed"
24cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
25
26$SUDO rm $PRIVDATA