banner.sh revision 180720
1115170Speter#	$OpenBSD: banner.sh,v 1.2 2003/10/11 11:49:49 dtucker Exp $
299127Sobrien#	Placed in the Public Domain.
399127Sobrien
499127Sobrientid="banner"
599127Sobrienecho "Banner $OBJ/banner.in" >> $OBJ/sshd_proxy
699127Sobrien
799127Sobrienrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
899127Sobrientouch $OBJ/empty.in
999127Sobrien
1099127Sobrientrace "test missing banner file"
1199127Sobrienverbose "test $tid: missing banner file"
12115170Speter( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
1399127Sobrien	cmp $OBJ/empty.in $OBJ/banner.out ) || \
1499127Sobrien	fail "missing banner file"
1599127Sobrien
16115170Speterfor s in 0 10 100 1000 10000 100000 ; do
1799127Sobrien	if [ "$s" = "0" ]; then
1899127Sobrien		# create empty banner
1999127Sobrien		touch $OBJ/banner.in
2099127Sobrien	elif [ "$s" = "10" ]; then
21169612Swkoszek		# create 10-byte banner file
2299127Sobrien		echo "abcdefghi" >$OBJ/banner.in
2399127Sobrien	else
2499127Sobrien		# increase size 10x
2599127Sobrien		cp $OBJ/banner.in $OBJ/banner.out
2699127Sobrien		for i in 0 1 2 3 4 5 6 7 8 ; do
2799127Sobrien			cat $OBJ/banner.out >> $OBJ/banner.in
2899127Sobrien		done
2999127Sobrien	fi
3099127Sobrien
3199127Sobrien	trace "test banner size $s"
3299127Sobrien	verbose "test $tid: size $s"
3399127Sobrien	( ${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
34120589Speter		cmp $OBJ/banner.in $OBJ/banner.out ) || \
35179225Sjb		fail "banner size $s mismatch"
36174395Sjkoshydone
37179225Sjb
38115405Spetertrace "test suppress banner (-q)"
39115405Speterverbose "test $tid: suppress banner (-q)"
40115405Speter( ${SSH} -q -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
41114370Speter	cmp $OBJ/empty.in $OBJ/banner.out ) || \
4299127Sobrien	fail "suppress banner (-q)"
43218893Sdim
44232263Sdimrm -f $OBJ/banner.out $OBJ/banner.in $OBJ/empty.in
45232263Sdim