2 # Blackbox test for wbinfo lookup for account name and upn
3 # Copyright (c) 2018 Andreas Schneider <asn@samba.org>
7 Usage: $(basename $0) DOMAIN REALM USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2
22 samba_bindir="$BINDIR"
23 wbinfo_tool="$VALGRIND $samba_bindir/wbinfo"
25 UPN1="$UPN_NAME1@$REALM"
26 UPN2="$UPN_NAME2@$REALM"
28 . $(dirname $0)/../../testprogs/blackbox/subunit.sh
32 local cmd out ret user domain upn userinfo
39 userinfo="$domain/$user"
44 cmd='$wbinfo_tool --user-info $userinfo'
48 if [ $ret -ne 0 ]; then
49 echo "failed to lookup $userinfo"
54 echo "$out" | grep "$domain/$user:.*:.*:.*::/home/$domain/Domain Users/$user"
56 if [ $ret != 0 ]; then
57 echo "failed to lookup $userinfo"
65 testit "name_to_sid.domain.$USERNAME1" $wbinfo_tool --name-to-sid $DOMAIN/$USERNAME1 || failed=$(expr $failed + 1)
66 testit "name_to_sid.upn.$UPN_NAME1" $wbinfo_tool --name-to-sid $UPN1 || failed=$(expr $failed + 1)
68 testit "user_info.domain.$USERNAME1" test_user_info $DOMAIN $USERNAME1 || failed=$(expr $failed + 1)
69 testit "user_info.upn.$UPN_NAME1" test_user_info $DOMAIN $USERNAME1 $UPN1 || failed=$(expr $failed + 1)
71 testit "name_to_sid.domain.$USERNAME2" $wbinfo_tool --name-to-sid $DOMAIN/$USERNAME2 || failed=$(expr $failed + 1)
72 testit "name_to_sid.upn.$UPN_NAME2" $wbinfo_tool --name-to-sid $UPN2 || failed=$(expr $failed + 1)
74 testit "user_info.domain.$USERNAME2" test_user_info $DOMAIN $USERNAME2 || failed=$(expr $failed + 1)
75 testit "user_info.upn.$UPN_NAME2" test_user_info $DOMAIN $USERNAME2 $UPN2 || failed=$(expr $failed + 1)
77 USERNAME3="testdenied"
78 UPN_NAME3="testdenied_upn"
79 UPN3="$UPN_NAME3@${REALM}.upn"
80 testit "name_to_sid.upn.$UPN_NAME3" $wbinfo_tool --name-to-sid $UPN3 || failed=$(expr $failed + 1)
81 testit "user_info.upn.$UPN_NAME3" test_user_info $DOMAIN $USERNAME3 $UPN3 || failed=$(expr $failed + 1)