summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-04 06:29:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:36 -0500
commit94ae449f33e45aa6cfa4946fac7c8c5409590ad7 (patch)
tree8edf0d4583729ad4bdab532ec98e779ff9c13d23
parent85b78669b450df7cc755eae9f26c234a7d2b8a6e (diff)
downloadsamba-94ae449f33e45aa6cfa4946fac7c8c5409590ad7.tar.gz
samba-94ae449f33e45aa6cfa4946fac7c8c5409590ad7.tar.bz2
samba-94ae449f33e45aa6cfa4946fac7c8c5409590ad7.zip
r2817: Get winreg_GetKeySecurity() working but use data blob instead of
security descriptor. (This used to be commit bc5165e40a716fb7c612b32c0b6f03cb2d331d11)
-rw-r--r--source4/librpc/idl/winreg.idl21
-rwxr-xr-xsource4/scripting/swig/torture/winreg.py109
2 files changed, 91 insertions, 39 deletions
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl
index c06e94b34c..428345ff30 100644
--- a/source4/librpc/idl/winreg.idl
+++ b/source4/librpc/idl/winreg.idl
@@ -168,17 +168,24 @@
[in,ref] policy_handle *handle
);
+ typedef struct {
+ uint32 max_len;
+ uint32 offset;
+ uint32 len;
+ } KeySecuritySize;
+
+ typedef struct {
+ uint32 max_len;
+ DATA_BLOB data;
+ } KeySecurityData;
+
/******************/
/* Function: 0x0c */
WERROR winreg_GetKeySecurity(
[in,ref] policy_handle *handle,
- [in] uint32 sec_info,
- [in] uint32 *len1,
- [in] uint32 empty,
- [in] uint32 len2,
- [in] uint32 unknown1,
- [in] uint32 unknown2,
- [out] sec_desc_buf *data
+ [in] uint32 unknown,
+ [in,out] KeySecuritySize *size,
+ [in,out] KeySecurityData data
);
/******************/
diff --git a/source4/scripting/swig/torture/winreg.py b/source4/scripting/swig/torture/winreg.py
index b7a42042a8..eb60b9847e 100755
--- a/source4/scripting/swig/torture/winreg.py
+++ b/source4/scripting/swig/torture/winreg.py
@@ -30,7 +30,49 @@ def test_CloseKey(pipe, handle):
dcerpc.winreg_CloseKey(pipe, r)
-def test_Enum(pipe, handle, name, depth = 0):
+def test_FlushKey(pipe, handle):
+
+ r = {}
+ r['handle'] = handle
+
+ dcerpc.winreg_FlushKey(pipe, r)
+
+def test_GetVersion(pipe, handle):
+
+ r = {}
+ r['handle'] = handle
+
+ dcerpc.winreg_GetVersion(pipe, r)
+
+def test_GetKeySecurity(pipe, handle):
+
+ r = {}
+ r['handle'] = handle
+ r['unknown'] = 4
+ r['size'] = None
+ r['data'] = {}
+ r['data']['max_len'] = 0
+ r['data']['data'] = ''
+
+ result = dcerpc.winreg_GetKeySecurity(pipe, r)
+
+ print result
+
+ if result['result'] == dcerpc.WERR_INSUFFICIENT_BUFFER:
+ r['size'] = {}
+ r['size']['max_len'] = result['data']['max_len']
+ r['size']['offset'] = 0
+ r['size']['len'] = result['data']['max_len']
+
+ result = dcerpc.winreg_GetKeySecurity(pipe, r)
+
+ print result
+
+ sys.exit(1)
+
+def test_Key(pipe, handle, name, depth = 0):
+
+ # Don't descend too far. Registries can be very deep.
if depth > 2:
return
@@ -41,7 +83,38 @@ def test_Enum(pipe, handle, name, depth = 0):
if arg[0] == dcerpc.WERR_ACCESS_DENIED:
return
- # Enumerate keys
+ test_GetVersion(pipe, handle)
+
+ test_FlushKey(pipe, handle)
+
+ test_GetKeySecurity(pipe, handle)
+
+ # Enumerate values in this key
+
+ r = {}
+ r['handle'] = handle
+ r['name_in'] = {}
+ r['name_in']['len'] = 0
+ r['name_in']['max_len'] = (keyinfo['max_valnamelen'] + 1) * 2
+ r['name_in']['buffer'] = {}
+ r['name_in']['buffer']['max_len'] = keyinfo['max_valnamelen'] + 1
+ r['name_in']['buffer']['offset'] = 0
+ r['name_in']['buffer']['len'] = 0
+ r['type'] = 0
+ r['value_in'] = {}
+ r['value_in']['max_len'] = keyinfo['max_valbufsize']
+ r['value_in']['offset'] = 0
+ r['value_in']['len'] = 0
+ r['value_len1'] = keyinfo['max_valbufsize']
+ r['value_len2'] = 0
+
+ for i in range(0, keyinfo['num_values']):
+
+ r['enum_index'] = i
+
+ dcerpc.winreg_EnumValue(pipe, r)
+
+ # Recursively test subkeys of this key
r = {}
r['handle'] = handle
@@ -72,41 +145,13 @@ def test_Enum(pipe, handle, name, depth = 0):
result = dcerpc.winreg_OpenKey(pipe, s)
- test_Enum(pipe, result['handle'], name + '/' + s['keyname']['name'],
- depth + 1)
+ test_Key(pipe, result['handle'], name + '/' + s['keyname']['name'],
+ depth + 1)
test_CloseKey(pipe, result['handle'])
# Enumerate values
- r = {}
- r['handle'] = handle
-
- r['name_in'] = {}
- r['name_in']['len'] = 0
- r['name_in']['max_len'] = (keyinfo['max_valnamelen'] + 1) * 2
- r['name_in']['buffer'] = {}
- r['name_in']['buffer']['max_len'] = keyinfo['max_valnamelen'] + 1
- r['name_in']['buffer']['offset'] = 0
- r['name_in']['buffer']['len'] = 0
- r['type'] = 0
- r['value_in'] = {}
- r['value_in']['max_len'] = keyinfo['max_valbufsize']
- r['value_in']['offset'] = 0
- r['value_in']['len'] = 0
- r['value_len1'] = keyinfo['max_valbufsize']
- r['value_len2'] = 0
-
- for i in range(0, keyinfo['num_values']):
-
- r['enum_index'] = i
-
- dcerpc.winreg_EnumValue(pipe, r)
-
-def test_Key(pipe, handle, name):
-
- test_Enum(pipe, handle, name)
-
def runtests(binding, domain, username, password):
print 'Testing WINREG pipe'