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	# XXX replace this with fail once sandbox has stabilised
20	warn "ssh privsep/sandbox+proxyconnect failed"
21fi
22
23# Because sandbox is sensitive to changes in libc, especially malloc, retest
24# with every malloc.conf option (and none).
25if [ -z "TEST_MALLOC_OPTIONS" ]; then
26	mopts="C F G J R S U X < >"
27else
28	mopts=`echo $TEST_MALLOC_OPTIONS | sed 's/./& /g'`
29fi
30for m in '' $mopts ; do
31	env MALLOC_OPTIONS="$m" ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
32	if [ $? -ne 0 ]; then
33		fail "ssh privsep/sandbox+proxyconnect mopt '$m' failed"
34	fi
35done
36