The branch, master has been updated
       via  304271b... s3: registry: add tests with empty valuename
       via  12ce164... s3: registry: let test_setvalue use getvalueraw instead 
of enumerate
       via  0a17344... s3: registry: fix query empty valuenames
      from  136ea7b... s3-waf: Actually make --with/--without-swat work

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 304271bd8feb77891b57ed4db3b7c4070bfa9a1f
Author: Gregor Beck <[email protected]>
Date:   Wed May 19 11:37:23 2010 +0200

    s3: registry: add tests with empty valuename
    
    Signed-off-by: Michael Adam <[email protected]>

commit 12ce1643849a4cbbf1435d4f9ab7b1a951f86d07
Author: Gregor Beck <[email protected]>
Date:   Wed May 19 12:20:10 2010 +0200

    s3: registry: let test_setvalue use getvalueraw instead of enumerate
    
    simplifies code, prerequisite to handle empty valuenames
    
    Signed-off-by: Michael Adam <[email protected]>

commit 0a173444ac7bba8d69bbc80792215930ce65fdc3
Author: Gregor Beck <[email protected]>
Date:   Wed May 19 11:16:54 2010 +0200

    s3: registry: fix query empty valuenames
    
    Remove a check introduced with commit 
80c2446321c519797a57b8006942a983f8481d79
    wich causes queries for values with empty name to fail. Empty valuenames are
    used for the so called default value of a key.
    
    Signed-off-by: Michael Adam <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/registry/reg_backend_db.c         |    2 +-
 source3/script/tests/test_net_registry.sh |   64 +++++++++++++---------------
 2 files changed, 31 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/registry/reg_backend_db.c 
