The branch, master has been updated
       via  7c6be16... s4-smbtorture: use push_reg_sz/push_reg_multi_sz in 
spoolss tests.
       via  393e149... s4-smbtorture: pass down hkey to main keytest in 
RPC-WINREG.
       via  ff3d2be... s4-smbtorture: print local_machine name in 
RemoteFindFirstPrinterChangeNotifyEx test.
       via  7370d03... s4-smbtorture: use push_reg_sz()/push_reg_multi_sz() in 
RPC-WINREG.
      from  29f549e... s3-waf: ndr string functions moved to top level

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


- Log -----------------------------------------------------------------
commit 7c6be166d0ef799a1897c29d5c1c1cd9998ff5d3
Author: Günther Deschner <[email protected]>
Date:   Thu May 20 22:13:48 2010 +0200

    s4-smbtorture: use push_reg_sz/push_reg_multi_sz in spoolss tests.
    
    Guenther

commit 393e1495af642af4525c7f66d869b0685731b3aa
Author: Günther Deschner <[email protected]>
Date:   Thu May 20 20:50:31 2010 +0200

    s4-smbtorture: pass down hkey to main keytest in RPC-WINREG.
    
    Guenther

commit ff3d2bef113783a561bdba1eace41d9bd5fce337
Author: Günther Deschner <[email protected]>
Date:   Thu May 20 21:57:53 2010 +0200

    s4-smbtorture: print local_machine name in 
RemoteFindFirstPrinterChangeNotifyEx test.
    
    Guenther

commit 7370d036278d2cd0cb14267b5c2b0baa6e1788eb
Author: Günther Deschner <[email protected]>
Date:   Thu May 20 20:49:44 2010 +0200

    s4-smbtorture: use push_reg_sz()/push_reg_multi_sz() in RPC-WINREG.
    
    Guenther

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

