1#	$OpenBSD: connect-privsep.sh,v 1.9 2017/04/30 23:34:55 djm Exp $
2#	Placed in the Public Domain.
3
4tid="proxy connect with privsep"
5
6cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
7echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy
8
9${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
10if [ $? -ne 0 ]; then
11	fail "ssh privsep+proxyconnect failed"
12fi
13
14cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
15echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy
16
17${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
18if [ $? -ne 0 ]; then
19	fail "ssh privsep/sandbox+proxyconnect failed"
20fi
21
22# Because sandbox is sensitive to changes in libc, especially malloc, retest
23# with every malloc.conf option (and none).
24if [ -z "$TEST_MALLOC_OPTIONS" ]; then
25	mopts="C F G J R S U X < >"
26else
27	mopts=`echo $TEST_MALLOC_OPTIONS | sed 's/./& /g'`
28fi
29for m in '' $mopts ; do
30	env MALLOC_OPTIONS="$m" ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
31	if [ $? -ne 0 ]; then
32		fail "ssh privsep/sandbox+proxyconnect mopt '$m' failed"
33	fi
34done
35