Documentation
¶
Overview ¶
Package condition implements the conditional-expression codec used by conditional (callback) ACEs, as specified in MS-DTYP 2.4.4.17 and its subsections (2.4.4.17.1 Conditional ACE Expressions, and the Literal / Attribute / Relational / Logical operator token tables).
A conditional expression lives in the ApplicationData member of a callback ACE, prefixed by the 4-byte ACE_CONDITION_SIGNATURE "artx" (0x61 0x72 0x74 0x78). The remainder is a series of tokens in postfix (reverse Polish) order. This package converts between the SDDL textual form of a conditional expression (e.g. `(@User.Title=="PM" && @User.Division=="Finance")`) and that binary form.
text -> Marshal -> ApplicationData bytes ("artx" + tokens + DWORD padding)
bytes -> Unmarshal -> text
All multibyte integers (including UTF-16 characters) are stored least-significant byte first, and the encoded expression is padded with 0x00 to a DWORD (4-byte) boundary.
Index ¶
- Variables
- func Encode(root Node) ([]byte, error)
- func IsConditional(applicationData []byte) bool
- func Marshal(expr string) ([]byte, error)
- func Serialize(root Node) string
- func Unmarshal(applicationData []byte) (string, error)
- type Attribute
- type BinaryOp
- type Composite
- type IntLiteral
- type Node
- type OctetLiteral
- type SIDLiteral
- type StringLiteral
- type UnaryOp
Constants ¶
This section is empty.
Variables ¶
var ACE_CONDITION_SIGNATURE = []byte{0x61, 0x72, 0x74, 0x78}
ACE_CONDITION_SIGNATURE marks a callback ACE's ApplicationData as a conditional expression (MS-DTYP 2.4.4.17.1).
Functions ¶
func IsConditional ¶
IsConditional reports whether applicationData carries a conditional expression, i.e. whether it begins with the ACE_CONDITION_SIGNATURE.
func Marshal ¶
Marshal parses an SDDL conditional-expression string and returns the binary ApplicationData encoding (signature + postfix token stream + DWORD padding). The input may optionally be wrapped in a single outer pair of parentheses, as it appears in an ACE string.
Types ¶
type Attribute ¶
type Attribute struct {
Token byte // one of tokenLocalAttr/tokenUserAttr/tokenResourceAttr/tokenDeviceAttr/tokenTokenAttr
Name string
}
Attribute is an attribute-name operand (local or @User./@Resource./@Device.).
type Composite ¶
type Composite struct{ Items []Node }
Composite is a braced set of literals ("{a,b,c}").
type IntLiteral ¶
IntLiteral is an integer literal. Width is the token byte-code (int8..int64), Base and Sign preserve the textual representation for lossless round-tripping.
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node is a node in a conditional-expression AST.
type OctetLiteral ¶
type OctetLiteral struct{ Value []byte }
OctetLiteral is an octet (byte) string literal (SDDL "#hex" form).
type SIDLiteral ¶
type SIDLiteral struct{ SID string }
SIDLiteral is a SID literal (SDDL "SID(...)" form).
type StringLiteral ¶
type StringLiteral struct{ Value string }
StringLiteral is a Unicode string literal.