2 # Blackbox test for wbinfo name lookup
5 Usage: test_wbinfo_name_lookup.sh DOMAIN REALM DC_USERNAME
17 wbinfo
="$VALGRIND $sambabindir/wbinfo"
19 . $
(dirname $0)/..
/..
/testprogs
/blackbox
/subunit.sh
21 # Correct query is expected to work
22 testit
"name-to-sid.single-separator" \
23 $wbinfo -n $DOMAIN/$DC_USERNAME ||
24 failed
=$
(expr $failed + 1)
26 testit
"name-to-sid.at_domain" \
27 $wbinfo -n $DOMAIN/ ||
28 failed
=$
(expr $failed + 1)
30 testit
"name-to-sid.upn" \
31 $wbinfo -n $DC_USERNAME@
$REALM ||
32 failed
=$
(expr $failed + 1)
34 testit
"name-to-sid.realm-user" \
35 $wbinfo -n $REALM/$DC_USERNAME ||
36 failed
=$
(expr $failed + 1)
38 # For the name-to-sid.realm-user query, ensure
39 # that this does not change subsequent sid-to-name
41 sid
=$
($wbinfo -n $REALM/$DC_USERNAME |
sed -e 's/ .*//')
42 out
=$
($wbinfo -s $sid |
sed -e 's/ .//')
43 # winbindd returns usernames in lowercase
44 lcuser
=$
(echo $DC_USERNAME |
tr A-Z a-z
)
45 testit
"Verify DOMAIN/USER output" \
46 test "$out" = "$DOMAIN/$lcuser" ||
47 failed
=$
(expr $failed + 1)
49 # Two separator characters should fail
50 testit_expect_failure
"name-to-sid.double-separator" \
51 $wbinfo -n $DOMAIN//$DC_USERNAME ||
52 failed
=$
(expr $failed + 1)
54 # Invalid domain is expected to fail
55 testit_expect_failure
"name-to-sid.invalid-domain" \
56 $wbinfo -n INVALID
/$DC_USERNAME ||
57 failed
=$
(expr $failed + 1)
59 # Invalid domain with two separator characters is expected to fail
60 testit_expect_failure
"name-to-sid.double-separator-invalid-domain" \
61 $wbinfo -n INVALID
//$DC_USERNAME ||
62 failed
=$
(expr $failed + 1)