reconfigure.sh revision 295367
1#	$OpenBSD: reconfigure.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2#	Placed in the Public Domain.
3
4tid="simple connect after reconfigure"
5
6# we need the full path to sshd for -HUP
7if test "x$USE_VALGRIND" = "x" ; then
8	case $SSHD in
9	/*)
10		# full path is OK
11		;;
12	*)
13		# otherwise make fully qualified
14		SSHD=$OBJ/$SSHD
15	esac
16fi
17
18start_sshd
19
20trace "connect before restart"
21for p in ${SSH_PROTOCOLS} ; do
22	${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
23	if [ $? -ne 0 ]; then
24		fail "ssh connect with protocol $p failed before reconfigure"
25	fi
26done
27
28PID=`$SUDO cat $PIDFILE`
29rm -f $PIDFILE
30$SUDO kill -HUP $PID
31
32trace "wait for sshd to restart"
33i=0;
34while [ ! -f $PIDFILE -a $i -lt 10 ]; do
35	i=`expr $i + 1`
36	sleep $i
37done
38
39test -f $PIDFILE || fatal "sshd did not restart"
40
41trace "connect after restart"
42for p in ${SSH_PROTOCOLS} ; do
43	${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
44	if [ $? -ne 0 ]; then
45		fail "ssh connect with protocol $p failed after reconfigure"
46	fi
47done
48