1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-09 20:59:11 +03:00

r26607: Fix reading of values and subkeys in Samba 3 registry files.

(This used to be commit e3d7454ef7)
This commit is contained in:
Jelmer Vernooij
2007-12-26 20:55:05 -06:00
committed by Stefan Metzmacher
parent e0132b5602
commit c4d3666ac2
4 changed files with 105 additions and 124 deletions

View File

@ -45,16 +45,36 @@ class Registry:
data = self.tdb.get("%s\x00" % key)
if data is None:
return []
# FIXME: Parse data
return []
import struct
(num, ) = struct.unpack("<L", data[0:4])
keys = data[4:].split("\0")
assert keys[-1] == ""
keys.pop()
assert len(keys) == num
return keys
def values(self, key):
"""Return a dictionary with the values set for a specific key."""
data = self.tdb.get("%s/%s\x00" % (REGISTRY_VALUE_PREFIX, key))
if data is None:
return {}
# FIXME: Parse data
return {}
ret = {}
import struct
(num, ) = struct.unpack("<L", data[0:4])
data = data[4:]
for i in range(num):
# Value name
(name, data) = data.split("\0", 1)
(type, ) = struct.unpack("<L", data[0:4])
data = data[4:]
(value_len, ) = struct.unpack("<L", data[0:4])
data = data[4:]
ret[name] = (type, data[:value_len])
data = data[value_len:]
return ret
class PolicyDatabase: