1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

selftest: Confirm we can delete a user with a dangling backlink

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2020-02-24 11:58:48 +13:00
parent 3b95125187
commit f2a2b469b4

View File

@ -731,7 +731,52 @@ dangling_multi_valued_check_equal_or_too_many() {
fi
}
dangling_link_does_not_prevent_delete() {
#
# Step1: add user "dangling"
#
ldif=$PREFIX_ABS/${RELEASE}/backlink_can_be_vanished1.ldif
dn='CN=dangling-for-vanish,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp'
cat > $ldif <<EOF
dn: $dn
changetype: add
objectclass: user
samaccountname: dangling-v
objectGUID: fd8a04ac-cea0-4921-b1a6-c173e1155c23
EOF
out=$(TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --relax $ldif)
if [ "$?" != "0" ]; then
echo "ldbmodify returned:\n$out"
return 1
fi
#
# Step2: add a dangling backlink from
# "CN=dangling-for-vanish" to "CN=Enterprise Admins"
#
ldif=$PREFIX_ABS/${RELEASE}/backlink_can_be_vanished2.ldif
{
echo "dn: $dn"
echo "changetype: modify"
echo "add: memberOf"
echo "memberOf: <GUID=304ad703-468b-465e-9787-470b3dfd7d75>;<SID=S-1-5-21-4177067393-1453636373-93818738-519>;CN=Enterprise Admins,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp"
} > $ldif
out=$(TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-5-0-PRE1,DC%3DSAMBA,DC%3DCORP.ldb $ldif)
if [ "$?" != "0" ]; then
echo "ldbmodify returned:\n$out"
return 1
fi
out=$(TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$dn")
if [ "$?" != "0" ]; then
echo "ldbdel returned:\n$out"
return 1
fi
}
if [ -d $release_dir ]; then
testit $RELEASE undump
testit "add_two_more_users" add_two_more_users
@ -791,6 +836,7 @@ if [ -d $release_dir ]; then
testit "dangling_multi_valued_check_equal_or_too_many" dangling_multi_valued_check_equal_or_too_many
# Currently this cannot pass
testit "dbcheck_dangling_multi_valued_clean" dbcheck_clean
testit "dangling_link_does_not_prevent_delete" dangling_link_does_not_prevent_delete
else
subunit_start_test $RELEASE
subunit_skip_test $RELEASE <<EOF