summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-06-17 23:54:15 +0200
committerKarolin Seeger <kseeger@samba.org>2008-06-23 14:19:30 +0200
commitcd56e0ea2023e5025e09acfd9d2720caf87452df (patch)
treee6d764be9904c782515ef74c6c91ed72e84fc200
parent766c12bc485d04c143079afca93b8ebba3f77f67 (diff)
downloadsamba-cd56e0ea2023e5025e09acfd9d2720caf87452df.tar.gz
testsuite: give admin rights to testuser only for the "net rpc registry" test.
Remove the user from BUILTIN\Administrators at the end of the tests. Note: BUILTIN\Administrators is not deletet at the end because that functionality is not implemented. Michael (cherry picked from commit 1734f9305a38eff05f0147d9c7391ef34085e7b2) (cherry picked from commit 1df339954b1dcc120195b26a6b3a08268dd0041c)
-rwxr-xr-xsource/script/tests/test_net_registry.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/script/tests/test_net_registry.sh b/source/script/tests/test_net_registry.sh
index b263ecbea6d..4fe6db42d78 100755
--- a/source/script/tests/test_net_registry.sh
+++ b/source/script/tests/test_net_registry.sh
@@ -329,6 +329,41 @@ test_setvalue_twice()
${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE2} ${VALVALUE2}
}
+give_administrative_rights()
+{
+ bin/net -s $SERVERCONFFILE sam createbuiltingroup Administrators
+ if test "x$?" != "x0" ; then
+ echo "ERROR: creating builtin group Administrators"
+ false
+ return
+ fi
+
+ bin/net -s $SERVERCONFFILE sam addmem BUILTIN\\Administrators $USERNAME
+ if test "x$?" != "x0" ; then
+ echo "ERROR: adding user $USERNAME to BUILTIN\\Administrators"
+ false
+ else
+ true
+ fi
+}
+
+take_administrative_rights()
+{
+ bin/net -s $SERVERCONFFILE sam delmem BUILTIN\\Administrators $USERNAME
+ if test "x$?" != "x0" ; then
+ echo "ERROR: removing user $USERNAME from BUILTIN\\Administrators"
+ false
+ else
+ true
+ fi
+}
+
+if test "x${RPC}" = "xrpc" ; then
+testit "giving user ${USERNAME} administrative rights" \
+ give_administrative_rights || \
+ failed=`expr $failed +1`
+fi
+
testit "enumerate HKLM" \
test_enumerate HKLM || \
failed=`expr $failed + 1`
@@ -396,5 +431,11 @@ testit "delete key with value" \
test_deletekey HKLM/testkey || \
failed=`expr $failed + 1`
+if test "x${RPC}" = "xrpc" ; then
+testit "taking administrative rights from user ${USERNAME}" \
+ take_administrative_rights || \
+ failed=`expr $failed +1`
+fi
+
testok $0 $failed