2023-06-26 16:45:39 +03:00
#!/usr/bin/env bash
2017-04-09 00:20:40 +03:00
#
# Blackbox test for fetching a large ACL
#
if [ $# -lt 5 ] ; then
2022-04-22 16:34:09 +03:00
cat <<EOF
2017-04-09 00:20:40 +03:00
Usage: $0 SERVER USERNAME PASSWORD SMBCLIENT SMBCACLS PARAMS
EOF
2022-04-22 16:34:09 +03:00
exit 1
2017-04-09 00:20:40 +03:00
fi
SERVER = ${ 1 }
USERNAME = ${ 2 }
PASSWORD = ${ 3 }
SMBCLIENT = ${ 4 }
SMBCACLS = ${ 5 }
shift 5
ADDARGS = " $* "
SMBCLIENT = " $VALGRIND ${ SMBCLIENT } ${ ADDARGS } "
SMBCACLS = " $VALGRIND ${ SMBCACLS } ${ ADDARGS } "
2022-04-22 16:34:09 +03:00
incdir = $( dirname $0 ) /../../../testprogs/blackbox
2017-04-09 00:20:40 +03:00
. $incdir /subunit.sh
2020-11-19 20:10:02 +03:00
cd $SELFTEST_TMPDIR || exit 1
2017-04-09 00:20:40 +03:00
# build a file to work with
build_files( )
{
2022-04-22 16:34:09 +03:00
touch large_acl
$SMBCLIENT //$SERVER /acl_xattr_ign_sysacl_windows -U $USERNAME %$PASSWORD -c 'put large_acl' >/dev/null 2>& 1
rm -rf large_acl >/dev/null
2017-04-09 00:20:40 +03:00
}
cleanup( )
{
2022-04-22 16:34:09 +03:00
$SMBCLIENT //$SERVER /acl_xattr_ign_sysacl_windows -U $USERNAME %$PASSWORD -c 'rm large_acl' >/dev/null 2>& 1
2017-04-09 00:20:40 +03:00
}
build_files
test_large_acl( )
{
2022-04-22 16:34:09 +03:00
#An ACL with 200 entries, ~7K
s3/utils: when encoding ace string use "FA", "FR", "FW", "FX" string rights
prior to this patch rights matching "FA", "FR", "FW", "FX" were
outputted as the hex string representing the bit value.
While outputting the hex string is perfectly fine, it makes it harder
to compare icacls output (which always uses the special string values)
Additionally adjust various tests to deal with use of shortcut access masks
as sddl format now uses FA, FR, FW & FX strings (like icalcs does) instead
of hex representation of the bit mask.
adjust
samba4.blackbox.samba-tool_ntacl
samba3.blackbox.large_acl
samba.tests.samba_tool.ntacl
samba.tests.ntacls
samba.tests.posixacl
so various string comparisons of the sddl format now pass
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
[abartlet@samba.org Adapted to new stricter SDDL behaviour around leading zeros in hex
numbers, eg 0x001]
2022-08-25 16:29:09 +03:00
new_acl = $( seq 1001 1200 | sed -r -e '1 i\D:(A;;FA;;;WD)' -e 's/(.*)/(A;;FA;;;S-1-5-21-11111111-22222222-33333333-\1)/' | tr -d '\n' )
2022-04-22 16:34:09 +03:00
$SMBCACLS //$SERVER /acl_xattr_ign_sysacl_windows -U $USERNAME %$PASSWORD --sddl -S $new_acl large_acl
actual_acl = $( $SMBCACLS //$SERVER /acl_xattr_ign_sysacl_windows -U $USERNAME %$PASSWORD --sddl --numeric large_acl 2>/dev/null | sed -rn 's/.*(D:.*)/\1/p' | tr -d '\n' )
s3/utils: when encoding ace string use "FA", "FR", "FW", "FX" string rights
prior to this patch rights matching "FA", "FR", "FW", "FX" were
outputted as the hex string representing the bit value.
While outputting the hex string is perfectly fine, it makes it harder
to compare icacls output (which always uses the special string values)
Additionally adjust various tests to deal with use of shortcut access masks
as sddl format now uses FA, FR, FW & FX strings (like icalcs does) instead
of hex representation of the bit mask.
adjust
samba4.blackbox.samba-tool_ntacl
samba3.blackbox.large_acl
samba.tests.samba_tool.ntacl
samba.tests.ntacls
samba.tests.posixacl
so various string comparisons of the sddl format now pass
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
[abartlet@samba.org Adapted to new stricter SDDL behaviour around leading zeros in hex
numbers, eg 0x001]
2022-08-25 16:29:09 +03:00
if [ ! " $new_acl " = " $actual_acl " ] ; then
echo -e " expected:\n $new_acl \nactual:\n $actual_acl \n "
2022-04-22 16:34:09 +03:00
return 1
fi
2017-04-09 00:20:40 +03:00
}
failed = 0
2022-04-22 16:34:09 +03:00
testit "able to retrieve a large ACL if VFS supports it" test_large_acl || failed = $( expr $failed + 1)
2017-04-09 00:20:40 +03:00
cleanup
exit $failed