summaryrefslogtreecommitdiff
path: root/nsswitch/tests/test_wbinfo_name_lookup.sh
blob: c1d39c1a602a8064bcebe665e56400f180540e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# Blackbox test for wbinfo name lookup
if [ $# -lt 2 ]; then
cat <<EOF
Usage: test_wbinfo.sh DOMAIN DC_USERNAME
EOF
exit 1;
fi

DOMAIN=$1
REALM=$2
DC_USERNAME=$3
shift 3

failed=0
sambabindir="$BINDIR"
wbinfo="$VALGRIND $sambabindir/wbinfo"

. `dirname $0`/../../testprogs/blackbox/subunit.sh

# Correct query is expected to work
testit "name-to-sid.single-separator" \
       $wbinfo -n $DOMAIN/$DC_USERNAME || \
	failed=$(expr $failed + 1)

testit "name-to-sid.at_domain" \
       $wbinfo -n $DOMAIN/ || \
	failed=$(expr $failed + 1)

testit "name-to-sid.upn" \
       $wbinfo -n $DC_USERNAME@$REALM || \
	failed=$(expr $failed + 1)

# Two separator characters should fail
testit_expect_failure "name-to-sid.double-separator" \
		      $wbinfo -n $DOMAIN//$DC_USERNAME || \
	failed=$(expr $failed + 1)

# Invalid domain is expected to fail
testit_expect_failure "name-to-sid.invalid-domain" \
		      $wbinfo -n INVALID/$DC_USERNAME || \
	failed=$(expr $failed + 1)

# Invalid domain with two separator characters is expected to fail
testit_expect_failure "name-to-sid.double-separator-invalid-domain" \
		      $wbinfo -n INVALID//$DC_USERNAME || \
	failed=$(expr $failed + 1)

exit $failed