The branch, master has been updated
       via  91a8d9b... s3-torture: Improve the winreg deletekey torture 
comments.
       via  2a15f70... s3-torture: Correctly cleanup the winreg volatile key 
test.
       via  0a8e382... s4-torture: Fixed the winreg EnumValue test against 
Windows.
      from  ee11bb87.. s3: Remove some direct cli->inbuf references in 
interpret_long_filename

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


- Log -----------------------------------------------------------------
commit 91a8d9bc9bfe557c1095a7262e3a1b28fc3279ab
Author: Andreas Schneider <[email protected]>
Date:   Thu Aug 5 16:05:31 2010 +0200

    s3-torture: Improve the winreg deletekey torture comments.

commit 2a15f7008c5b49cfa91c8001ad2541c5a6c80f73
Author: Andreas Schneider <[email protected]>
Date:   Thu Aug 5 15:35:52 2010 +0200

    s3-torture: Correctly cleanup the winreg volatile key test.
    
    Günther please check!

commit 0a8e382d73d16062502b98037d89bf003abc3c4b
Author: Andreas Schneider <[email protected]>
Date:   Thu Aug 5 15:24:20 2010 +0200

    s4-torture: Fixed the winreg EnumValue test against Windows.
    
    Günther please check!

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

Summary of changes:
 source4/torture/rpc/winreg.c |   74 ++++++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 84139af..c369389 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1461,7 +1461,10 @@ static bool test_DeleteKey(struct dcerpc_binding_handle 
*b,
 
 static bool test_QueryInfoKey(struct dcerpc_binding_handle *b,
                              struct torture_context *tctx,
-                             struct policy_handle *handle, char *kclass)
+                             struct policy_handle *handle,
+                             char *kclass,
+                             uint32_t *pmax_valnamelen,
+                             uint32_t *pmax_valbufsize)
 {
        struct winreg_QueryInfoKey r;
        uint32_t num_subkeys, max_subkeylen, max_classlen,
@@ -1491,6 +1494,14 @@ static bool test_QueryInfoKey(struct 
dcerpc_binding_handle *b,
 
        torture_assert_werr_ok(tctx, r.out.result, "QueryInfoKey failed");
 
+       if (pmax_valnamelen) {
+               *pmax_valnamelen = max_valnamelen;
+       }
+
+       if (pmax_valbufsize) {
+               *pmax_valbufsize = max_valbufsize;
+       }
+
        return true;
 }
 
@@ -1966,11 +1977,9 @@ static bool test_EnumValue(struct dcerpc_binding_handle 
*b,
        enum winreg_Type type = 0;
        uint32_t size = max_valbufsize, zero = 0;
        bool ret = true;
-       uint8_t buf8;
+       uint8_t *data = NULL;
        struct winreg_ValNameBuf name;
-
-       name.name   = "";
-       name.size   = 1024;
+       char n = '\0';
 
        ZERO_STRUCT(r);
        r.in.handle = handle;
@@ -1978,11 +1987,20 @@ static bool test_EnumValue(struct dcerpc_binding_handle 
*b,
        r.in.name = &name;
        r.out.name = &name;
        r.in.type = &type;
-       r.in.value = &buf8;
        r.in.length = &zero;
        r.in.size = &size;
 
        do {
+               name.name = &n;
+               name.size = max_valnamelen + 2;
+               name.length = 0;
+
+               data = NULL;
+               if (size) {
+                       data = (uint8_t *) talloc_array(tctx, uint8_t *, size);
+               }
+               r.in.value = data;
+
                torture_assert_ntstatus_ok(tctx,
                                           dcerpc_winreg_EnumValue_r(b, tctx, 
&r),
                                           "EnumValue failed");
@@ -1996,6 +2014,8 @@ static bool test_EnumValue(struct dcerpc_binding_handle 
*b,
                                                         r.out.name->name);
                }
 
+               talloc_free(data);
+
                r.in.enum_index++;
        } while (W_ERROR_IS_OK(r.out.result));
 
@@ -2082,11 +2102,14 @@ static bool test_key(struct dcerpc_pipe *p, struct 
torture_context *tctx,
                     bool test_security)
 {
        struct dcerpc_binding_handle *b = p->binding_handle;
+       uint32_t max_valnamelen = 0;
+       uint32_t max_valbufsize = 0;
 
        if (depth == MAX_DEPTH)
                return true;
 
-       if (!test_QueryInfoKey(b, tctx, handle, NULL)) {
+       if (!test_QueryInfoKey(b, tctx, handle, NULL,
+                              &max_valnamelen, &max_valbufsize)) {
        }
 
        if (!test_NotifyChangeKeyValue(b, tctx, handle)) {
@@ -2098,7 +2121,10 @@ static bool test_key(struct dcerpc_pipe *p, struct 
torture_context *tctx,
        if (!test_EnumKey(p, tctx, handle, depth, test_security)) {
        }
 
-       if (!test_EnumValue(b, tctx, handle, 0xFF, 0xFFFF)) {
+       if (!test_EnumValue(b, tctx, handle, max_valnamelen, max_valbufsize)) {
+       }
+
+       if (!test_EnumValue(b, tctx, handle, max_valnamelen, 0xFFFF)) {
        }
 
        test_CloseKey(b, tctx, handle);
@@ -2557,7 +2583,7 @@ static bool test_volatile_keys(struct torture_context 
*tctx,
                               struct policy_handle *handle,
                               int hkey)
 {
-       struct policy_handle new_handle;
+       struct policy_handle new_handle, hive_handle;
        enum winreg_CreateAction action_taken;
 
        torture_comment(tctx, "Testing VOLATILE key\n");
@@ -2631,15 +2657,11 @@ static bool test_volatile_keys(struct torture_context 
*tctx,
                "failed to close");
 
        torture_assert(tctx,
-               test_CloseKey(b, tctx, handle),
-               "failed to close");
-
-       torture_assert(tctx,
-               test_OpenHive(tctx, b, handle, hkey),
+               test_OpenHive(tctx, b, &hive_handle, hkey),
                "failed top open hive");
 
        torture_assert(tctx,
-               test_OpenKey_opts(tctx, b, handle, TEST_KEY_VOLATILE,
+               test_OpenKey_opts(tctx, b, &hive_handle, TEST_KEY_VOLATILE,
                                  REG_OPTION_VOLATILE,
                                  SEC_FLAG_MAXIMUM_ALLOWED,
                                  &new_handle,
@@ -2647,13 +2669,22 @@ static bool test_volatile_keys(struct torture_context 
*tctx,
                "failed to open volatile key");
 
        torture_assert(tctx,
-               test_OpenKey_opts(tctx, b, handle, TEST_KEY_VOLATILE,
+               test_OpenKey_opts(tctx, b, &hive_handle, TEST_KEY_VOLATILE,
                                  REG_OPTION_NON_VOLATILE,
                                  SEC_FLAG_MAXIMUM_ALLOWED,
                                  &new_handle,
                                  WERR_BADFILE),
                "failed to open volatile key");
 
+       torture_assert(tctx,
+               test_CloseKey(b, tctx, &hive_handle),
+               "failed to close");
+
+       torture_assert(tctx,
+               test_DeleteKey(b, tctx, handle, TEST_KEY_VOLATILE),
+               "failed to delete key");
+
+
        torture_comment(tctx, "Testing VOLATILE key succeeded\n");
 
        return true;
@@ -2891,7 +2922,8 @@ static bool test_key_base(struct torture_context *tctx,
                }
 
                if (!test_DeleteKey(b, tctx, handle, test_key1)) {
-                       torture_comment(tctx, "DeleteKey failed\n");
+                       torture_comment(tctx, "DeleteKey(%s) failed\n",
+                                             test_key1);
                        ret = false;
                } else {
                        deleted = true;
@@ -2926,13 +2958,13 @@ static bool test_key_base(struct torture_context *tctx,
                if (created3) {
                        if (test_CreateKey(b, tctx, handle, test_subkey, NULL)) 
{
                                if (!test_DeleteKey(b, tctx, handle, 
test_subkey)) {
-                                       torture_comment(tctx, "DeleteKey 
failed\n");
+                                       torture_comment(tctx, "DeleteKey(%s) 
failed\n", test_subkey);
                                        ret = false;
                                }
                        }
 
                        if (!test_DeleteKey(b, tctx, handle, test_key3)) {
-                               torture_comment(tctx, "DeleteKey failed\n");
+                               torture_comment(tctx, "DeleteKey(%s) failed\n", 
test_key3);
                                ret = false;
                        }
                }
@@ -2996,12 +3028,12 @@ static bool test_key_base_sd(struct torture_context 
*tctx,
        }
 
        if (created4 && !test_DeleteKey(b, tctx, handle, test_key4)) {
-               torture_comment(tctx, "DeleteKey failed\n");
+               torture_comment(tctx, "DeleteKey(%s) failed\n", test_key4);
                ret = false;
        }
 
        if (created2 && !test_DeleteKey(b, tctx, handle, test_key4)) {
-               torture_comment(tctx, "DeleteKey failed\n");
+               torture_comment(tctx, "DeleteKey(%s) failed\n", test_key4);
                ret = false;
        }
 


-- 
Samba Shared Repository

Reply via email to