MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / from_bytes

Method from_bytes

pager_lib/smb/security_descriptors.py:343–367  ·  view source on GitHub ↗
(cls, data)

Source from the content-addressed store, hash-verified

341
342 @classmethod
343 def from_bytes(cls, data):
344 owner = None
345 group = None
346 dacl = None
347 sacl = None
348
349 header = data[:struct.calcsize(cls.HEADER_FORMAT)]
350 (revision, sbz1, flags, owner_offset, group_offset, sacl_offset,
351 dacl_offset) = struct.unpack(cls.HEADER_FORMAT, header)
352
353 assert revision == 1
354 assert flags & SECURITY_DESCRIPTOR_SELF_RELATIVE
355 for offset in (owner_offset, group_offset, sacl_offset, dacl_offset):
356 assert 0 <= offset < len(data)
357
358 if owner_offset:
359 owner = SID.from_bytes(data[owner_offset:])
360 if group_offset:
361 group = SID.from_bytes(data[group_offset:])
362 if dacl_offset:
363 dacl = ACL.from_bytes(data[dacl_offset:])
364 if sacl_offset:
365 sacl = ACL.from_bytes(data[sacl_offset:])
366
367 return cls(flags, owner, group, dacl, sacl)

Callers

nothing calls this directly

Calls 1

from_bytesMethod · 0.45

Tested by

no test coverage detected