1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

Add test for wbinfo name lookup

This demonstrates that wbinfo -n / --name-to-sid returns information
instead of failing the request. More specifically the query for
INVALIDDOMAIN//user returns the user SID for the joined domain, instead
of failing the request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 552a00ec1f6795b9025298931a6cc50ebe552052)
This commit is contained in:
Christof Schmitt 2018-02-28 13:10:43 -07:00 committed by Karolin Seeger
parent 8056016795
commit 40ee7863a5
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#!/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
DC_USERNAME=$2
shift 2
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)
# 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

View File

@ -343,3 +343,5 @@
# Disabling NTLM means you can't use samr to change the password
^samba.tests.ntlmdisabled.python\(ktest\).ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\)
^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
samba3.wbinfo_name_lookup.name-to-sid.double-separator\(ad_member\)
samba3.wbinfo_name_lookup.name-to-sid.double-separator-invalid-domain\(ad_member\)

View File

@ -207,6 +207,10 @@ for env in ["nt4_member", "ad_member"]:
env = "ad_member"
t = "--krb5auth=$DOMAIN/$DC_USERNAME%$DC_PASSWORD"
plantestsuite("samba3.wbinfo_simple.(%s:local).%s" % (env, t), "%s:local" % env, [os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_simple.sh"), t])
plantestsuite("samba3.wbinfo_name_lookup", env,
[ os.path.join(srcdir(),
"nsswitch/tests/test_wbinfo_name_lookup.sh"),
'$DOMAIN', '$DC_USERNAME' ])
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"])