svn commit: samba r2807 - in branches/SAMBA_4_0/source: librpc/idl scripting/swig/torture

tpot at samba.org tpot at samba.org
Sun Oct 3 11:07:04 GMT 2004


Author: tpot
Date: 2004-10-03 11:07:04 +0000 (Sun, 03 Oct 2004)
New Revision: 2807

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2807&nolog=1

Log:
OK I think winreg_EnumValue() finally works.  The previous version
didn't work with non-NULL registry value names.

Update testsuite to enumerate all keys and values two levels deep.

Modified:
   branches/SAMBA_4_0/source/librpc/idl/winreg.idl
   branches/SAMBA_4_0/source/scripting/swig/torture/winreg.py


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/winreg.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-10-03 11:05:13 UTC (rev 2806)
+++ branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-10-03 11:07:04 UTC (rev 2807)
@@ -127,23 +127,37 @@
         typedef struct {
 	        uint32 max_len;
 	        uint32 offset;
+ 	        uint32 len;
+        } EnumValueIn;
+
+        typedef struct {
+                uint16 len;
+                uint16 max_len;
+                EnumValueIn *buffer;
+        } EnumValueNameIn;
+
+        typedef struct {
+	        uint32 max_len;
+	        uint32 offset;
 	        DATA_BLOB buffer;
-        } EnumValue;
+        } EnumValueOut;
 
         typedef struct {
                 uint16 len;
                 uint16 max_len;
-                EnumValue *buffer;
-        } EnumValueName;
+                unistr *name;
+        } EnumValueNameOut;
 
 	/******************/
 	/* Function: 0x0a */
 	WERROR winreg_EnumValue(
 		[in,ref] policy_handle *handle,
 		[in] uint32 enum_index,
-		[in,out] EnumValueName name,
+		[in] EnumValueNameIn name_in,
+		[out] EnumValueNameOut name_out,
 		[in,out] uint32 *type,
-		[in,out] EnumValue *value,
+		[in] EnumValueIn *value_in,
+		[out] EnumValueOut *value_out,
 		[in,out] uint32 *value_len1,
 		[in,out] uint32 *value_len2
 	);

Modified: branches/SAMBA_4_0/source/scripting/swig/torture/winreg.py
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/torture/winreg.py	2004-10-03 11:05:13 UTC (rev 2806)
+++ branches/SAMBA_4_0/source/scripting/swig/torture/winreg.py	2004-10-03 11:07:04 UTC (rev 2807)
@@ -30,12 +30,16 @@
 
     dcerpc.winreg_CloseKey(pipe, r)
 
-def test_Enum(pipe, handle, depth = 0):
+def test_Enum(pipe, handle, name, depth = 0):
 
     if depth > 2:
         return
 
-    keyinfo = test_QueryInfoKey(pipe, handle)
+    try:
+        keyinfo = test_QueryInfoKey(pipe, handle)
+    except dcerpc.WERROR, arg:
+        if arg[0] == dcerpc.WERR_ACCESS_DENIED:
+            return
 
     # Enumerate keys
 
@@ -68,7 +72,8 @@
 
         result = dcerpc.winreg_OpenKey(pipe, s)
 
-        test_Enum(pipe, result['handle'], depth + 1)
+        test_Enum(pipe, result['handle'], name + '/' + s['keyname']['name'],
+                  depth + 1)
 
         test_CloseKey(pipe, result['handle'])
 
@@ -77,45 +82,31 @@
     r = {}
     r['handle'] = handle
 
-    keyinfo['max_valnamelen'] = 18
-    keyinfo['max_valbufsize'] = 0x31f5
-
-    r['foo'] = {}
-    r['foo']['len'] = 0
-    r['foo']['max_len'] = keyinfo['max_valnamelen'] * 2
-    r['foo']['buffer'] = {}
-    r['foo']['buffer']['max_len'] = keyinfo['max_valnamelen']
-    r['foo']['buffer']['offset'] = 0
-    r['foo']['buffer']['len'] = 0
-    r['foo']['buffer']['buffer'] = ''
+    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'] = {}
-    r['value']['max_len'] = keyinfo['max_valbufsize']
-    r['value']['offset'] = 0
-    r['value']['len'] = 0
-    r['value']['buffer'] = []
-    r['returned_len'] = 0
-    r['foo2'] = {}
-    r['foo2']['max_len'] = keyinfo['max_valbufsize']
-    r['foo2']['offset'] = 0
-    r['foo2']['len'] = 0
-    r['foo2']['buffer'] = ''
-    r['value1'] = keyinfo['max_valbufsize']
-    r['value2'] = 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
 
-        print keyinfo
-        print dcerpc.winreg_EnumValue(pipe, r)
+        dcerpc.winreg_EnumValue(pipe, r)
 
-        sys.exit(1)        
+def test_Key(pipe, handle, name):
 
-def test_Key(pipe, handle):
+    test_Enum(pipe, handle, name)
 
-    test_Enum(pipe, handle)        
-
 def runtests(binding, domain, username, password):
     
     print 'Testing WINREG pipe'
@@ -126,5 +117,4 @@
 
     handle = test_OpenHKLM(pipe)
 
-    test_Key(pipe, handle)
-    
+    test_Key(pipe, handle, 'HKLM')



More information about the samba-cvs mailing list