diff options
-rwxr-xr-x | nsswitch/tests/test_wbinfo_user_info.sh | 83 | ||||
-rw-r--r-- | selftest/knownfail.d/upn_handling | 11 | ||||
-rwxr-xr-x | source3/selftest/tests.py | 14 |
3 files changed, 108 insertions, 0 deletions
diff --git a/nsswitch/tests/test_wbinfo_user_info.sh b/nsswitch/tests/test_wbinfo_user_info.sh new file mode 100755 index 00000000000..2803ac1408b --- /dev/null +++ b/nsswitch/tests/test_wbinfo_user_info.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# Blackbox test for wbinfo lookup for account name and upn +# Copyright (c) 2018 Andreas Schneider <asn@samba.org> + +if [ $# -lt 5 ]; then +cat <<EOF +Usage: $(basename $0) DOMAIN REALM USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2 +EOF +exit 1; +fi + +DOMAIN=$1 +REALM=$2 +USERNAME1=$3 +UPN_NAME1=$4 +USERNAME2=$5 +UPN_NAME2=$6 +shift 6 + +failed=0 + +samba_bindir="$BINDIR" +wbinfo_tool="$VALGRIND $samba_bindir/wbinfo" + +UPN1="$UPN_NAME1@$REALM" +UPN2="$UPN_NAME2@$REALM" + +. $(dirname $0)/../../testprogs/blackbox/subunit.sh + +test_user_info() +{ + local cmd out ret user domain upn userinfo + + domain="$1" + user="$2" + upn="$3" + + if [ $# -lt 3 ]; then + userinfo="$domain/$user" + else + userinfo="$upn" + fi + + cmd='$wbinfo_tool --user-info $userinfo' + eval echo "$cmd" + out=$(eval $cmd) + ret=$? + if [ $ret -ne 0 ]; then + echo "failed to lookup $userinfo" + echo "$out" + return 1 + fi + + echo "$out" | grep "$domain/$user:.*:.*:.*::/home/$domain/Domain Users/$user" + ret=$? + if [ $ret != 0 ]; then + echo "failed to lookup $userinfo" + echo "$out" + return 1 + fi + + return 0 +} + +testit "name_to_sid.domain.$USERNAME1" $wbinfo_tool --name-to-sid $DOMAIN/$USERNAME1 || failed=$(expr $failed + 1) +testit "name_to_sid.upn.$UPN_NAME1" $wbinfo_tool --name-to-sid $UPN1 || failed=$(expr $failed + 1) + +testit "user_info.domain.$USERNAME1" test_user_info $DOMAIN $USERNAME1 || failed=$(expr $failed + 1) +testit "user_info.upn.$UPN_NAME1" test_user_info $DOMAIN $USERNAME1 $UPN1 || failed=$(expr $failed + 1) + +testit "name_to_sid.domain.$USERNAME2" $wbinfo_tool --name-to-sid $DOMAIN/$USERNAME2 || failed=$(expr $failed + 1) +testit "name_to_sid.upn.$UPN_NAME2" $wbinfo_tool --name-to-sid $UPN2 || failed=$(expr $failed + 1) + +testit "user_info.domain.$USERNAME2" test_user_info $DOMAIN $USERNAME2 || failed=$(expr $failed + 1) +testit "user_info.upn.$UPN_NAME2" test_user_info $DOMAIN $USERNAME2 $UPN2 || failed=$(expr $failed + 1) + +USERNAME3="testdenied" +UPN_NAME3="testdenied_upn" +UPN3="$UPN_NAME3@${REALM}.upn" +testit "name_to_sid.upn.$UPN_NAME3" $wbinfo_tool --name-to-sid $UPN3 || failed=$(expr $failed + 1) +testit "user_info.upn.$UPN_NAME3" test_user_info $DOMAIN $USERNAME3 $UPN3 || failed=$(expr $failed + 1) + +exit $failed diff --git a/selftest/knownfail.d/upn_handling b/selftest/knownfail.d/upn_handling new file mode 100644 index 00000000000..308c2948e8d --- /dev/null +++ b/selftest/knownfail.d/upn_handling @@ -0,0 +1,11 @@ +^samba3\.wbinfo_user_info\.name_to_sid\.upn\.jane\.doe.ad_member +^samba3\.wbinfo_user_info\.user_info\.upn\.jane\.doe.ad_member +^samba3\.wbinfo_user_info\.name_to_sid\.upn\.testdenied_upn.ad_member +^samba3\.wbinfo_user_info\.user_info\.upn\.testdenied_upn.ad_member +^samba3\.wbinfo_user_info\.user_info\.domain\.alice.fl2008r2dc +^samba3\.wbinfo_user_info\.user_info\.upn\.alice.fl2008r2dc +^samba3\.wbinfo_user_info\.name_to_sid\.upn\.jane\.doe.fl2008r2dc +^samba3\.wbinfo_user_info\.user_info\.domain\.jane.fl2008r2dc +^samba3\.wbinfo_user_info\.user_info\.upn\.jane\.doe.fl2008r2dc +^samba3\.wbinfo_user_info\.name_to_sid\.upn\.testdenied_upn.fl2008r2dc +^samba3\.wbinfo_user_info\.user_info\.upn\.testdenied_upn.fl2008r2dc diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index a5acab2792a..ac21284b88b 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -211,6 +211,20 @@ plantestsuite("samba3.wbinfo_name_lookup", env, [ os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_name_lookup.sh"), '$DOMAIN', '$REALM', '$DC_USERNAME' ]) + +env = "ad_member:local" +plantestsuite("samba3.wbinfo_user_info", env, + [ os.path.join(srcdir(), + "nsswitch/tests/test_wbinfo_user_info.sh"), + '$DOMAIN', '$REALM', 'alice', 'alice', 'jane', 'jane.doe' ]) + +env = "fl2008r2dc:local" +plantestsuite("samba3.wbinfo_user_info", env, + [ os.path.join(srcdir(), + "nsswitch/tests/test_wbinfo_user_info.sh"), + '$TRUST_DOMAIN', '$TRUST_REALM', 'alice', 'alice', 'jane', 'jane.doe' ]) + +env = "ad_member" t = "WBCLIENT-MULTI-PING" plantestsuite("samba3.smbtorture_s3.%s" % t, env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//foo/bar', '""', '""', smbtorture3, ""]) plantestsuite("samba3.substitutions", env, [os.path.join(samba3srcdir, "script/tests/test_substitutions.sh"), "$SERVER", "alice", "Secret007", "$PREFIX"]) |