vfs_default: implement FSCTL_DUP_EXTENTS_TO_FILE with copy_reflink()
[samba4-gss.git] / nsswitch / tests / test_wbinfo_name_lookup.sh
blob048fdfcf6bc4342b5124ed8c70e539093de8e472
1 #!/bin/sh
2 # Blackbox test for wbinfo name lookup
3 if [ $# -lt 3 ]; then
4 cat <<EOF
5 Usage: test_wbinfo_name_lookup.sh DOMAIN REALM DC_USERNAME
6 EOF
7 exit 1
8 fi
10 DOMAIN=$1
11 REALM=$2
12 DC_USERNAME=$3
13 shift 3
15 failed=0
16 sambabindir="$BINDIR"
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
40 # queries.
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)
64 exit $failed