summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-12-08 22:02:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:27 -0500
commit2c93ec0ff04165b6ed5898f1dc3e9413cbe6bc81 (patch)
treea8ff7891ffc5bd48ad16f6701bea3d846636db10 /source4
parent87d5e061e0ddd41e21a60b8934db339e5ef5f306 (diff)
downloadsamba-2c93ec0ff04165b6ed5898f1dc3e9413cbe6bc81.tar.gz
samba-2c93ec0ff04165b6ed5898f1dc3e9413cbe6bc81.tar.bz2
samba-2c93ec0ff04165b6ed5898f1dc3e9413cbe6bc81.zip
r4105: Fix IDL for QueryValue() and add a torture test for it.
Thanks to Michael Allen for some hints on what was wrong with the previous IDL. (This used to be commit 0fa6d847433eb281eaff15b8be4a26f898689f0a)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/winreg.idl15
-rw-r--r--source4/torture/rpc/winreg.c47
2 files changed, 50 insertions, 12 deletions
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl
index 03b48be02a..a3e81f3a94 100644
--- a/source4/librpc/idl/winreg.idl
+++ b/source4/librpc/idl/winreg.idl
@@ -229,15 +229,14 @@
/* Function: 0x11 */
WERROR winreg_QueryValue(
[in,ref] policy_handle *handle,
- [in] winreg_String valuename,
- [in] uint32 *reserved,
+ [in] winreg_String value_name,
+ [in,out] uint32 *type,
[in] uint32 *offered,
- [in] uint32 *unknown1,
- [in] uint32 *unknown2,
- [out] uint32 *type,
- [out] uint8 *data,
- [in,out] uint32 *offered2,
- [in,out] uint32 *val_length
+ [in] uint32 unknown1,
+ [in] uint32 unknown2,
+ [out] EnumValueOut *value_out,
+ [in,out] uint32 *value_len1,
+ [in,out] uint32 *value_len2
);
/******************/
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 9cb41c032b..ebadbc87e2 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -168,6 +168,8 @@ static BOOL test_OpenKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("OpenKey failed - %s\n", win_errstr(r.out.result));
+
return False;
}
@@ -263,9 +265,6 @@ static BOOL test_EnumKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
if (!test_OpenKey(
p, mem_ctx, handle, r.out.out_name->name,
&key_handle)) {
- printf("OpenKey(%s) failed - %s\n",
- r.out.out_name->name,
- win_errstr(r.out.result));
} else {
test_key(p, mem_ctx, &key_handle, depth + 1);
}
@@ -290,6 +289,41 @@ static BOOL test_EnumKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+static BOOL test_QueryValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *valuename)
+{
+ struct winreg_QueryValue r;
+ NTSTATUS status;
+ struct EnumValueNameOut valname;
+ uint32 zero = 0;
+ uint32 offered = 0xfff;
+
+ valname.name = valuename;
+
+ printf("Testing QueryValue\n");
+
+ r.in.handle = handle;
+ r.in.value_name.name = valuename;
+ r.in.type = &zero;
+ r.in.unknown1 = 0;
+ r.in.unknown2 = 0;
+ r.in.offered = &offered;
+ r.in.value_len1 = &offered;
+ r.in.value_len2 = &zero;
+
+ status = dcerpc_winreg_QueryValue(p, mem_ctx, &r);
+ if(NT_STATUS_IS_ERR(status)) {
+ printf("QueryValue failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("QueryValue failed - %s\n", win_errstr(r.out.result));
+ return False;
+ }
+
+ return True;
+}
+
static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, int max_valnamelen, int max_valbufsize)
{
@@ -298,6 +332,7 @@ static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct EnumValueIn buf_val;
uint32 type;
uint32 len1 = max_valbufsize, len2 = 0;
+ BOOL ret = True;
printf("testing EnumValue\n");
@@ -324,6 +359,10 @@ static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
+ if (W_ERROR_IS_OK(r.out.result)) {
+ ret &= test_QueryValue(p, mem_ctx, handle, r.out.name_out.name);
+ }
+
r.in.enum_index++;
} while (W_ERROR_IS_OK(r.out.result));
@@ -332,7 +371,7 @@ static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
- return True;
+ return ret;
}
static BOOL test_OpenHKLM(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,