summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorBjörn Baumbach <bb@sernet.de>2019-06-12 21:02:43 +0200
committerBjörn Baumbach <bb@sernet.de>2019-06-18 16:54:22 +0000
commitd4b72821dc3484d29f459c954061e737cb1f5b5e (patch)
tree2a592500e58a84f2a0f171ebd329db9bb4714ccc /testprogs
parent6554cfa87e01bc606cb6ff9566e7e96808d02e91 (diff)
downloadsamba-d4b72821dc3484d29f459c954061e737cb1f5b5e.tar.gz
selftest: add tests for samba-tool ntacl changedomsid
Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Björn Baumbach <bb@sernet.de> Autobuild-Date(master): Tue Jun 18 16:54:22 UTC 2019 on sn-devel-184
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/blackbox/test_samba-tool_ntacl.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/testprogs/blackbox/test_samba-tool_ntacl.sh b/testprogs/blackbox/test_samba-tool_ntacl.sh
index 64a7e6b55d3..6991165cc63 100755
--- a/testprogs/blackbox/test_samba-tool_ntacl.sh
+++ b/testprogs/blackbox/test_samba-tool_ntacl.sh
@@ -10,6 +10,7 @@ exit 1;
fi
PREFIX=$1
+domain_sid=$2
failed=0
@@ -20,6 +21,8 @@ testfile="$PREFIX/ntacl_testfile"
# acl from samba_tool/ntacl.py tests
acl="O:DAG:DUD:P(A;OICI;0x001f01ff;;;DA)(A;OICI;0x001f01ff;;;EA)(A;OICIIO;0x001f01ff;;;CO)(A;OICI;0x001f01ff;;;DA)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001200a9;;;ED)S:AI(OU;CIIDSA;WP;f30e3bbe-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CIIDSA;WP;f30e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)"
+new_acl="O:S-1-5-21-2212615479-2695158682-2101375468-512G:S-1-5-21-2212615479-2695158682-2101375468-513D:P(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375468-512)(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375468-519)(A;OICIIO;0x001f01ff;;;CO)(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375468-512)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001200a9;;;ED)S:AI(OU;CIIDSA;WP;f30e3bbe-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CIIDSA;WP;f30e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)"
+new_domain_sid="S-1-5-21-2212615479-2695158682-2101375468"
. `dirname $0`/subunit.sh
@@ -62,6 +65,44 @@ test_set_acl_ntvfs()
$PYTHON $samba_tool ntacl set "$acl" "$testfile" --use-ntvfs --xattr-backend=tdb -s $PREFIX/ad_member/lib/server.conf
}
+test_changedomsid()
+{
+ testfile="$1"
+
+ $PYTHON $samba_tool ntacl changedomsid \
+ "$domain_sid" "$new_domain_sid" "$testfile" \
+ --service=tmp \
+ -s $PREFIX/ad_member/lib/server.conf
+
+ retacl=$($PYTHON $samba_tool ntacl get \
+ "$testfile" \
+ --as-sddl \
+ --service=tmp \
+ -s $PREFIX/ad_member/lib/server.conf) || return $?
+
+ test "$retacl" = "$new_acl"
+}
+
+test_changedomsid_ntvfs()
+{
+ testfile="$1"
+
+ $PYTHON $samba_tool ntacl changedomsid \
+ "$domain_sid" "$new_domain_sid" "$testfile" \
+ --use-ntvfs \
+ --xattr-backend=tdb \
+ -s $PREFIX/ad_member/lib/server.conf
+
+ retacl=$($PYTHON $samba_tool ntacl get \
+ "$testfile" \
+ --as-sddl \
+ --xattr-backend=tdb \
+ --use-ntvfs \
+ -s $PREFIX/ad_member/lib/server.conf) || return $?
+
+ test "$retacl" = "$new_acl"
+}
+
# work around include error - s4-loadparm does not allow missing include files
#
# Unable to load file /home/bbaumba/src/git/samba/st/ad_member/lib/server.conf
@@ -81,9 +122,13 @@ testit "set_ntacl" test_set_acl "$testfile" "$acl" || failed=`expr $failed + 1`
testit "get_ntacl" test_get_acl "$testfile" "$acl" || failed=`expr $failed + 1`
+testit "changedomsid" test_changedomsid "$testfile" || failed=`expr $failed + 1`
+
testit "set_ntacl_ntvfs" test_set_acl_ntvfs "$testfile" "$acl" || failed=`expr $failed + 1`
testit "get_ntacl_ntvfs" test_get_acl_ntvfs "$testfile" "$acl" || failed=`expr $failed + 1`
+testit "changedomsid_ntvfs" test_changedomsid_ntvfs "$testfile" || failed=`expr $failed + 1`
+
rm -f "$testfile"
exit $failed