Vendor import of Unbound 1.12.0.
[freebsd.git] / testdata / stream_ssl.tdir / stream_ssl.test
1 # #-- stream_ssl.test --#
2 # source the master var file when it's there
3 [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4 # use .tpkg.var.test for in test variable passing
5 [ -f .tpkg.var.test ] && source .tpkg.var.test
6
7 PRE="../.."
8 . ../common.sh
9 get_make
10 (cd $PRE; $MAKE streamtcp)
11
12 # first test streamtcp against the server unbound.
13 echo "> streamtcp -s www.example.com A IN"
14 $PRE/streamtcp -s -f 127.0.0.1@$SERV_PORT www.example.com. A IN >outfile 2>outerr
15 if test "$?" -ne 0; then
16         echo "exit status not OK"
17         echo "> cat logfiles"
18         cat outfile
19         cat outerr
20         echo "SSLSERVICE"
21         cat unboundserv.log
22         echo "SSLCLIENT"
23         cat unboundclie.log
24         echo "Not OK"
25         exit 1
26 else
27         echo "exit status OK"
28 fi
29 echo "> cat logfiles"
30 cat outfile
31 cat outerr
32 echo "SSLSERVICE"
33 cat unboundserv.log
34 echo "SSLCLIENT"
35 cat unboundclie.log
36 echo "> check answer"
37 if grep "10.20.30.40" outfile; then
38         echo "OK"
39 else
40         echo "Not OK"
41         exit 1
42 fi
43
44 rm -f outfile
45
46 # test client unbound (no SSL towards it, but it does SSL to the SSL service)
47 echo "> dig www.example.com A IN"
48 dig @127.0.0.1 -p $CLIE_PORT www.example.com. >outfile 2>&1
49 if test "$?" -ne 0; then
50         echo "exit status not OK"
51         echo "> cat logfiles"
52         cat outfile
53         echo "SSLSERVICE"
54         cat unboundserv.log
55         echo "SSLCLIENT"
56         cat unboundclie.log
57         echo "Not OK"
58         exit 1
59 else
60         echo "exit status OK"
61 fi
62 echo "> cat logfiles"
63 cat outfile
64 echo "SSLSERVICE"
65 cat unboundserv.log
66 echo "SSLCLIENT"
67 cat unboundclie.log
68 echo "> check answer"
69 if grep "10.20.30.40" outfile; then
70         echo "OK"
71 else
72         echo "Not OK"
73         exit 1
74 fi
75
76 exit 0