1126274Sdes#	$OpenBSD: banner.sh,v 1.2 2003/10/11 11:49:49 dtucker Exp $
2126274Sdes#	Placed in the Public Domain.
3126274Sdes
4126274Sdestid="banner"
5126274Sdesecho "Banner $OBJ/banner.in" >> $OBJ/sshd_proxy
6126274Sdes
7126274Sdesrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
8126274Sdestouch $OBJ/empty.in
9126274Sdes
10126274Sdestrace "test missing banner file"
11126274Sdesverbose "test $tid: missing banner file"
12126274Sdes( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
13126274Sdes	cmp $OBJ/empty.in $OBJ/banner.out ) || \
14126274Sdes	fail "missing banner file"
15126274Sdes
16126274Sdesfor s in 0 10 100 1000 10000 100000 ; do
17126274Sdes	if [ "$s" = "0" ]; then
18126274Sdes		# create empty banner
19126274Sdes		touch $OBJ/banner.in
20126274Sdes	elif [ "$s" = "10" ]; then
21126274Sdes		# create 10-byte banner file
22126274Sdes		echo "abcdefghi" >$OBJ/banner.in
23126274Sdes	else
24126274Sdes		# increase size 10x
25126274Sdes		cp $OBJ/banner.in $OBJ/banner.out
26126274Sdes		for i in 0 1 2 3 4 5 6 7 8 ; do
27126274Sdes			cat $OBJ/banner.out >> $OBJ/banner.in
28126274Sdes		done
29126274Sdes	fi
30126274Sdes
31126274Sdes	trace "test banner size $s"
32126274Sdes	verbose "test $tid: size $s"
33126274Sdes	( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
34126274Sdes		cmp $OBJ/banner.in $OBJ/banner.out ) || \
35126274Sdes		fail "banner size $s mismatch"
36126274Sdesdone
37126274Sdes
38126274Sdestrace "test suppress banner (-q)"
39126274Sdesverbose "test $tid: suppress banner (-q)"
40126274Sdes( ${SSH} -q -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
41126274Sdes	cmp $OBJ/empty.in $OBJ/banner.out ) || \
42126274Sdes	fail "suppress banner (-q)"
43126274Sdes
44126274Sdesrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
45