]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
testsuite: give admin rights to testuser only for the "net rpc registry" test.
authorMichael Adam <obnox@samba.org>
Tue, 17 Jun 2008 21:54:15 +0000 (23:54 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 17 Jun 2008 21:54:15 +0000 (23:54 +0200)
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

source/script/tests/test_net_registry.sh

index b263ecbea6dba9daddaed269784c0d005486a7ae..4fe6db42d78f9682db4d0e400ee520f68f3092a2 100755 (executable)
@@ -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