control

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NT_SECURITY_DESCRIPTOR_CONTROL_OD uint16 = 0x0001 // Owner Defaulted (SE_OWNER_DEFAULTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_GD uint16 = 0x0002 // Group Defaulted (SE_GROUP_DEFAULTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_DP uint16 = 0x0004 // DACL Present (SE_DACL_PRESENT)
	NT_SECURITY_DESCRIPTOR_CONTROL_DD uint16 = 0x0008 // DACL Defaulted (SE_DACL_DEFAULTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_SP uint16 = 0x0010 // SACL Present (SE_SACL_PRESENT)
	NT_SECURITY_DESCRIPTOR_CONTROL_SD uint16 = 0x0020 // SACL Defaulted (SE_SACL_DEFAULTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_DC uint16 = 0x0100 // DACL Computed Inheritance Required (SE_DACL_AUTO_INHERIT_REQ)
	NT_SECURITY_DESCRIPTOR_CONTROL_SC uint16 = 0x0200 // SACL Computed Inheritance Required (SE_SACL_AUTO_INHERIT_REQ)
	NT_SECURITY_DESCRIPTOR_CONTROL_DI uint16 = 0x0400 // DACL Auto-Inherited (SE_DACL_AUTO_INHERITED)
	NT_SECURITY_DESCRIPTOR_CONTROL_SI uint16 = 0x0800 // SACL Auto-Inherited (SE_SACL_AUTO_INHERITED)
	NT_SECURITY_DESCRIPTOR_CONTROL_PD uint16 = 0x1000 // DACL Protected (SE_DACL_PROTECTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_PS uint16 = 0x2000 // SACL Protected (SE_SACL_PROTECTED)
	NT_SECURITY_DESCRIPTOR_CONTROL_RM uint16 = 0x4000 // RM Control Valid (SE_RM_CONTROL_VALID)
	NT_SECURITY_DESCRIPTOR_CONTROL_SR uint16 = 0x8000 // Self-Relative (SE_SELF_RELATIVE)

	NT_SECURITY_DESCRIPTOR_CONTROL_SS uint16 = 0x0080 // Server Security
	NT_SECURITY_DESCRIPTOR_CONTROL_DT uint16 = 0x0040 // DACL Trusted
)

Control flag bit masks, matching the little-endian wire layout used by MS-DTYP and winnt.h (the SECURITY_DESCRIPTOR_CONTROL / SE_* values). The MS-DTYP packet diagram numbers bits from the most-significant end ("bit 0" is the MSB), but the value actually serialized to the wire uses these masks, e.g. SE_SELF_RELATIVE = 0x8000 and SE_DACL_PRESENT = 0x0004.

Variables

View Source
var NtSecurityDescriptorControlValueToName = map[uint16]string{
	NT_SECURITY_DESCRIPTOR_CONTROL_SR: "Self-Relative",
	NT_SECURITY_DESCRIPTOR_CONTROL_RM: "RM Control Valid",
	NT_SECURITY_DESCRIPTOR_CONTROL_PS: "SACL Protected",
	NT_SECURITY_DESCRIPTOR_CONTROL_PD: "DACL Protected",
	NT_SECURITY_DESCRIPTOR_CONTROL_SI: "SACL Auto-Inherited",
	NT_SECURITY_DESCRIPTOR_CONTROL_DI: "DACL Auto-Inherited",
	NT_SECURITY_DESCRIPTOR_CONTROL_SC: "SACL Computed Inheritance Required",
	NT_SECURITY_DESCRIPTOR_CONTROL_DC: "DACL Computed Inheritance Required",
	NT_SECURITY_DESCRIPTOR_CONTROL_SS: "Server Security",
	NT_SECURITY_DESCRIPTOR_CONTROL_DT: "DACL Trusted",
	NT_SECURITY_DESCRIPTOR_CONTROL_SD: "SACL Defaulted",
	NT_SECURITY_DESCRIPTOR_CONTROL_SP: "SACL Present",
	NT_SECURITY_DESCRIPTOR_CONTROL_DD: "DACL Defaulted",
	NT_SECURITY_DESCRIPTOR_CONTROL_DP: "DACL Present",
	NT_SECURITY_DESCRIPTOR_CONTROL_GD: "Group Defaulted",
	NT_SECURITY_DESCRIPTOR_CONTROL_OD: "Owner Defaulted",
}

Control flag map from value to string representation

Control flag map from value to string representation

Functions

This section is empty.

Types

type NtSecurityDescriptorControl

type NtSecurityDescriptorControl struct {
	RawValue uint16
	Values   []uint16
	Flags    []string
}

NtSecurityDescriptorControl represents the control flags for a NT Security Descriptor. The fields are defined as constants to represent their bit positions.

func (*NtSecurityDescriptorControl) AddControl

func (nsdc *NtSecurityDescriptorControl) AddControl(control uint16) bool

AddControl adds a specific control bit to the RawValue.

Parameters:

  • control (uint16): The control flag to add (NT_SECURITY_DESCRIPTOR_CONTROL_*).

Returns:

  • bool: True if the control was added, false if it was already present.

func (*NtSecurityDescriptorControl) ClearControls

func (nsdc *NtSecurityDescriptorControl) ClearControls()

ClearControls removes all control bits from the RawValue and clears the Values and Flags slices.

func (*NtSecurityDescriptorControl) Equal

Equal compares two NtSecurityDescriptorControl instances for equality.

Parameters:

  • other (*NtSecurityDescriptorControl): The NtSecurityDescriptorControl to compare with.

Returns:

  • bool: True if the NtSecurityDescriptorControls are equal, false otherwise.

func (*NtSecurityDescriptorControl) HasControl

func (nsdc *NtSecurityDescriptorControl) HasControl(control uint16) bool

HasControl checks if a specific control bit is set in the RawValue. Parameters:

  • control (uint16): The control flag to check (NT_SECURITY_DESCRIPTOR_CONTROL_*).

Returns:

  • bool: True if the specified control bit is set, false otherwise.

func (*NtSecurityDescriptorControl) Marshal

func (nsdc *NtSecurityDescriptorControl) Marshal() ([]byte, error)

Marshal serializes the NtSecurityDescriptorControl struct into a byte slice.

Returns:

  • []byte: The serialized byte slice representing the security descriptor control.

func (*NtSecurityDescriptorControl) RemoveControl

func (nsdc *NtSecurityDescriptorControl) RemoveControl(control uint16) bool

RemoveControl removes a specific control bit from the RawValue.

Parameters:

  • control (uint16): The control flag to remove (NT_SECURITY_DESCRIPTOR_CONTROL_*).

Returns:

  • bool: True if the control was removed, false if it was not present.

func (*NtSecurityDescriptorControl) Unmarshal

func (nsdc *NtSecurityDescriptorControl) Unmarshal(rawValue []byte) (int, error)

Unmarshal initializes the NtSecurityDescriptorControl struct by setting its RawValue and extracting the individual control flags from it. It populates the Values and Flags slices based on the control flags that are present in the RawValue.

Parameters:

  • rawValue (uint16): The raw value to be parsed, representing the control flags as a bitmask.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL