[PATCH 2/9] s4: blackbox tests for (s|g)etntacl

Matthieu Patou mat at matws.net
Thu Dec 24 04:33:42 MST 2009


---
 source4/selftest/tests.sh          |    1 +
 source4/utils/tests/test_ntacls.sh |   47 ++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100755 source4/utils/tests/test_ntacls.sh

diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh
index fa487db..b6b8b30 100755
--- a/source4/selftest/tests.sh
+++ b/source4/selftest/tests.sh
@@ -337,6 +337,7 @@ planperltest "selftest.samba4.pl" none $samba4srcdir/../selftest/test_samba4.pl
 # work correctly.
 
 plantest "blackbox.ndrdump" none $samba4srcdir/librpc/tests/test_ndrdump.sh
+plantest "blackbox.ntacls" none $samba4srcdir/utils/tests/test_ntacls.sh $SELFTEST_PREFIX
 plantest "blackbox.net" dc $samba4srcdir/utils/tests/test_net.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN"
 plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" $CONFIGURATION 
 plantest "blackbox.passwords" dc:local $bbdir/test_passwords.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX"
diff --git a/source4/utils/tests/test_ntacls.sh b/source4/utils/tests/test_ntacls.sh
new file mode 100755
index 0000000..5a26c60
--- /dev/null
+++ b/source4/utils/tests/test_ntacls.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Blackbox tests for ntacls utils (getntacl/setntacl)
+
+BASEDIR=$1
+shift 1
+
+failed=0
+
+samba4bindir="$BUILDDIR/bin"
+setntacl="$samba4bindir/setntacl$EXEEXT"
+getntacl="$samba4bindir/getntacl$EXEEXT"
+
+DSID="S-1-5-21-2212615479-2695158682-2101375467"
+SDDL="O:${DSID}-512G:${DSID}-513D:(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)"
+FILE="${BASEDIR}/testacls"
+
+testit() {
+	name="$1"
+	shift
+	cmdline="$*"
+	echo "test: $name"
+	OUTPUT=`$cmdline`
+	status=$?
+	if [ x$status = x0 ]; then
+		echo "success: $name"
+	else
+		echo "failure: $name"
+		failed=`expr $failed + 1`
+	fi
+	return $status
+}
+touch $FILE
+
+testit "setntacl" $VALGRIND $setntacl $SDDL ${FILE} 
+
+testit "getntacl" $VALGRIND $getntacl --as-sddl ${FILE} 
+
+if [ -n "$OUTPUT" ] && [ "$OUTPUT" = "$SDDL" ]; then
+  echo "success: check sddl"
+else
+  echo "failure: check sddl"
+	failed=`expr $failed + 1`
+fi
+
+exit $failed
+
+
-- 
1.6.3.3


--------------030909080602010403080508
Content-Type: text/x-patch;
 name="0001-s4-utils-recreate-setntacl-and-improve-setntacl.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-s4-utils-recreate-setntacl-and-improve-setntacl.patch"



More information about the samba-technical mailing list