]> git.samba.org - metze/samba/wip.git/blobdiff - source3/script/tests/test_net_registry.sh
s3:selftest: create BUILTIN\\Administrators at startup
[metze/samba/wip.git] / source3 / script / tests / test_net_registry.sh
index 5edcb061ee2c0360941d8897cdc6bf7d404f0a96..22081ec2f617a0d97528085a5a15c0da35548dd0 100755 (executable)
@@ -7,8 +7,10 @@ RPC="$1"
 
 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
 
+NETREMOTE="${NET} -U${USERNAME}%${PASSWORD} -S ${SERVER} -I ${SERVER_IP}"
+
 if test "x${RPC}" = "xrpc" ; then
-       NETREG="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry"
+       NETREG="${NETREMOTE} rpc registry"
 else
        NETREG="${NET} registry"
 fi
@@ -332,14 +334,7 @@ test_setvalue_twice()
 
 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
+       ${NETREMOTE} rpc group addmem BUILTIN\\Administrators $USERNAME
        if test "x$?" != "x0" ; then
                echo "ERROR: adding user $USERNAME to BUILTIN\\Administrators"
                false
@@ -350,7 +345,7 @@ give_administrative_rights()
 
 take_administrative_rights()
 {
-       bin/net -s $SERVERCONFFILE sam delmem BUILTIN\\Administrators $USERNAME
+       ${NETREMOTE} rpc group delmem BUILTIN\\Administrators $USERNAME
        if test "x$?" != "x0" ; then
                echo "ERROR: removing user $USERNAME from BUILTIN\\Administrators"
                false
@@ -361,8 +356,11 @@ take_administrative_rights()
 
 if test "x${RPC}" = "xrpc" ; then
 testit "giving user ${USERNAME} administrative rights" \
-       give_administrative_rights || \
-       failed=`expr $failed + 1`
+       give_administrative_rights
+       if [ "x$?" != "x0" ] ; then
+               failed=`expr $failed + 1`
+               testok $0 $failed
+       fi
 fi
 
 testit "enumerate HKLM" \