]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbind: Add test for lookuprids cache problem
authorVolker Lendecke <vl@samba.org>
Wed, 8 Jul 2020 13:00:49 +0000 (15:00 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 9 Jul 2020 20:16:40 +0000 (20:16 +0000)
When reading entries from gencache, wb_cache_rids_to_names() can
return STATUS_SOME_UNMAPPED, which _wbint_LookupRids() does not handle
correctly.

This test enforces this situation by filling gencache with one wbinfo
-R and then erasing the winbindd_cache.tdb. This forces winbind to
enter the domain helper process, which will then read from gencache
filled with the previous wbinfo -R.

Without having the entries cached this does not happen because
wb_cache_rids_to_names() via the do_query: path calls deep inside
calls dcerpc_lsa_lookup_sids_noalloc(), which hides the
STATUS_SOME_UNMAPPED that came in as lsa_LookupSids result value.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14435
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
selftest/knownfail.d/lookuprids_cache [new file with mode: 0644]
source3/script/tests/test_wbinfo_lookuprids_cache.sh [new file with mode: 0755]
source3/selftest/tests.py

diff --git a/selftest/knownfail.d/lookuprids_cache b/selftest/knownfail.d/lookuprids_cache
new file mode 100644 (file)
index 0000000..d3c40a6
--- /dev/null
@@ -0,0 +1 @@
+^samba.wbinfo_lookuprids_cache.lookuprids2\(nt4_member:local\)
\ No newline at end of file
diff --git a/source3/script/tests/test_wbinfo_lookuprids_cache.sh b/source3/script/tests/test_wbinfo_lookuprids_cache.sh
new file mode 100755 (executable)
index 0000000..0b21ffc
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}"
+TDBTOOL="${TDBTOOL:-$BINDIR/tdbtool}"
+TDBDUMP="${TDBDUMP:-$BINDIR/tdbdump}"
+NET="$VALGRIND ${NET:-$BINDIR/net}"
+
+cache="$LOCK_DIR"/winbindd_cache.tdb
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+testit "flush" "$NET" "cache" "flush" || failed=`expr $failed + 1`
+testit "lookuprids1" "$WBINFO" "-R" "512,12345" || failed=`expr $failed + 1`
+
+key=$("$TDBDUMP" "$cache" | grep ^key.*NDR.*/16/ | cut -d\" -f2)
+
+testit "delete" "$TDBTOOL" "$cache" delete "$key"
+testit "lookuprids2" "$WBINFO" "-R" "512,12345" || failed=`expr $failed + 1`
+
+testok $0 $failed
index cfdfaa98c84aed98b1ab100821365720d6bf3208..e2aebdcb6e2b671c2694fd5c1d5afb8e6f51c23d 100755 (executable)
@@ -365,6 +365,11 @@ env = "nt4_member:local"
 plantestsuite("samba3.wbinfo_sids_to_xids", env,
               [os.path.join(srcdir(),
                             "nsswitch/tests/test_wbinfo_sids_to_xids.sh")])
+plantestsuite(
+    "samba.wbinfo_lookuprids_cache",
+    env,
+    [os.path.join(samba3srcdir,
+                  "script/tests/test_wbinfo_lookuprids_cache.sh")])
 
 env = "ad_member"
 t = "WBCLIENT-MULTI-PING"