b/source3/registry/reg_backend_db.c
index 89a6e95..278359f 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -1560,7 +1560,7 @@ static int regdb_unpack_values(struct regval_ctr *values, 
uint8 *buf, int buflen
 
                /* add the new value. Paranoid protective code -- make sure 
data_p is valid */
 
-               if (*valuename && size && data_p) {
+               if (size && data_p) {
                        regval_ctr_addvalue(values, valuename, type,
                                        (const char *)data_p, size);
                }
diff --git a/source3/script/tests/test_net_registry.sh 
b/source3/script/tests/test_net_registry.sh
index 52a78bc..2419263 100755
--- a/source3/script/tests/test_net_registry.sh
+++ b/source3/script/tests/test_net_registry.sh
@@ -237,7 +237,7 @@ test_deletekey_with_subkey()
 test_setvalue()
 {
        KEY="$1"
-       VALNAME="$2"
+       VALNAME="${2#_}"
        VALTYPE="$3"
        VALVALUE="$4"
 
@@ -248,7 +248,7 @@ test_setvalue()
                return
        fi
 
-       OUTPUT=`${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE} ${VALVALUE}`
+       OUTPUT=`${NETREG} setvalue ${KEY} "${VALNAME}" ${VALTYPE} ${VALVALUE}`
        if test "x$?" != "x0" ; then
                echo "ERROR: failed to set value testval in key ${KEY}"
                printf "%s\n" "${OUTPUT}"
@@ -256,54 +256,38 @@ test_setvalue()
                return
        fi
 
-       OUTPUT=`${NETREG} enumerate ${KEY}`
+       OUTPUT=`${NETREG} getvalueraw ${KEY} "${VALNAME}"`
        if test "x$?" != "x0" ; then
-               echo "ERROR: failure calling enumerate for key ${KEY}"
+               echo "ERROR: failure calling getvalueraw for key ${KEY}"
                echo output:
                printf "%s\n" "${OUTPUT}"
                false
                return
        fi
 
-       printf "%s\n" "$OUTPUT" | {
-       FOUND=0
-       while read LINE ; do
-               SEARCH1=`echo $LINE | grep '^Valuename' | grep ${VALNAME}`
-               if test "x$?" = "x0" ; then
-                       read LINE
-                       read LINE
-                       SEARCH2=`echo $LINE | grep '^Value ' | grep ${VALVALUE}`
-                       if test "x$?" = "x0" ; then
-                               FOUND=1
-                               break
-                       fi
-               fi
-       done
-
-       if test "x$FOUND" != "x1" ; then
-               echo "ERROR: did not find value '${VALNAME}' with enumerate"
-               echo "enumerate output:"
-               printf "%s\n" "$OUTPUT"
+       if test "x${OUTPUT}" != "x${VALVALUE}" ; then
+               echo "ERROR: failure retrieving value ${VALNAME} for key ${KEY}"
+               printf "expected: %s\ngot: %s\n" "${VALVALUE}" "${OUTPUT}"
                false
                return
        fi
-       }
+
 }
 
 test_deletevalue()
 {
        KEY="$1"
-       VALNAME="$2"
+       VALNAME="${2#_}"
 
-       ${NETREG} deletevalue ${KEY} ${VALNAME}
+       ${NETREG} deletevalue ${KEY} "${VALNAME}"
 }
 
 test_deletevalue_nonexisting()
 {
        KEY="$1"
-       VALNAME="$2"
+       VALNAME="${2#_}"
 
-       ${NETREG} deletevalue ${KEY} ${VALNAME}
+       ${NETREG} deletevalue ${KEY} "${VALNAME}"
        if test "x$?" = "x0" ; then
                echo "ERROR: succeeded deleting value ${VALNAME}"
                false
@@ -315,13 +299,13 @@ test_deletevalue_nonexisting()
 test_setvalue_twice()
 {
        KEY="$1"
-       VALNAME="$2"
+       VALNAME="${2#_}"
        VALTYPE1="$3"
        VALVALUE1="$4"
        VALTYPE2="$5"
        VALVALUE2="$6"
 
-       OUTPUT=`test_setvalue ${KEY} ${VALNAME} ${VALTYPE1} ${VALVALUE1}`
+       OUTPUT=`test_setvalue ${KEY} _"${VALNAME}" ${VALTYPE1} ${VALVALUE1}`
        if test "x$?" != "x0" ; then
                echo "ERROR: first setvalue call failed"
                printf "%s\n" "$OUTPUT"
@@ -329,7 +313,7 @@ test_setvalue_twice()
                return
        fi
 
-       ${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE2} ${VALVALUE2}
+       ${NETREG} setvalue ${KEY} "${VALNAME}" ${VALTYPE2} ${VALVALUE2}
 }
 
 give_administrative_rights()
@@ -418,21 +402,33 @@ testit "delete key with subkey" \
        failed=`expr $failed + 1`
 
 testit "set value" \
-       test_setvalue HKLM/testkey testval sz moin || \
+       test_setvalue HKLM/testkey _testval sz moin || \
        failed=`expr $failed + 1`
 
 testit "delete value" \
-       test_deletevalue HKLM/testkey testval || \
+       test_deletevalue HKLM/testkey _testval || \
        failed=`expr $failed + 1`
 
 testit "delete nonexisting value" \
-       test_deletevalue_nonexisting HKLM/testkey testval || \
+       test_deletevalue_nonexisting HKLM/testkey _testval || \
        failed=`expr $failed + 1`
 
 testit "set value to different type" \
        test_setvalue_twice HKLM/testkey testval sz moin dword 42 || \
        failed=`expr $failed + 1`
 
+testit "set default value" \
+       test_setvalue HKLM/testkey _"" sz 42 || \
+       failed=`expr $failed + 1`
+
+testit "delete default value" \
+       test_deletevalue HKLM/testkey _"" || \
+       failed=`expr $failed + 1`
+
+testit "delete nonexisting default value" \
+       test_deletevalue_nonexisting HKLM/testkey _"" || \
+       failed=`expr $failed + 1`
+
 testit "delete key with value" \
        test_deletekey HKLM/testkey || \
        failed=`expr $failed + 1`


-- 
Samba Shared Repository

Reply via email to