Skip to main content

Ace

Struct Ace 

Source
pub struct Ace {
    pub ace_type: AceType,
    pub flags: u8,
    pub mask: AccessMask,
    pub trustee: Sid,
    pub object_type: Option<Guid>,
    pub inherited_object_type: Option<Guid>,
}

Fields§

§ace_type: AceType§flags: u8§mask: AccessMask§trustee: Sid§object_type: Option<Guid>

Present for object ACEs: which property-set / extended-right / child-class this grants.

§inherited_object_type: Option<Guid>

Implementations§

Source§

impl Ace

Source

pub fn is_allow(&self) -> bool

Examples found in repository?
examples/parse_sd.rs (line 25)
9fn main() {
10    let bytes = match std::env::args().nth(1) {
11        Some(hex) => (0..hex.len())
12            .step_by(2)
13            .map(|i| u8::from_str_radix(&hex[i..i + 2], 16).expect("hex"))
14            .collect::<Vec<u8>>(),
15        None => {
16            windows_sddl::build_rbcd_sd(&windows_sddl::Sid::parse("S-1-5-21-1-2-3-1104").unwrap())
17        }
18    };
19
20    let sd = parse(&bytes).expect("parse security descriptor");
21    if let Some(o) = &sd.owner {
22        println!("owner: {o}");
23    }
24    for ace in sd.dacl.iter().flat_map(|d| &d.aces) {
25        if !ace.is_allow() {
26            continue;
27        }
28        let mut notes = Vec::new();
29        if ace.mask.contains(AccessMask::GENERIC_ALL) {
30            notes.push("GenericAll".to_string());
31        }
32        if ace.mask.contains(AccessMask::WRITE_DAC) {
33            notes.push("WriteDacl".to_string());
34        }
35        if ace.mask.contains(AccessMask::WRITE_OWNER) {
36            notes.push("WriteOwner".to_string());
37        }
38        if let Some(g) = &ace.object_type {
39            if rights::is_dcsync_right(g) {
40                notes.push("DCSync".to_string());
41            }
42            if rights::is_enrollment_right(g) {
43                notes.push("Cert-Enrollment".to_string());
44            }
45            if rights::KEY_CREDENTIAL_LINK.matches(g) {
46                notes.push("Shadow-Credentials".to_string());
47            }
48            if rights::RBCD_ATTR.matches(g) {
49                notes.push("RBCD".to_string());
50            }
51        }
52        if !notes.is_empty() {
53            println!("  {} → {}", ace.trustee, notes.join(", "));
54        }
55    }
56}

Trait Implementations§

Source§

impl Clone for Ace

Source§

fn clone(&self) -> Ace

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Ace

§

impl RefUnwindSafe for Ace

§

impl Send for Ace

§

impl Sync for Ace

§

impl Unpin for Ace

§

impl UnsafeUnpin for Ace

§

impl UnwindSafe for Ace

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.