File: null_dacl.rs

package info (click to toggle)
rust-interprocess 2.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,016 kB
  • sloc: makefile: 2
file content (28 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use {
    crate::{
        local_socket::{prelude::*, ListenerOptions, Stream},
        os::windows::{
            local_socket::ListenerOptionsExt,
            security_descriptor::{AsSecurityDescriptorMutExt, SecurityDescriptor},
        },
        tests::util::*,
        TryClone,
    },
    std::{ptr, sync::Arc},
};

pub(super) fn test_main() -> TestResult {
    let mut sd = SecurityDescriptor::new().opname("security descriptor creation")?;
    unsafe {
        sd.set_dacl(ptr::null_mut(), false).opname("DACL setter")?;
    }
    let (name, _listener) =
        listen_and_pick_name(&mut namegen_local_socket(make_id!(), false), |nm| {
            ListenerOptions::new()
                .name(nm.borrow())
                .security_descriptor(sd.try_clone()?)
                .create_sync()
        })?;
    let _ = Stream::connect(Arc::try_unwrap(name).unwrap()).opname("client connect")?;
    Ok(())
}