3 # make sure that telnet-probe does what its supposed to
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 host=`./getpmcdhosts -L -n 1 2>$seq.notrun`
24 status
=1 # failure is the default!
25 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
29 sed -e 's;/[^ ]*/telnet-probe\([: ]\);.../telnet-probe\1;'
35 -e 's/__pmGetAddrInfo/gethostbyname/g' \
36 -e 's/__pmGetHostByName/gethostbyname/g' \
37 -e '/gethostbyname:/s/ Resolver Error 0 (no error)/ Unknown host/' \
38 -e 's/No route to host/Connection refused/'
41 # real QA test starts here
44 echo; echo === 1st
test
45 echo quit |
$PCP_BINADM_DIR/telnet-probe
$host abc
>$tmp.out
2>&1
47 cat $tmp.out | _filter
48 echo "exit status is $sts (should be 1 with error msg)"
49 echo quit |
$PCP_BINADM_DIR/telnet-probe
1 2 3 >$tmp.out
2>&1
51 cat $tmp.out | _filter
52 echo "exit status is $sts (should be 1 with error msg)"
54 # should exit with good status
55 echo; echo === 2nd
test
56 echo quit |
$PCP_BINADM_DIR/telnet-probe localhost
22
57 echo "exit status is $? (should be 0)"
58 echo quit |
$PCP_BINADM_DIR/telnet-probe
$host 22
59 echo "exit status is $? (should be 0)"
61 # should fail to connect
63 # Note: [port] 26 below is unassigned by IANA although
64 # http://www.speedguide.net reports it may be used for RSFTP (simple
65 # FTP-like service) and perhaps an SMTP alternate ... for our
66 # purposes we're looking for a port that has no one listening
68 # Another note: some firewalls will respond with "No route to host"
69 # rather than "Connection refused", so treat these as equivalent
71 echo; echo === 3rd
test
72 echo quit |
$PCP_BINADM_DIR/telnet-probe
-v localhost
26 >$tmp.out
2>$tmp.err
74 cat $tmp.err
$tmp.out | _filter2
75 echo "exit status is $sts (should be 1 with verbosity)"
76 echo quit |
$PCP_BINADM_DIR/telnet-probe
-v $host 26 >$tmp.out
2>$tmp.err
78 cat $tmp.err
$tmp.out | _filter2
79 echo "exit status is $sts (should be 1 with verbosity)"
80 echo quit |
$PCP_BINADM_DIR/telnet-probe
-v no.such.
host.pcp.io
26 >$tmp.out
2>$tmp.err
82 cat $tmp.err
$tmp.out | _filter2
83 echo "exit status is $sts (should be 1 with verbosity)"