Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion gix-sec/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mod impl_ {

pub fn is_path_owned_by_current_user(path: &Path) -> io::Result<bool> {
use windows_sys::Win32::{
Foundation::{GetLastError, LocalFree, ERROR_INSUFFICIENT_BUFFER, ERROR_SUCCESS},
Foundation::{GetLastError, LocalFree, ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_FUNCTION, ERROR_SUCCESS},
Security::{
Authorization::{GetNamedSecurityInfoW, SE_FILE_OBJECT},
CheckTokenMembership, EqualSid, GetTokenInformation, IsWellKnownSid, TokenOwner,
Expand Down Expand Up @@ -123,6 +123,11 @@ mod impl_ {
);

if result != ERROR_SUCCESS {
// We cannot determine ownership, so we default to reduced trust (false) rather
// than failing completely.
if result == ERROR_INVALID_FUNCTION {
return Ok(false);
}
let inner = io::Error::from_raw_os_error(result as _);
error!(
inner,
Expand Down
Loading