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).
24for m in '' C F G J R S U X '<' '>'; do
25	env MALLOC_OPTIONS="$m" \
26		${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
27	if [ $? -ne 0 ]; then
28		fail "ssh privsep/sandbox+proxyconnect mopt '$m' failed"
29	fi
30done
31
32