mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Complete Windows sandbox uninstall cleanup (#45799)
## Why Packaged uninstall could leave sandbox user profiles and desktop-created data behind. Cleanup also needs to handle a service stop before package removal completes without deleting data belonging to an update or reinstall. ## What changed - Delete sandbox profiles before their accounts, preserving accounts for retry when profile deletion fails. Defer retained runtime accounts and the sandbox group until runtime registrations are removed and profiles unload. - Allow cleanup while the exact retiring package is still registered, while preserving desktop data when a successor package is present. - Remove desktop-created Codex homes during registered runtime cleanup, preserve existing CLI data, and prune empty home and cache directories. Keep directory pins through retries and avoid privileged traversal after releasing the home. - Retry cleanup up to five attempts after a service stop, while retaining shutdown cancellation behavior. - Report cleanup outcomes in the Windows Event Log and emit final completion after registered runtime cleanup finishes. Remove the empty installation registry parent. ## Testing Add Windows tests for profile deletion retry and account preservation, service-stop retries versus system shutdown, and PowerShell finalizer parsing and native binding compilation. Extend retained-token coverage to check account SID matching. GitOrigin-RevId: 1aefa969e6aff9bb8e77e2c9fe9ee772230fc4fb
This commit is contained in:
1 parent
63c09ed212
commit
872fc22f9c
16 files changed
+703
-62
No files matched your search
@@ -17,11 +17,13 @@ mod retained_logons;
|
||||
/// Removes sandbox resources created for one authenticated packaged installation.
|
||||
/// Keep a supplied home and its ancestors pinned until `clean_up_desktop` starts.
|
||||
/// That callback removes user-owned desktop files while the sandbox accounts remain disabled.
|
||||
/// `report` must remain usable after the home and its log files have been removed.
|
||||
pub fn clean_up_packaged_windows_sandbox(
|
||||
codex_home: Option<&Path>,
|
||||
report: impl Fn(&str),
|
||||
clean_up_desktop: impl FnOnce() -> Result<()>,
|
||||
) -> Result<()> {
|
||||
prepare_packaged_windows_sandbox_cleanup()?.finish(codex_home, clean_up_desktop)
|
||||
prepare_packaged_windows_sandbox_cleanup()?.finish(codex_home, report, clean_up_desktop)
|
||||
}
|
||||
|
||||
/// Holds the setup lock after sandbox accounts are disabled, their processes
|
||||
@@ -86,9 +88,11 @@ impl PreparedWindowsSandboxCleanup {
|
||||
/// starts. Independent cleanup steps continue after an error, as in
|
||||
/// `clean_up_packaged_windows_sandbox`. Retrying keeps the original account
|
||||
/// identities; it must not adopt replacement accounts created between attempts.
|
||||
/// `report` records each cleanup outcome without relying on files in the home.
|
||||
pub fn finish(
|
||||
&self,
|
||||
codex_home: Option<&Path>,
|
||||
report: impl Fn(&str),
|
||||
clean_up_desktop: impl FnOnce() -> Result<()>,
|
||||
) -> Result<()> {
|
||||
self.users.validate_current()?;
|
||||
@@ -98,38 +102,72 @@ impl PreparedWindowsSandboxCleanup {
|
||||
if let Err(error) = crate::logging::release_setup_log() {
|
||||
errors.push(format!("release setup log: {error:#}"));
|
||||
}
|
||||
for directory in [
|
||||
crate::setup::sandbox_dir(codex_home),
|
||||
crate::setup::sandbox_secrets_dir(codex_home),
|
||||
crate::setup::sandbox_bin_dir(codex_home),
|
||||
for (directory, path) in [
|
||||
(".sandbox", crate::setup::sandbox_dir(codex_home)),
|
||||
(
|
||||
".sandbox-secrets",
|
||||
crate::setup::sandbox_secrets_dir(codex_home),
|
||||
),
|
||||
(".sandbox-bin", crate::setup::sandbox_bin_dir(codex_home)),
|
||||
] {
|
||||
match std::fs::remove_dir_all(&directory) {
|
||||
Ok(()) => {}
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
|
||||
match std::fs::remove_dir_all(path) {
|
||||
Ok(()) => report(&format!("removed {directory}")),
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
|
||||
report(&format!("skipping {directory}: not found"));
|
||||
}
|
||||
Err(error) => {
|
||||
errors.push(format!("remove {}: {error}", directory.display()));
|
||||
let message = format!("remove {directory}: failed, {error}");
|
||||
report(&message);
|
||||
errors.push(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
report("skipping sandbox directories: no pinned home");
|
||||
}
|
||||
|
||||
if let Err(error) = clean_up_desktop() {
|
||||
errors.push(format!("{error:#}"));
|
||||
}
|
||||
|
||||
for result in [
|
||||
crate::wfp::remove_wfp_filters(),
|
||||
firewall::cleanup_firewall_rules(),
|
||||
principals::remove_sandbox_principal("CodexSandboxUsers"),
|
||||
crate::hide_users::unhide_sandbox_users(&[OFFLINE_USERNAME, ONLINE_USERNAME]),
|
||||
// Keep accounts disabled and setup locked until shared cleanup and account deletion finish.
|
||||
principals::remove_sandbox_principal(OFFLINE_USERNAME),
|
||||
principals::remove_sandbox_principal(ONLINE_USERNAME),
|
||||
for (operation, result) in [
|
||||
("remove WFP filters", crate::wfp::remove_wfp_filters()),
|
||||
("remove firewall rules", firewall::cleanup_firewall_rules()),
|
||||
(
|
||||
"remove hidden-user entries",
|
||||
crate::hide_users::unhide_sandbox_users(&[OFFLINE_USERNAME, ONLINE_USERNAME]),
|
||||
),
|
||||
] {
|
||||
if let Err(error) = result {
|
||||
errors.push(format!("{error:#}"));
|
||||
match result {
|
||||
Ok(()) => report(&format!("{operation}: completed")),
|
||||
Err(error) => {
|
||||
let message = format!("{operation}: failed, {error:#}");
|
||||
report(&message);
|
||||
errors.push(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Err(error) = self.users.remove_users(&self._retained_logons, &report) {
|
||||
errors.push(format!("{error:#}"));
|
||||
}
|
||||
// Retry home permission cleanup with the same group; retained runtime users
|
||||
// and their group are removed by the finalizer after their profiles unload.
|
||||
if errors.is_empty()
|
||||
&& !self
|
||||
.users
|
||||
.sids()
|
||||
.any(|sid| self._retained_logons.contains_sid(sid))
|
||||
{
|
||||
match principals::remove_sandbox_principal("CodexSandboxUsers") {
|
||||
Ok(()) => report("remove sandbox group: completed"),
|
||||
Err(error) => {
|
||||
report(&format!("remove sandbox group: failed, {error:#}"));
|
||||
errors.push(format!("{error:#}"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
report("retaining sandbox group until cleanup finishes");
|
||||
}
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Disables sandbox accounts for cleanup and removes sandbox principals.
|
||||
//! Disables sandbox accounts for cleanup and removes their profiles and principals.
|
||||
//! Callers must restore original flags if preparation for cleanup fails.
|
||||
|
||||
use std::ptr::null;
|
||||
@@ -6,15 +6,22 @@ use std::ptr::null;
|
||||
use anyhow::Result;
|
||||
use anyhow::bail;
|
||||
use anyhow::ensure;
|
||||
use windows_sys::Win32::Foundation::ERROR_FILE_NOT_FOUND;
|
||||
use windows_sys::Win32::Foundation::ERROR_SUCCESS;
|
||||
use windows_sys::Win32::NetworkManagement::NetManagement as network;
|
||||
use windows_sys::Win32::System::Registry as registry;
|
||||
use windows_sys::Win32::UI::Shell::DeleteProfileW;
|
||||
|
||||
use crate::setup::OFFLINE_USERNAME;
|
||||
use crate::setup::ONLINE_USERNAME;
|
||||
use crate::winutil::local_user_flags;
|
||||
use crate::winutil::resolve_sid;
|
||||
use crate::winutil::set_local_user_flags;
|
||||
use crate::winutil::string_from_sid_bytes;
|
||||
use crate::winutil::to_wide;
|
||||
|
||||
use super::retained_logons::RetainedLogons;
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct DisabledSandboxUsers {
|
||||
users: Vec<SandboxUser>,
|
||||
@@ -80,6 +87,70 @@ impl DisabledSandboxUsers {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn remove_users(
|
||||
&self,
|
||||
retained: &RetainedLogons,
|
||||
report: impl Fn(&str),
|
||||
) -> Result<()> {
|
||||
let mut errors = Vec::new();
|
||||
for user in &self.users {
|
||||
if retained.contains_sid(&user.sid) {
|
||||
report(&format!(
|
||||
"deferring {} profile and account to runtime cleanup",
|
||||
user.name
|
||||
));
|
||||
continue;
|
||||
}
|
||||
match user.remove() {
|
||||
Ok(()) => report(&format!("removed {} profile and account", user.name)),
|
||||
Err(error) => {
|
||||
report(&format!(
|
||||
"remove {} profile and account: failed, {error:#}",
|
||||
user.name
|
||||
));
|
||||
errors.push(format!("{error:#}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
ensure!(errors.is_empty(), "{}", errors.join("; "));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl SandboxUser {
|
||||
fn remove(&self) -> Result<()> {
|
||||
let Self { name, sid, .. } = self;
|
||||
let sid = string_from_sid_bytes(sid).map_err(anyhow::Error::msg)?;
|
||||
let profile_key = to_wide(format!(
|
||||
r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\{sid}"
|
||||
));
|
||||
let mut key = 0;
|
||||
let status = unsafe {
|
||||
registry::RegOpenKeyExW(
|
||||
registry::HKEY_LOCAL_MACHINE,
|
||||
profile_key.as_ptr(),
|
||||
/*uloptions*/ 0,
|
||||
registry::KEY_READ | registry::KEY_WOW64_64KEY,
|
||||
&mut key,
|
||||
)
|
||||
};
|
||||
match status {
|
||||
ERROR_SUCCESS => {
|
||||
unsafe { registry::RegCloseKey(key) };
|
||||
// Keep the account's SID available for retry if its profile is still loaded.
|
||||
if unsafe { DeleteProfileW(to_wide(sid).as_ptr(), null(), null()) } == 0 {
|
||||
bail!(
|
||||
"remove sandbox profile for {name}: {}",
|
||||
std::io::Error::last_os_error()
|
||||
);
|
||||
}
|
||||
}
|
||||
ERROR_FILE_NOT_FOUND => {}
|
||||
status => bail!("open sandbox profile for {name}: {status}"),
|
||||
}
|
||||
remove_sandbox_principal(name)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -108,3 +179,7 @@ pub(super) fn remove_sandbox_principal(name: &str) -> Result<()> {
|
||||
status => bail!("remove local sandbox principal {name}: {status}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "principals_tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,218 @@
|
||||
//! Exercises profile deletion and its retry boundary with one disposable local user.
|
||||
|
||||
use std::io;
|
||||
use std::os::windows::ffi::OsStringExt;
|
||||
use std::os::windows::io::AsRawHandle;
|
||||
use std::os::windows::io::FromRawHandle;
|
||||
use std::os::windows::io::OwnedHandle;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr::null;
|
||||
use std::ptr::null_mut;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::ensure;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rand::RngCore;
|
||||
use windows_sys::Win32::Foundation::ERROR_ACCESS_DENIED;
|
||||
use windows_sys::Win32::Foundation::ERROR_FILE_NOT_FOUND;
|
||||
use windows_sys::Win32::Foundation::ERROR_SUCCESS;
|
||||
use windows_sys::Win32::Foundation::WAIT_OBJECT_0;
|
||||
use windows_sys::Win32::NetworkManagement::NetManagement as network;
|
||||
use windows_sys::Win32::System::Registry as registry;
|
||||
use windows_sys::Win32::System::Threading as threading;
|
||||
|
||||
use super::SandboxUser;
|
||||
use crate::winutil::local_user_flags;
|
||||
use crate::winutil::resolve_sid;
|
||||
use crate::winutil::set_local_user_flags;
|
||||
use crate::winutil::string_from_sid_bytes;
|
||||
use crate::winutil::to_wide;
|
||||
|
||||
struct ProfileFixture {
|
||||
user: SandboxUser,
|
||||
process: Option<OwnedHandle>,
|
||||
}
|
||||
|
||||
impl ProfileFixture {
|
||||
fn stop(&mut self) -> Result<()> {
|
||||
if let Some(process) = self.process.take() {
|
||||
let handle = process.as_raw_handle() as _;
|
||||
unsafe {
|
||||
threading::TerminateProcess(handle, /*uexitcode*/ 0)
|
||||
};
|
||||
ensure!(
|
||||
unsafe {
|
||||
threading::WaitForSingleObject(handle, /*dwmilliseconds*/ 10_000)
|
||||
} == WAIT_OBJECT_0,
|
||||
"owned profile fixture did not exit"
|
||||
);
|
||||
drop(process);
|
||||
// User Profile Service unloads the hive after the last owned process exits.
|
||||
let sid = string_from_sid_bytes(&self.user.sid).map_err(anyhow::Error::msg)?;
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
loop {
|
||||
let mut key = 0;
|
||||
let status = unsafe {
|
||||
registry::RegOpenKeyExW(
|
||||
registry::HKEY_USERS,
|
||||
to_wide(&sid).as_ptr(),
|
||||
/*uloptions*/ 0,
|
||||
registry::KEY_READ,
|
||||
&mut key,
|
||||
)
|
||||
};
|
||||
if status == ERROR_FILE_NOT_FOUND {
|
||||
break;
|
||||
}
|
||||
ensure!(status == ERROR_SUCCESS, "read owned profile hive: {status}");
|
||||
unsafe { registry::RegCloseKey(key) };
|
||||
ensure!(Instant::now() < deadline, "owned profile did not unload");
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ProfileFixture {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.stop();
|
||||
let result = if self.user.sid.is_empty() {
|
||||
super::remove_sandbox_principal(self.user.name)
|
||||
} else {
|
||||
self.user.remove()
|
||||
};
|
||||
if let Err(error) = result {
|
||||
eprintln!("unable to clean up owned profile fixture: {error:#}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_cleanup_preserves_account_until_profile_can_be_deleted() -> Result<()> {
|
||||
// Production names are static. This one unique name lives for this test process only.
|
||||
let name: &'static str =
|
||||
Box::leak(format!("CodexPrf{:08x}", rand::rngs::OsRng.next_u32()).into_boxed_str());
|
||||
let username = to_wide(name);
|
||||
let password = to_wide(format!("Cdx!a0{:016x}", rand::rngs::OsRng.next_u64()));
|
||||
let user_info = network::USER_INFO_1 {
|
||||
usri1_name: username.as_ptr().cast_mut(),
|
||||
usri1_password: password.as_ptr().cast_mut(),
|
||||
usri1_priv: network::USER_PRIV_USER,
|
||||
usri1_flags: network::UF_NORMAL_ACCOUNT
|
||||
| network::UF_SCRIPT
|
||||
| network::UF_DONT_EXPIRE_PASSWD,
|
||||
..unsafe { std::mem::zeroed() }
|
||||
};
|
||||
let status = unsafe {
|
||||
network::NetUserAdd(
|
||||
null(),
|
||||
/*level*/ 1,
|
||||
(&raw const user_info).cast(),
|
||||
null_mut(),
|
||||
)
|
||||
};
|
||||
if status == ERROR_ACCESS_DENIED {
|
||||
eprintln!(
|
||||
"skipping native profile cleanup test: creating its disposable user requires elevation"
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
ensure!(
|
||||
status == network::NERR_Success,
|
||||
"create owned profile fixture: {status}"
|
||||
);
|
||||
let mut fixture = ProfileFixture {
|
||||
user: SandboxUser {
|
||||
name,
|
||||
original_flags: user_info.usri1_flags,
|
||||
sid: Vec::new(),
|
||||
},
|
||||
process: None,
|
||||
};
|
||||
fixture.user.sid = resolve_sid(name)?;
|
||||
let sid = string_from_sid_bytes(&fixture.user.sid).map_err(anyhow::Error::msg)?;
|
||||
let profile_key = to_wide(format!(
|
||||
r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\{sid}"
|
||||
));
|
||||
let system_root = std::env::var_os("SystemRoot").context("SystemRoot is missing")?;
|
||||
let executable =
|
||||
PathBuf::from(&system_root).join(r"System32\WindowsPowerShell\v1.0\powershell.exe");
|
||||
let executable = to_wide(executable);
|
||||
let mut command =
|
||||
to_wide("powershell.exe -NoProfile -NonInteractive -Command Start-Sleep -Seconds 600");
|
||||
let mut startup: threading::STARTUPINFOW = unsafe { std::mem::zeroed() };
|
||||
startup.cb = std::mem::size_of_val(&startup) as u32;
|
||||
let mut process: threading::PROCESS_INFORMATION = unsafe { std::mem::zeroed() };
|
||||
let created = unsafe {
|
||||
threading::CreateProcessWithLogonW(
|
||||
username.as_ptr(),
|
||||
to_wide(".").as_ptr(),
|
||||
password.as_ptr(),
|
||||
threading::LOGON_WITH_PROFILE,
|
||||
executable.as_ptr(),
|
||||
command.as_mut_ptr(),
|
||||
threading::CREATE_NO_WINDOW,
|
||||
null(),
|
||||
to_wide(&system_root).as_ptr(),
|
||||
&startup,
|
||||
&mut process,
|
||||
)
|
||||
};
|
||||
ensure!(
|
||||
created != 0,
|
||||
"start owned profile fixture: {}",
|
||||
io::Error::last_os_error()
|
||||
);
|
||||
fixture.process = Some(unsafe { OwnedHandle::from_raw_handle(process.hProcess as _) });
|
||||
drop(unsafe { OwnedHandle::from_raw_handle(process.hThread as _) });
|
||||
let mut path = [0u16; 32768];
|
||||
let mut length = std::mem::size_of_val(&path) as u32;
|
||||
let status = unsafe {
|
||||
registry::RegGetValueW(
|
||||
registry::HKEY_LOCAL_MACHINE,
|
||||
profile_key.as_ptr(),
|
||||
to_wide("ProfileImagePath").as_ptr(),
|
||||
registry::RRF_RT_REG_SZ | registry::RRF_RT_REG_EXPAND_SZ,
|
||||
null_mut(),
|
||||
path.as_mut_ptr().cast(),
|
||||
&mut length,
|
||||
)
|
||||
};
|
||||
assert_eq!(status, ERROR_SUCCESS);
|
||||
let path = PathBuf::from(std::ffi::OsString::from_wide(
|
||||
&path[..length as usize / 2 - 1],
|
||||
));
|
||||
assert!(path.is_dir());
|
||||
set_local_user_flags(name, user_info.usri1_flags | network::UF_ACCOUNTDISABLE)?;
|
||||
assert!(
|
||||
fixture.user.remove().is_err(),
|
||||
"loaded profile must block deletion"
|
||||
);
|
||||
assert_eq!(resolve_sid(name)?, fixture.user.sid);
|
||||
assert!(path.is_dir());
|
||||
|
||||
fixture.stop()?;
|
||||
fixture.user.remove()?;
|
||||
assert_eq!(local_user_flags(name)?, None);
|
||||
assert!(!path.exists());
|
||||
let mut key = 0;
|
||||
let status = unsafe {
|
||||
registry::RegOpenKeyExW(
|
||||
registry::HKEY_LOCAL_MACHINE,
|
||||
profile_key.as_ptr(),
|
||||
/*uloptions*/ 0,
|
||||
registry::KEY_READ,
|
||||
&mut key,
|
||||
)
|
||||
};
|
||||
if status == ERROR_SUCCESS {
|
||||
unsafe { registry::RegCloseKey(key) };
|
||||
}
|
||||
assert_eq!(status, ERROR_FILE_NOT_FOUND);
|
||||
fixture.user.remove()?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -21,6 +21,7 @@ pub(super) struct RetainedLogons {
|
||||
// Keeping each token open prevents its AuthenticationId from being recycled.
|
||||
_tokens: Vec<OwnedHandle>,
|
||||
ids: Vec<LUID>,
|
||||
sids: Vec<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl RetainedLogons {
|
||||
@@ -30,14 +31,13 @@ impl RetainedLogons {
|
||||
) -> Result<Self> {
|
||||
ensure!(tokens.len() <= 2, "too many retained cleanup tokens");
|
||||
let mut retained = Self::default();
|
||||
let mut seen_sids = Vec::new();
|
||||
for token in tokens {
|
||||
let token = token.try_clone_to_owned()?;
|
||||
let handle = token.as_raw_handle() as HANDLE;
|
||||
let sid = unsafe { crate::token::get_user_sid_bytes(handle) }?;
|
||||
ensure!(
|
||||
users.sids().any(|candidate| candidate == sid.as_slice())
|
||||
&& !seen_sids.contains(&sid),
|
||||
&& !retained.sids.contains(&sid),
|
||||
"cleanup token does not identify a distinct managed sandbox account"
|
||||
);
|
||||
let mut stats: TOKEN_STATISTICS = unsafe { std::mem::zeroed() };
|
||||
@@ -58,7 +58,7 @@ impl RetainedLogons {
|
||||
returned as usize == std::mem::size_of::<TOKEN_STATISTICS>(),
|
||||
"unexpected cleanup token statistics length"
|
||||
);
|
||||
seen_sids.push(sid);
|
||||
retained.sids.push(sid);
|
||||
retained.ids.push(stats.AuthenticationId);
|
||||
retained._tokens.push(token);
|
||||
}
|
||||
@@ -70,6 +70,10 @@ impl RetainedLogons {
|
||||
.iter()
|
||||
.any(|held| held.LowPart == id.LowPart && held.HighPart == id.HighPart)
|
||||
}
|
||||
|
||||
pub(super) fn contains_sid(&self, sid: &[u8]) -> bool {
|
||||
self.sids.iter().any(|held| held == sid)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -34,6 +34,7 @@ fn matches_only_the_complete_retained_authentication_id() {
|
||||
LowPart: 17,
|
||||
HighPart: 4,
|
||||
}],
|
||||
sids: Vec::new(),
|
||||
};
|
||||
let observed = [
|
||||
LUID {
|
||||
@@ -102,5 +103,7 @@ fn retained_token_remains_queryable_after_the_borrowed_handle_is_closed() -> Res
|
||||
assert_eq!(retained._tokens.len(), 1);
|
||||
let actual_sid = unsafe { get_user_sid_bytes(retained._tokens[0].as_raw_handle() as HANDLE) }?;
|
||||
assert_eq!(actual_sid, expected_sid);
|
||||
assert!(retained.contains_sid(&expected_sid));
|
||||
assert!(!retained.contains_sid(&[]));
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user