pub struct SecDesc { /* private fields */ }Expand description
A validated, portable representation of a self-relative Windows security descriptor.
A descriptor tracks which components were loaded through its
mask, so partial security queries can be carried without
pretending that omitted components were absent on the target. Use
SecDescUpdate with with to make a checked update.
Implementations§
Source§impl SecDesc
impl SecDesc
Sourcepub fn new(
mask: SecInfo,
rm_control: u8,
control: SecDescControl,
owner: Option<Sid>,
group: Option<Sid>,
dacl: Option<AclBuf>,
sacl: Option<AclBuf>,
) -> Result<Self, SecDescError>
pub fn new( mask: SecInfo, rm_control: u8, control: SecDescControl, owner: Option<Sid>, group: Option<Sid>, dacl: Option<AclBuf>, sacl: Option<AclBuf>, ) -> Result<Self, SecDescError>
Creates a security descriptor from its structural components.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, SecDescError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, SecDescError>
Parses a self-relative Windows security descriptor packet.
Sourcepub fn from_bytes_with_mask(
bytes: &[u8],
mask: SecInfo,
) -> Result<Self, SecDescError>
pub fn from_bytes_with_mask( bytes: &[u8], mask: SecInfo, ) -> Result<Self, SecDescError>
Parses the selected components of a self-relative Windows security descriptor packet.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Converts this descriptor to a canonical self-relative Windows packet.
Sourcepub const fn mask(&self) -> SecInfo
pub const fn mask(&self) -> SecInfo
Returns the native SECURITY_INFORMATION mask associated with the descriptor.
Sourcepub const fn revision(&self) -> SecDescRevision
pub const fn revision(&self) -> SecDescRevision
Returns the security descriptor revision.
Sourcepub const fn control(&self) -> SecDescControl
pub const fn control(&self) -> SecDescControl
Returns the security descriptor control mask.
Sourcepub const fn rm_control(&self) -> Option<u8>
pub const fn rm_control(&self) -> Option<u8>
Returns the resource-manager control byte when it is valid.
Sourcepub const fn rm_control_valid(&self) -> bool
pub const fn rm_control_valid(&self) -> bool
Returns whether the resource-manager control byte is valid.
Sourcepub const fn owner_loaded(&self) -> bool
pub const fn owner_loaded(&self) -> bool
Returns whether the owner component was loaded.
Sourcepub const fn owner_defaulted(&self) -> bool
pub const fn owner_defaulted(&self) -> bool
Returns whether the owner SID was supplied by a default mechanism.
Sourcepub const fn group_loaded(&self) -> bool
pub const fn group_loaded(&self) -> bool
Returns whether the group component was loaded.
Sourcepub const fn group_defaulted(&self) -> bool
pub const fn group_defaulted(&self) -> bool
Returns whether the group SID was supplied by a default mechanism.
Sourcepub const fn dacl_loaded(&self) -> bool
pub const fn dacl_loaded(&self) -> bool
Returns whether the DACL component was loaded.
Sourcepub const fn dacl_present(&self) -> bool
pub const fn dacl_present(&self) -> bool
Returns whether the descriptor marks the DACL as present.
Sourcepub const fn dacl_defaulted(&self) -> bool
pub const fn dacl_defaulted(&self) -> bool
Returns whether the DACL was supplied by a default mechanism.
Sourcepub const fn dacl_auto_inherit_required(&self) -> bool
pub const fn dacl_auto_inherit_required(&self) -> bool
Returns whether DACL inheritance computation was requested.
Sourcepub const fn dacl_auto_inherited(&self) -> bool
pub const fn dacl_auto_inherited(&self) -> bool
Returns whether the DACL was produced through inheritance.
Sourcepub const fn dacl_protected(&self) -> bool
pub const fn dacl_protected(&self) -> bool
Returns whether the DACL is protected from inheritance.
Sourcepub const fn sacl_loaded(&self) -> bool
pub const fn sacl_loaded(&self) -> bool
Returns whether the SACL component was loaded.
Sourcepub const fn sacl_present(&self) -> bool
pub const fn sacl_present(&self) -> bool
Returns whether the descriptor marks the SACL as present.
Sourcepub const fn sacl_defaulted(&self) -> bool
pub const fn sacl_defaulted(&self) -> bool
Returns whether the SACL was supplied by a default mechanism.
Sourcepub const fn sacl_auto_inherit_required(&self) -> bool
pub const fn sacl_auto_inherit_required(&self) -> bool
Returns whether SACL inheritance computation was requested.
Sourcepub const fn sacl_auto_inherited(&self) -> bool
pub const fn sacl_auto_inherited(&self) -> bool
Returns whether the SACL was produced through inheritance.
Sourcepub const fn sacl_protected(&self) -> bool
pub const fn sacl_protected(&self) -> bool
Returns whether the SACL is protected from inheritance.
Sourcepub fn with(&self, update: SecDescUpdate) -> Result<Self, SecDescError>
pub fn with(&self, update: SecDescUpdate) -> Result<Self, SecDescError>
Returns a new descriptor with the supplied component and control updates.