1139804Simp#	$OpenBSD: banner.sh,v 1.2 2003/10/11 11:49:49 dtucker Exp $
240711Swollman#	Placed in the Public Domain.
340711Swollman
440711Swollmantid="banner"
540711Swollmanecho "Banner $OBJ/banner.in" >> $OBJ/sshd_proxy
640711Swollman
740711Swollmanrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
840711Swollmantouch $OBJ/empty.in
940711Swollman
1040711Swollmantrace "test missing banner file"
1140711Swollmanverbose "test $tid: missing banner file"
1240711Swollman( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
1340711Swollman	cmp $OBJ/empty.in $OBJ/banner.out ) || \
1440711Swollman	fail "missing banner file"
15152543Syongari
1640711Swollmanfor s in 0 10 100 1000 10000 100000 ; do
1740711Swollman	if [ "$s" = "0" ]; then
1840711Swollman		# create empty banner
1940711Swollman		touch $OBJ/banner.in
2040711Swollman	elif [ "$s" = "10" ]; then
2140711Swollman		# create 10-byte banner file
2240711Swollman		echo "abcdefghi" >$OBJ/banner.in
2340711Swollman	else
2440711Swollman		# increase size 10x
2540711Swollman		cp $OBJ/banner.in $OBJ/banner.out
2640711Swollman		for i in 0 1 2 3 4 5 6 7 8 ; do
2740711Swollman			cat $OBJ/banner.out >> $OBJ/banner.in
2840711Swollman		done
2940711Swollman	fi
3040711Swollman
3140711Swollman	trace "test banner size $s"
3240711Swollman	verbose "test $tid: size $s"
3340711Swollman	( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
3440711Swollman		cmp $OBJ/banner.in $OBJ/banner.out ) || \
3540711Swollman		fail "banner size $s mismatch"
3640711Swollmandone
3740711Swollman
3840711Swollmantrace "test suppress banner (-q)"
3940711Swollmanverbose "test $tid: suppress banner (-q)"
4040711Swollman( ${SSH} -q -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
4140711Swollman	cmp $OBJ/empty.in $OBJ/banner.out ) || \
4240711Swollman	fail "suppress banner (-q)"
4340711Swollman
4440711Swollmanrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
4540711Swollman