Documentation
¶
Overview ¶
Package applicationdata models the optional, variable-length ApplicationData member that trails the fixed fields of certain ACE types (MS-DTYP 2.4.4.x).
The bytes it holds are interpreted according to the owning ACE type:
- Callback ACE types (ACCESS_ALLOWED_CALLBACK, ACCESS_DENIED_CALLBACK and their object/audit variants) carry a conditional expression, prefixed by the ACE_CONDITION_SIGNATURE "artx" (MS-DTYP 2.4.4.17.1).
- SYSTEM_RESOURCE_ATTRIBUTE ACEs carry a CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 structure (MS-DTYP 2.4.10.1).
- SYSTEM_SCOPED_POLICY_ID and any other type carry opaque data preserved verbatim.
The raw bytes are always kept intact so that Marshal(Unmarshal(x)) == x; the decoded views (conditional expression, resource attribute) are derived on demand and never replace the raw bytes.
Index ¶
- type ApplicationData
- func (ad *ApplicationData) ConditionalExpression() (string, error)
- func (ad *ApplicationData) Describe(indent int)
- func (ad *ApplicationData) DescribeList() []string
- func (ad *ApplicationData) DescribeWithCallback(indent int, printf describe.Printf)
- func (ad *ApplicationData) Equal(other *ApplicationData) bool
- func (ad *ApplicationData) IsConditional() bool
- func (ad *ApplicationData) IsResourceAttribute() bool
- func (ad *ApplicationData) Len() int
- func (ad *ApplicationData) Marshal() ([]byte, error)
- func (ad *ApplicationData) ResourceAttribute() (string, error)
- func (ad *ApplicationData) Unmarshal(marshalledData []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationData ¶
type ApplicationData struct {
// AceType is the ACE_TYPE value of the owning ACE. It selects how RawBytes
// are interpreted (conditional expression, resource attribute, ...).
AceType uint8
// RawBytes is the verbatim ApplicationData payload.
RawBytes []byte
// RawBytesSize is the number of bytes held in RawBytes.
RawBytesSize uint32
}
ApplicationData holds the trailing ApplicationData bytes of an ACE together with the type of the ACE that owns them, which determines how they are interpreted when described or serialized to SDDL.
func (*ApplicationData) ConditionalExpression ¶
func (ad *ApplicationData) ConditionalExpression() (string, error)
ConditionalExpression decodes the payload into its SDDL conditional-expression text (without an outer pair of parentheses).
func (*ApplicationData) Describe ¶
func (ad *ApplicationData) Describe(indent int)
func (*ApplicationData) DescribeList ¶
func (ad *ApplicationData) DescribeList() []string
DescribeList returns the ApplicationData description as a list of lines at indentation depth 0. For a callback ACE carrying a conditional expression it shows the ACE_CONDITION signature ("artx") magic bytes and the decoded expression; for a resource-attribute ACE it shows the decoded CLAIM attribute; otherwise it falls back to the raw bytes. The raw bytes are always shown so nothing is hidden if decoding is partial.
func (*ApplicationData) DescribeWithCallback ¶
func (ad *ApplicationData) DescribeWithCallback(indent int, printf describe.Printf)
DescribeWithCallback renders the ApplicationData at the given indentation depth, routing each line to the provided fmt.Printf-like callback.
func (*ApplicationData) Equal ¶
func (ad *ApplicationData) Equal(other *ApplicationData) bool
Equal reports whether two ApplicationData payloads hold the same bytes. bytes.Equal treats a nil and an empty slice as equal, which is the desired behavior here.
Parameters:
- other (*ApplicationData): The ApplicationData to compare against.
Returns:
- bool: true if the payloads are byte-for-byte equal.
func (*ApplicationData) IsConditional ¶
func (ad *ApplicationData) IsConditional() bool
IsConditional reports whether the payload carries a conditional expression, i.e. whether it begins with the ACE_CONDITION_SIGNATURE ("artx").
func (*ApplicationData) IsResourceAttribute ¶
func (ad *ApplicationData) IsResourceAttribute() bool
IsResourceAttribute reports whether the payload should be interpreted as a resource attribute, which is decided by the owning ACE type.
func (*ApplicationData) Len ¶
func (ad *ApplicationData) Len() int
Len returns the number of bytes held in the ApplicationData payload.
func (*ApplicationData) Marshal ¶
func (ad *ApplicationData) Marshal() ([]byte, error)
Marshal serializes the ApplicationData into a byte slice.
Returns:
- []byte: The verbatim ApplicationData payload.
- error: Always nil; the signature matches the other ACE sub-structures.
func (*ApplicationData) ResourceAttribute ¶
func (ad *ApplicationData) ResourceAttribute() (string, error)
ResourceAttribute decodes the payload into its SDDL attribute-data text (without an outer pair of parentheses).
func (*ApplicationData) Unmarshal ¶
func (ad *ApplicationData) Unmarshal(marshalledData []byte) (int, error)
Unmarshal stores the supplied bytes as the ApplicationData payload. The length of an ACE's ApplicationData is implied by the ACE Header.Size, so the caller passes exactly the trailing bytes that follow the fixed ACE fields. A copy is kept so the payload does not alias the caller's buffer.
Parameters:
- marshalledData ([]byte): The trailing ApplicationData bytes of an ACE.
Returns:
- int: The number of bytes consumed (the full length of marshalledData).
- error: Always nil; the signature matches the other ACE sub-structures.