From 364ed537e0bcb3a97cae0f2d1ff72de9423ce0e6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 16 Oct 2018 15:16:18 +0200 Subject: [PATCH] testprogs/blackbox: add samba4.blackbox.test_primary_group test This demonstrates the bug, that happens when the primaryGroupID of a user is changed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13418 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- .../samba4.blackbox.test_primary_group | 2 + source4/selftest/tests.py | 2 + testprogs/blackbox/test_primary_group.sh | 86 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 selftest/knownfail.d/samba4.blackbox.test_primary_group create mode 100755 testprogs/blackbox/test_primary_group.sh diff --git a/selftest/knownfail.d/samba4.blackbox.test_primary_group b/selftest/knownfail.d/samba4.blackbox.test_primary_group new file mode 100644 index 00000000000..779f6808c97 --- /dev/null +++ b/selftest/knownfail.d/samba4.blackbox.test_primary_group @@ -0,0 +1,2 @@ +^samba4.blackbox.test_primary_group.dbcheck.*run1 +^samba4.blackbox.test_primary_group.dbcheck.*run2 diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 6b5ceb556c9..24817e40fb5 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -430,6 +430,8 @@ for env in ["ad_member", "s4member", "ad_dc_ntvfs", "chgdcpass"]: plantestsuite("samba4.blackbox.samba_tool(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4]) plantestsuite("samba4.blackbox.net_rpc_user(ad_dc)", "ad_dc", [os.path.join(bbdir, "test_net_rpc_user.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN']) +plantestsuite("samba4.blackbox.test_primary_group", "ad_dc:local", [os.path.join(bbdir, "test_primary_group.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX_ABS']) + if have_heimdal_support: for env in ["ad_dc_ntvfs", "ad_dc"]: plantestsuite("samba4.blackbox.pkinit(%s:local)" % env, "%s:local" % env, [os.path.join(bbdir, "test_pkinit_heimdal.sh"), '$SERVER', 'pkinit', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX/%s' % env, "aes256-cts-hmac-sha1-96", smbclient4, configuration]) diff --git a/testprogs/blackbox/test_primary_group.sh b/testprogs/blackbox/test_primary_group.sh new file mode 100755 index 00000000000..c2d803e1d15 --- /dev/null +++ b/testprogs/blackbox/test_primary_group.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +if [ $# -lt 5 ]; then +cat < $ldif +rid=$(cat $ldif | sed -n 's/^objectSid: S-1-5-21-.*-.*-.*-//p') + +testit "search2" $VALGRIND $BINDIR/ldbsearch -H ldap://$SERVER_IP -U$USERNAME%$PASSWORD -d0 sAMAccountName="$testuser" dn || failed=`expr $failed + 1` +ldif="${TMPDIR}/search2.ldif" +$VALGRIND $BINDIR/ldbsearch -H ldap://$SERVER_IP -U$USERNAME%$PASSWORD -d0 sAMAccountName=$testuser dn > $ldif +user_dn=$(cat $ldif | sed -n 's/^dn: //p') + +ldif="${TMPDIR}/modify1.ldif" +cat > $ldif < $ldif <