#!/bin/sh
# $Id: check-run2 9790 2007-01-02 15:25:01Z rsh $
#
# check-run2 -- Shell script to test ike-scan to localhost
#
# Author: Roy Hills
# Date: 13 January 2004
#
# This shell script runs ike-scan against a port on localhost (127.0.0.1),
# which is unlikely to be listening, and checks that it reports correctly.
#
TMPFILE=/tmp/ike-scan-test.$$.tmp
#
echo "Checking ike-scan --sport=0 --dport=33434 127.0.0.1 ..."
$srcdir/ike-scan --nodns --retry=1 --sport=0 --dport=33434 127.0.0.1 >$TMPFILE 2>&1
if test $? -ne 0; then
   rm -f $TMPFILE
   echo "FAILED"
   exit 1
fi
grep '^Ending ike-scan.* 0 returned handshake; 0 returned notify$' $TMPFILE >/dev/null
if test $? -ne 0; then
   rm -f $TMPFILE
   echo "FAILED"
   exit 1
fi
echo "ok"
#
rm -f $TMPFILE
