summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2008-09-15 21:09:32 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-21 23:18:00 +0200
commit9038f2a0fd87075cf2125b1444e2669125bc72ea (patch)
tree546c615bba4663009226bb8cb0fd5f9fd686d748
parent03e582cc866a957af792a7c128716622f1a1dc83 (diff)
downloadsamba-9038f2a0fd87075cf2125b1444e2669125bc72ea.tar.gz
samba-9038f2a0fd87075cf2125b1444e2669125bc72ea.tar.bz2
samba-9038f2a0fd87075cf2125b1444e2669125bc72ea.zip
Torture suite: Fixes the tests to not segfault again SAMBA 4 registry server
-rw-r--r--source4/torture/rpc/samba3rpc.c13
-rw-r--r--source4/torture/rpc/winreg.c19
2 files changed, 32 insertions, 0 deletions
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 17342f9b86..7017233cab 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -2897,6 +2897,7 @@ static NTSTATUS enumvalues(struct dcerpc_pipe *p, struct policy_handle *handle,
r.in.handle = handle;
r.in.enum_index = enum_index;
name.name = "";
+ name.length = 0;
name.size = 1024;
r.in.name = r.out.name = &name;
size = 1024;
@@ -2927,6 +2928,7 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle,
}
class.name = "";
+ class.length = 0;
class.size = 1024;
r.in.handle = handle;
@@ -2947,6 +2949,7 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle,
}
name.name = NULL;
+ name.length = 0;
name.size = 1024;
status = dcerpc_winreg_EnumKey(p, tmp_ctx, &r);
@@ -2963,6 +2966,8 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle,
o.in.parent_handle = handle;
o.in.keyname.name = r.out.name->name;
+ o.in.keyname.name_len = strlen(o.in.keyname.name);
+ o.in.keyname.name_size = 1024;
o.in.unknown = 0;
o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
o.out.handle = &key_handle;
@@ -3215,6 +3220,8 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
goto fail;
}
c.in.keyclass.name = "";
+ c.in.keyclass.name_len = 0;
+ c.in.keyclass.name_size = 1024;
c.in.options = 0;
c.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
c.in.secdesc = NULL;
@@ -3272,6 +3279,8 @@ static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture,
status = NT_STATUS_NO_MEMORY;
goto fail;
}
+ d.in.key.name_len = strlen(d.in.key.name);
+ d.in.key.name_size = 1024;
status = dcerpc_winreg_DeleteKey(p, p, &d);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(d.out.result)) {
d_printf("(%s) OpenKey failed: %s, %s\n", __location__,
@@ -3312,6 +3321,8 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
status = NT_STATUS_NO_MEMORY;
goto done;
}
+ o.in.keyname.name_len = strlen(o.in.keyname.name);
+ o.in.keyname.name_size = 1024;
o.in.unknown = 0;
o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
o.out.handle = &key_handle;
@@ -3331,6 +3342,8 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
s.in.handle = &key_handle;
s.in.name.name = parameter;
+ s.in.name.name_len = strlen(s.in.name.name);
+ s.in.name.name_size = 1024;
s.in.type = type;
s.in.data = val.data;
s.in.size = val.length;
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 8b602ef652..eb439bd5f6 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -80,6 +80,7 @@ static bool test_NotifyChangeKeyValue(struct dcerpc_pipe *p,
{
struct winreg_NotifyChangeKeyValue r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.watch_subtree = true;
r.in.notify_filter = 0;
@@ -109,6 +110,7 @@ static bool test_CreateKey(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle newhandle;
enum winreg_CreateAction action_taken = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.out.new_handle = &newhandle;
init_winreg_String(&r.in.name, name);
@@ -163,6 +165,7 @@ static bool test_CreateKey_sd(struct dcerpc_pipe *p,
secbuf.length = sdblob.length-10;
secbuf.inherit = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.out.new_handle = newhandle;
init_winreg_String(&r.in.name, name);
@@ -317,6 +320,7 @@ static bool test_CloseKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_CloseKey r;
+ ZERO_STRUCT(r);
r.in.handle = r.out.handle = handle;
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_CloseKey(p, tctx, &r),
@@ -332,6 +336,7 @@ static bool test_FlushKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_FlushKey r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_FlushKey(p, tctx, &r),
@@ -351,6 +356,7 @@ static bool _test_OpenKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_OpenKey r;
+ ZERO_STRUCT(r);
r.in.parent_handle = hive_handle;
init_winreg_String(&r.in.keyname, keyname);
r.in.unknown = 0x00000000;
@@ -384,6 +390,7 @@ static bool test_Cleanup(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_DeleteKey r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
init_winreg_String(&r.in.key, key);
@@ -1433,8 +1440,10 @@ static bool test_EnumKey(struct dcerpc_pipe *p, struct torture_context *tctx,
NTTIME t = 0;
class.name = "";
+ class.length = 0;
class.size = 1024;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
@@ -1444,6 +1453,7 @@ static bool test_EnumKey(struct dcerpc_pipe *p, struct torture_context *tctx,
do {
name.name = NULL;
+ name.length = 0;
name.size = 1024;
status = dcerpc_winreg_EnumKey(p, tctx, &r);
@@ -1486,6 +1496,7 @@ static bool test_QueryMultipleValues(struct dcerpc_pipe *p,
NTSTATUS status;
uint32_t bufsize=0;
+ ZERO_STRUCT(r);
r.in.key_handle = handle;
r.in.values = r.out.values = talloc_array(tctx, struct QueryMultipleValue, 1);
r.in.values[0].name = talloc(tctx, struct winreg_String);
@@ -1527,6 +1538,7 @@ static bool test_QueryValue(struct dcerpc_pipe *p,
uint32_t offered = 0xfff;
uint32_t zero = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.data = NULL;
r.in.value_name.name = valuename;
@@ -1556,8 +1568,10 @@ static bool test_EnumValue(struct dcerpc_pipe *p, struct torture_context *tctx,
struct winreg_StringBuf name;
name.name = "";
+ name.length = 0;
name.size = 1024;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
@@ -1594,6 +1608,7 @@ static bool test_AbortSystemShutdown(struct dcerpc_pipe *p,
struct winreg_AbortSystemShutdown r;
uint16_t server = 0x0;
+ ZERO_STRUCT(r);
r.in.server = &server;
torture_assert_ntstatus_ok(tctx,
@@ -1612,6 +1627,7 @@ static bool test_InitiateSystemShutdown(struct torture_context *tctx,
struct winreg_InitiateSystemShutdown r;
uint16_t hostname = 0x0;
+ ZERO_STRUCT(r);
r.in.hostname = &hostname;
r.in.message = talloc(tctx, struct lsa_StringLarge);
init_lsa_StringLarge(r.in.message, "spottyfood");
@@ -1636,6 +1652,7 @@ static bool test_InitiateSystemShutdownEx(struct torture_context *tctx,
struct winreg_InitiateSystemShutdownEx r;
uint16_t hostname = 0x0;
+ ZERO_STRUCT(r);
r.in.hostname = &hostname;
r.in.message = talloc(tctx, struct lsa_StringLarge);
init_lsa_StringLarge(r.in.message, "spottyfood");
@@ -1694,6 +1711,7 @@ static bool test_Open_Security(struct torture_context *tctx,
winreg_open_fn open_fn = userdata;
+ ZERO_STRUCT(r);
r.in.system_name = 0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = &handle;
@@ -1767,6 +1785,7 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p,
winreg_open_fn open_fn = userdata;
+ ZERO_STRUCT(r);
r.in.system_name = 0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = &handle;