Skip to content

SecDesc

Windows security descriptor.

A descriptor can also be written as a SecDescSpec wherever one is accepted.

ACL-related fields raise FieldError when the corresponding ACL was not loaded.

Constructor

SecDesc packet

Parses a self-relative security descriptor packet.

Parameters

NameTypeDescription
packet Bin Native self-relative packet.

Errors

ValueError if the packet is malformed or not self-relative.

SecDesc …

Constructs a security descriptor from built components and control flags.

A control flag given as true requires its component to be present or given.

Parameters

NameTypeDescription
:owner? (Sid | nil) Owner, or nil for an absent owner.
:group? (Sid | nil) Primary group, or nil for an absent group.
:dacl? (Acl | nil) Discretionary ACL, or nil for a present null ACL.
:sacl? (Acl | nil) System ACL, or nil for a present null ACL.
:owner_defaulted? Bool Owner defaulted flag.
:group_defaulted? Bool Group defaulted flag.
:dacl_present? Bool DACL presence.
:dacl_defaulted? Bool DACL defaulted flag.
:dacl_auto_inherit_required? Bool DACL inheritance request.
:dacl_auto_inherited? Bool DACL inherited flag.
:dacl_protected? Bool DACL protection.
:sacl_present? Bool SACL presence.
:sacl_defaulted? Bool SACL defaulted flag.
:sacl_auto_inherit_required? Bool SACL inheritance request.
:sacl_auto_inherited? Bool SACL inherited flag.
:sacl_protected? Bool SACL protection.
:rm_control? Int Resource-manager control byte.

Fields

control @ SecDescControl

The control flags, excluding the self-relative storage flag.

dacl @ (Acl | nil)

The discretionary ACL, or nil for a present null ACL.

Raises FieldError when the DACL was not loaded or is not present.

dacl_auto_inherit_required @ Bool

Whether DACL inheritance computation was requested.

dacl_auto_inherited @ Bool

Whether the DACL was produced through inheritance.

dacl_defaulted @ Bool

Whether the DACL was supplied by a default mechanism.

dacl_present @ Bool

Whether the DACL is present. A present ACL can be null.

dacl_protected @ Bool

Whether the DACL is protected from inheritance.

group @ Sid

The primary group.

Raises FieldError when the group was not loaded or is absent.

group_defaulted @ Bool

Whether the group was supplied by a default mechanism.

mask @ SecInfo

The components that are present.

A descriptor parsed from a self-relative packet has all four components marked, because the packet carries no separate mask. One read from an object may have fewer, depending on what was queried.

owner @ Sid

The owner.

Raises FieldError when the owner was not loaded or is absent.

owner_defaulted @ Bool

Whether the owner was supplied by a default mechanism.

revision @ Int

Security descriptor revision.

rm_control @ Int

Resource-manager-defined control byte.

Raises FieldError when rm_control_valid is false.

rm_control_valid @ Bool

Whether the resource-manager control byte is valid.

sacl @ (Acl | nil)

The system ACL, or nil for a present null ACL.

Raises FieldError when the SACL was not loaded or is not present.

sacl_auto_inherit_required @ Bool

Whether SACL inheritance computation was requested.

sacl_auto_inherited @ Bool

Whether the SACL was produced through inheritance.

sacl_defaulted @ Bool

Whether the SACL was supplied by a default mechanism.

sacl_present @ Bool

Whether the SACL is present. A present ACL can be null.

sacl_protected @ Bool

Whether the SACL is protected from inheritance.

Methods

to_bin() -> Bin

Returns a canonical self-relative security descriptor packet.

with … -> SecDesc

Returns a descriptor with the given components or control flags replaced.

Components are strict, as for the constructor. An ACL presence flag given as false clears that ACL.

Parameters

NameTypeDescription
:owner? (Sid | nil) Owner, or nil for an absent owner.
:group? (Sid | nil) Primary group, or nil for an absent group.
:dacl? (Acl | nil) Discretionary ACL, or nil for a present null ACL.
:sacl? (Acl | nil) System ACL, or nil for a present null ACL.
:owner_defaulted? Bool Owner defaulted flag.
:group_defaulted? Bool Group defaulted flag.
:dacl_present? Bool DACL presence.
:dacl_defaulted? Bool DACL defaulted flag.
:dacl_auto_inherit_required? Bool DACL inheritance request.
:dacl_auto_inherited? Bool DACL inherited flag.
:dacl_protected? Bool DACL protection.
:sacl_present? Bool SACL presence.
:sacl_defaulted? Bool SACL defaulted flag.
:sacl_auto_inherit_required? Bool SACL inheritance request.
:sacl_auto_inherited? Bool SACL inherited flag.
:sacl_protected? Bool SACL protection.
:rm_control? (Int | nil) Resource-manager control byte, or nil to clear it.