2 # $Id: domain.t 5948 2002-12-08 04:20:46Z rra $
4 # Test suite for domain.
6 # The count starts at 1 and is updated each time ok is printed. printcount
7 # takes "ok" or "not ok".
11 count=`expr $count + 1`
14 # Run domain, expecting it to succeed. Feed it the client host the way that
15 # nnrpd would. Takes the client host, the domain to check it against, and the
18 output=`( echo ClientHost: $1 ; echo ClientIP: 127.0.0.1 ; \
19 echo ClientPort: 0 ; echo LocalIP: 127.0.0.1 ; \
20 echo LocalPort: 119) | $domain $2 2>&1`
22 if test $status = 0 && test x"$output" = x"$3" ; then
31 # Run domain, expecting it to fail, and make sure it fails with status 1 and
32 # prints out the right error message. Takes the client host, the domain to
33 # check it against, and the expected output string.
35 output=`( echo ClientHost: $1 ; echo ClientIP: 127.0.0.1 ; \
36 echo ClientPort: 0 ; echo LocalIP: 127.0.0.1 ; \
37 echo LocalPort: 119) | $domain $2 2>&1`
39 if test $status = 1 && test x"$output" = x"$3" ; then
48 # Make sure we're in the right directory.
50 for dir in authprogs ../authprogs ../../authprogs ; do
51 test -x "$dir/domain" && domain="$dir/domain"
54 # Print the test count.
57 # First, run the tests that we expect to succeed.
58 runsuccess "foo.example.com" ".example.com" "User:foo"
59 runsuccess "foo.example.com" "example.com" "User:foo"
60 runsuccess "foo.bar.example.com" ".example.com" "User:foo.bar"
61 runsuccess "foo.bar.example.com" "example.com" "User:foo.bar"
62 runsuccess "foo.example.com" "com" "User:foo.example"
64 # Now, run the tests that we expect to fail.
65 runfailure "example.com" "example.com" \
66 "domain: host example.com matches the domain exactly"
67 runfailure "foo.example.com" "example.net" \
68 "domain: host foo.example.com didn't match domain example.net"
69 runfailure "fooexample.com" "example.com" \
70 "domain: host fooexample.com didn't match domain example.com"