Summary of changes:
 source4/torture/rpc/spoolss.c        |   26 +++++++--------
 source4/torture/rpc/spoolss_notify.c |    5 ++-
 source4/torture/rpc/winreg.c         |   61 ++++++++++++++++++---------------
 3 files changed, 48 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index efe975c..d5b0f0e 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3697,9 +3697,8 @@ static bool test_EnumPrinterData_consistency(struct 
torture_context *tctx,
 
        torture_comment(tctx, "Testing EnumPrinterData vs EnumPrinterDataEx 
consistency\n");
 
-       torture_assert(tctx,
-               reg_string_to_val(tctx, 
-                                 "REG_SZ", "torture_data1", &type, &blob), "");
+       torture_assert(tctx, push_reg_sz(tctx, &blob, "torture_data1"), "");
+       type = REG_SZ;
 
        torture_assert(tctx,
                test_SetPrinterData(tctx, b, handle, "torture_value1", type, 
blob.data, blob.length),
@@ -4590,9 +4589,8 @@ static bool test_SetPrinterData_matrix(struct 
torture_context *tctx,
                uint8_t *data;
                uint32_t needed;
 
-               torture_assert(tctx,
-                       reg_string_to_val(tctx, 
-                                         "REG_SZ", "dog", &type, &blob), "");
+               torture_assert(tctx, push_reg_sz(tctx, &blob, "dog"), "");
+               type = REG_SZ;
 
                torture_assert(tctx,
                        test_SetPrinterData(tctx, b, handle, values[i], REG_SZ, 
blob.data, blob.length),
@@ -4717,6 +4715,7 @@ static bool test_SetPrinterDataEx_matrix(struct 
torture_context *tctx,
                const char *key;
                enum winreg_Type type;
                const char *string = talloc_strndup(tctx, str, s);
+               const char *array[2];
                DATA_BLOB blob = data_blob_string_const(string);
                const char **subkeys;
                DATA_BLOB data;
@@ -4725,6 +4724,9 @@ static bool test_SetPrinterDataEx_matrix(struct 
torture_context *tctx,
                uint32_t ecount;
                struct spoolss_PrinterEnumValues *einfo;
 
+               array[0] = talloc_strdup(tctx, string);
+               array[1] = NULL;
+
                if (types[t] == REG_DWORD) {
                        s = 0xffff;
                }
@@ -4747,18 +4749,14 @@ static bool test_SetPrinterDataEx_matrix(struct 
torture_context *tctx,
                        offered = 4;
                        break;
                case REG_SZ:
-                       torture_assert(tctx,
-                               reg_string_to_val(tctx, 
-                                                 "REG_SZ", string, &type, 
&data), "");
+                       torture_assert(tctx, push_reg_sz(tctx, &data, string), 
"");
+                       type = REG_SZ;
                        offered = data.length;
                        /*strlen_m_term(data.string)*2;*/
                        break;
                case REG_MULTI_SZ:
-                       torture_assert(tctx,
-                               reg_string_to_val(tctx, 
-                                                 "REG_SZ", string, &type, 
&data), "");
-                       torture_assert(tctx, data_blob_realloc(tctx, &data, 
data.length + 2), "");
-                       memset(&data.data[data.length - 2], '\0', 2);
+                       torture_assert(tctx, push_reg_multi_sz(tctx, &data, 
array), "");
+                       type = REG_MULTI_SZ;
                        offered = data.length;
                        break;
                default:
diff --git a/source4/torture/rpc/spoolss_notify.c 
b/source4/torture/rpc/spoolss_notify.c
index 2dffa85..9fa6b63 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -330,11 +330,12 @@ static bool 
test_RemoteFindFirstPrinterChangeNotifyEx(struct torture_context *tc
                                                      struct 
spoolss_NotifyOption *option)
 {
        struct spoolss_RemoteFindFirstPrinterChangeNotifyEx r;
+       const char *local_machine = talloc_asprintf(tctx, "\\\\%s", address);
 
-       torture_comment(tctx, "Testing RemoteFindFirstPrinterChangeNotifyEx\n");
+       torture_comment(tctx, "Testing 
RemoteFindFirstPrinterChangeNotifyEx(%s)\n", local_machine);
 
        r.in.flags = 0;
-       r.in.local_machine = talloc_asprintf(tctx, "\\\\%s", address);
+       r.in.local_machine = local_machine;
        r.in.options = 0;
        r.in.printer_local = 0;
        r.in.notify_options = option;
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 216a30c..95576e5 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -4,7 +4,7 @@
 
    Copyright (C) Tim Potter 2003
    Copyright (C) Jelmer Vernooij 2004-2007
-   Copyright (C) Günther Deschner 2007
+   Copyright (C) Günther Deschner 2007,2010
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1919,6 +1919,7 @@ static bool test_SetValue_simple(struct 
dcerpc_binding_handle *b,
        uint32_t value = 0x12345678;
        uint64_t value2 = 0x12345678;
        const char *string = "torture";
+       const char *array[2];
        DATA_BLOB blob;
        enum winreg_Type types[] = {
                REG_DWORD,
@@ -1930,6 +1931,9 @@ static bool test_SetValue_simple(struct 
dcerpc_binding_handle *b,
        };
        int t;
 
+       array[0] = "array0";
+       array[1] = NULL;
+
        torture_comment(tctx, "Testing SetValue (standard formats)\n");
 
        for (t=0; t < ARRAY_SIZE(types); t++) {
@@ -1952,26 +1956,10 @@ static bool test_SetValue_simple(struct 
dcerpc_binding_handle *b,
                        blob = data_blob_string_const("binary_blob");
                        break;
                case REG_SZ:
-                       torture_assert(tctx,
-                               convert_string_talloc_convenience(tctx, 
lp_iconv_convenience(tctx->lp_ctx),
-                                                                 CH_UNIX, 
CH_UTF16,
-                                                                 string,
-                                                                 
strlen(string)+1,
-                                                                 (void 
**)&blob.data,
-                                                                 &blob.length,
-                                                                 false), "");
+                       torture_assert(tctx, push_reg_sz(tctx, &blob, string), 
"failed to push REG_SZ");
                        break;
                case REG_MULTI_SZ:
-                       torture_assert(tctx,
-                               convert_string_talloc_convenience(tctx, 
lp_iconv_convenience(tctx->lp_ctx),
-                                                                 CH_UNIX, 
CH_UTF16,
-                                                                 string,
-                                                                 
strlen(string)+1,
-                                                                 (void 
**)&blob.data,
-                                                                 &blob.length,
-                                                                 false), "");
-                       torture_assert(tctx, data_blob_realloc(tctx, &blob, 
blob.length + 2), "");
-                       memset(&blob.data[blob.length - 2], '\0', 2);
+                       torture_assert(tctx, push_reg_multi_sz(tctx, &blob, 
array), "failed to push REG_MULTI_SZ");
                        break;
                default:
                        break;
@@ -2117,7 +2105,8 @@ static bool test_HKLM_wellknown(struct torture_context 
*tctx,
 
 static bool test_volatile_keys(struct torture_context *tctx,
                               struct dcerpc_binding_handle *b,
-                              struct policy_handle *handle)
+                              struct policy_handle *handle,
+                              int hkey)
 {
        struct policy_handle new_handle;
        enum winreg_CreateAction action_taken;
@@ -2199,7 +2188,8 @@ static bool test_volatile_keys(struct torture_context 
*tctx,
 
 static bool test_symlink_keys(struct torture_context *tctx,
                              struct dcerpc_binding_handle *b,
-                             struct policy_handle *handle)
+                             struct policy_handle *handle,
+                             int hkey)
 {
        struct policy_handle new_handle;
        enum winreg_CreateAction action_taken;
@@ -2258,7 +2248,8 @@ static bool test_symlink_keys(struct torture_context 
*tctx,
 
 static bool test_CreateKey_keytypes(struct torture_context *tctx,
                                    struct dcerpc_binding_handle *b,
-                                   struct policy_handle *handle)
+                                   struct policy_handle *handle,
+                                   int hkey)
 {
 
        if (torture_setting_bool(tctx, "samba3", false) ||
@@ -2267,11 +2258,11 @@ static bool test_CreateKey_keytypes(struct 
torture_context *tctx,
        }
 
        torture_assert(tctx,
-               test_volatile_keys(tctx, b, handle),
+               test_volatile_keys(tctx, b, handle, hkey),
                "failed to test volatile keys");
 
        torture_assert(tctx,
-               test_symlink_keys(tctx, b, handle),
+               test_symlink_keys(tctx, b, handle, hkey),
                "failed to test symlink keys");
 
        return true;
@@ -2279,7 +2270,8 @@ static bool test_CreateKey_keytypes(struct 
torture_context *tctx,
 
 static bool test_key_base(struct torture_context *tctx,
                          struct dcerpc_binding_handle *b,
-                         struct policy_handle *handle)
+                         struct policy_handle *handle,
+                         int hkey)
 {
        struct policy_handle newhandle;
        bool ret = true, created = false, deleted = false;
@@ -2314,7 +2306,7 @@ static bool test_key_base(struct torture_context *tctx,
                        "simple SetValue test failed");
                torture_assert(tctx, test_SetValue_extended(b, tctx, 
&newhandle),
                        "extended SetValue test failed");
-               torture_assert(tctx, test_CreateKey_keytypes(tctx, b, 
&newhandle),
+               torture_assert(tctx, test_CreateKey_keytypes(tctx, b, 
&newhandle, hkey),
                        "keytype test failed");
 
                if (!test_CloseKey(b, tctx, &newhandle)) {
@@ -2436,6 +2428,7 @@ static bool test_Open(struct torture_context *tctx, 
struct dcerpc_pipe *p,
        bool ret = true;
        struct winreg_OpenHKLM r;
        struct dcerpc_binding_handle *b = p->binding_handle;
+       int hkey = 0;
 
        winreg_open_fn open_fn = (winreg_open_fn)userdata;
 
@@ -2452,12 +2445,24 @@ static bool test_Open(struct torture_context *tctx, 
struct dcerpc_pipe *p,
        }
 
        if (open_fn == (winreg_open_fn)dcerpc_winreg_OpenHKLM_r) {
+               hkey = HKEY_LOCAL_MACHINE;
+       } else if (open_fn == (winreg_open_fn)dcerpc_winreg_OpenHKU_r) {
+               hkey = HKEY_USERS;
+       } else if (open_fn == (winreg_open_fn)dcerpc_winreg_OpenHKCR_r) {
+               hkey = HKEY_CLASSES_ROOT;
+       } else if (open_fn == (winreg_open_fn)dcerpc_winreg_OpenHKCU_r) {
+               hkey = HKEY_CURRENT_USER;
+       } else {
+               torture_fail(tctx, "unsupported hkey");
+       }
+
+       if (hkey == HKEY_LOCAL_MACHINE) {
                torture_assert(tctx,
                        test_HKLM_wellknown(tctx, b, &handle),
                        "failed to test HKLM wellknown keys");
        }
 
-       if (!test_key_base(tctx, b, &handle)) {
+       if (!test_key_base(tctx, b, &handle, hkey)) {
                torture_warning(tctx, "failed to test TEST_KEY_BASE");
                ret = false;
        }
@@ -2468,7 +2473,7 @@ static bool test_Open(struct torture_context *tctx, 
struct dcerpc_pipe *p,
        }
 
        /* The HKCR hive has a very large fanout */
-       if (open_fn == (winreg_open_fn)dcerpc_winreg_OpenHKCR_r) {
+       if (hkey == HKEY_CLASSES_ROOT) {
                if(!test_key(p, tctx, &handle, MAX_DEPTH - 1, false)) {
                        ret = false;
                }


-- 
Samba Shared Repository

Reply via email to