Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / bin / tests / system / tkey / tests.sh
blobb1a8d79e3ce36146f74a0e179f15f4888de5b7b9
1 #!/bin/sh
3 # Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: tests.sh,v 1.9 2009/07/19 23:47:55 tbox Exp
20 SYSTEMTESTTOP=..
21 . $SYSTEMTESTTOP/conf.sh
23 DIGOPTS="@10.53.0.1 -p 5300"
25 status=0
27 RANDFILE=random.data
29 echo "I:generating new DH key"
30 ret=0
31 dhkeyname=`$KEYGEN -T KEY -a DH -b 768 -n host -r $RANDFILE client` || ret=1
32 if [ $ret != 0 ]; then
33 echo "I:failed"
34 echo "I:exit status: $status"
35 exit $status
37 status=`expr $status + $ret`
39 for owner in . foo.example.
41 echo "I:creating new key using owner name \"$owner\""
42 ret=0
43 keyname=`./keycreate $dhkeyname $owner` || ret=1
44 if [ $ret != 0 ]; then
45 echo "I:failed"
46 echo "I:exit status: $status"
47 exit $status
49 status=`expr $status + $ret`
51 echo "I:checking the new key"
52 ret=0
53 $DIG $DIGOPTS . ns -k $keyname > dig.out.1 || ret=1
54 grep "status: NOERROR" dig.out.1 > /dev/null || ret=1
55 grep "TSIG.*hmac-md5.*NOERROR" dig.out.1 > /dev/null || ret=1
56 grep "Some TSIG could not be validated" dig.out.1 > /dev/null && ret=1
57 if [ $ret != 0 ]; then
58 echo "I:failed"
60 status=`expr $status + $ret`
62 echo "I:deleting new key"
63 ret=0
64 ./keydelete $keyname || ret=1
65 if [ $ret != 0 ]; then
66 echo "I:failed"
68 status=`expr $status + $ret`
70 echo "I:checking that new key has been deleted"
71 ret=0
72 $DIG $DIGOPTS . ns -k $keyname > dig.out.2 || ret=1
73 grep "status: NOERROR" dig.out.2 > /dev/null && ret=1
74 grep "TSIG.*hmac-md5.*NOERROR" dig.out.2 > /dev/null && ret=1
75 grep "Some TSIG could not be validated" dig.out.2 > /dev/null || ret=1
76 if [ $ret != 0 ]; then
77 echo "I:failed"
79 status=`expr $status + $ret`
80 done
82 echo "I:exit status: $status"
83 exit $status