Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/script/tests/test_net_registry.sh

    r414 r740  
    11#!/bin/sh
    2 
    3 # Tests for the "net registry" and "net rpc registry" commands.
     2#
     3# Blackbox tests for the "net registry" and "net rpc registry" commands.
     4#
     5# Copyright (C) 2010-2011 Michael Adam <[email protected]>
     6# Copyright (C) 2010 Gregor Beck <[email protected]>
     7#
    48# rpc tests are chose by specifying "rpc" as commandline parameter.
    59
    6 RPC="$1"
     10if [ $# -lt 3 ]; then
     11cat <<EOF
     12Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION RPC
     13EOF
     14exit 1;
     15fi
     16
     17SCRIPTDIR="$1"
     18SERVERCONFFILE="$2"
     19CONFIGURATION="$3"
     20RPC="$4"
    721
    822NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
     
    1529
    1630test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    17 incdir=`dirname $0`
    18 . $incdir/test_functions.sh
     31incdir=`dirname $0`
     32. $incdir/.sh
    1933}
    2034
     
    145159
    146160        UNEXPECTED="Keyname = ${SUBKEY}"
    147         printf "%s\n" "$OUTPUT" | 'grep ^Keyname' | grep ${SUBKEY}
     161        printf "%s\n" "$OUTPUT" | ^Keyname' | grep ${SUBKEY}
    148162        if test "x$?" = "x0" ; then
    149163                echo "ERROR: found '$UNEXPECTED' after delete in output"
     
    238252{
    239253        KEY="$1"
    240         VALNAME="$2"
     254        VALNAME="$"
    241255        VALTYPE="$3"
    242256        VALVALUE="$4"
     
    249263        fi
    250264
    251         OUTPUT=`${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE} ${VALVALUE}`
     265        OUTPUT=`${NETREG} setvalue ${KEY} ${VALTYPE} ${VALVALUE}`
    252266        if test "x$?" != "x0" ; then
    253267                echo "ERROR: failed to set value testval in key ${KEY}"
     
    257271        fi
    258272
    259         OUTPUT=`${NETREG} enumerate ${KEY}`
    260         if test "x$?" != "x0" ; then
    261                 echo "ERROR: failure calling enumerate for key ${KEY}"
     273        OUTPUT=`${NETREG} `
     274        if test "x$?" != "x0" ; then
     275                echo "ERROR: failure calling for key ${KEY}"
    262276                echo output:
    263277                printf "%s\n" "${OUTPUT}"
     
    266280        fi
    267281
    268         printf "%s\n" "$OUTPUT" | {
    269         FOUND=0
    270         while read LINE ; do
    271                 SEARCH1=`echo $LINE | grep '^Valuename' | grep ${VALNAME}`
    272                 if test "x$?" = "x0" ; then
    273                         read LINE
    274                         read LINE
    275                         SEARCH2=`echo $LINE | grep '^Value ' | grep ${VALVALUE}`
    276                         if test "x$?" = "x0" ; then
    277                                 FOUND=1
    278                                 break
    279                         fi
    280                 fi
    281         done
    282 
    283         if test "x$FOUND" != "x1" ; then
    284                 echo "ERROR: did not find value '${VALNAME}' with enumerate"
    285                 echo "enumerate output:"
    286                 printf "%s\n" "$OUTPUT"
    287                 false
    288                 return
    289         fi
    290         }
     282        if test "x${OUTPUT}" != "x${VALVALUE}" ; then
     283                echo "ERROR: failure retrieving value ${VALNAME} for key ${KEY}"
     284                printf "expected: %s\ngot: %s\n" "${VALVALUE}" "${OUTPUT}"
     285                false
     286                return
     287        fi
     288
    291289}
    292290
     
    294292{
    295293        KEY="$1"
    296         VALNAME="$2"
    297 
    298         ${NETREG} deletevalue ${KEY} ${VALNAME}
     294        VALNAME="$"
     295
     296        ${NETREG} deletevalue ${KEY}
    299297}
    300298
     
    302300{
    303301        KEY="$1"
    304         VALNAME="$2"
    305 
    306         ${NETREG} deletevalue ${KEY} ${VALNAME}
     302        VALNAME="$"
     303
     304        ${NETREG} deletevalue ${KEY}
    307305        if test "x$?" = "x0" ; then
    308306                echo "ERROR: succeeded deleting value ${VALNAME}"
     
    316314{
    317315        KEY="$1"
    318         VALNAME="$2"
     316        VALNAME="$"
    319317        VALTYPE1="$3"
    320318        VALVALUE1="$4"
     
    322320        VALVALUE2="$6"
    323321
    324         OUTPUT=`test_setvalue ${KEY} ${VALNAME} ${VALTYPE1} ${VALVALUE1}`
     322        OUTPUT=`test_setvalue ${KEY} ${VALTYPE1} ${VALVALUE1}`
    325323        if test "x$?" != "x0" ; then
    326324                echo "ERROR: first setvalue call failed"
     
    330328        fi
    331329
    332         ${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE2} ${VALVALUE2}
    333 }
    334 
    335 give_administrative_rights()
    336 {
    337         bin/net -s $SERVERCONFFILE sam createbuiltingroup Administrators
    338         if test "x$?" != "x0" ; then
    339                 echo "ERROR: creating builtin group Administrators"
    340                 false
    341                 return
    342         fi
    343 
    344         bin/net -s $SERVERCONFFILE sam addmem BUILTIN\\Administrators $USERNAME
    345         if test "x$?" != "x0" ; then
    346                 echo "ERROR: adding user $USERNAME to BUILTIN\\Administrators"
    347                 false
    348         else
    349                 true
    350         fi
    351 }
    352 
    353 take_administrative_rights()
    354 {
    355         bin/net -s $SERVERCONFFILE sam delmem BUILTIN\\Administrators $USERNAME
    356         if test "x$?" != "x0" ; then
    357                 echo "ERROR: removing user $USERNAME from BUILTIN\\Administrators"
    358                 false
    359         else
    360                 true
    361         fi
    362 }
    363 
    364 if test "x${RPC}" = "xrpc" ; then
    365 testit "giving user ${USERNAME} administrative rights" \
    366         give_administrative_rights
    367         if [ "x$?" != "x0" ] ; then
    368                 failed=`expr $failed + 1`
    369                 testok $0 $failed
    370         fi
    371 fi
     330        ${NETREG} setvalue ${KEY} "${VALNAME}" ${VALTYPE2} ${VALVALUE2}
     331}
     332
    372333
    373334testit "enumerate HKLM" \
     
    419380
    420381testit "set value" \
    421         test_setvalue HKLM/testkey testval sz moin || \
     382        test_setvalue HKLM/testkey testval sz moin || \
    422383        failed=`expr $failed + 1`
    423384
    424385testit "delete value" \
    425         test_deletevalue HKLM/testkey testval || \
     386        test_deletevalue HKLM/testkey testval || \
    426387        failed=`expr $failed + 1`
    427388
    428389testit "delete nonexisting value" \
    429         test_deletevalue_nonexisting HKLM/testkey testval || \
     390        test_deletevalue_nonexisting HKLM/testkey testval || \
    430391        failed=`expr $failed + 1`
    431392
     
    434395        failed=`expr $failed + 1`
    435396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
    436409testit "delete key with value" \
    437410        test_deletekey HKLM/testkey || \
    438411        failed=`expr $failed + 1`
    439412
    440 if test "x${RPC}" = "xrpc" ; then
    441 testit "taking administrative rights from user ${USERNAME}" \
    442         take_administrative_rights || \
    443         failed=`expr $failed + 1`
    444 fi
    445413
    446414testok $0 $failed
Note: See TracChangeset for help on using the changeset viewer.