Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-windows-permissions feature, to disable access/owner checks #484

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ serial_test = "0.5"

[features]
sudo = []
no-windows-permissions = []
26 changes: 26 additions & 0 deletions src/meta/windows_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ use super::{Owner, Permissions};

const BUF_SIZE: u32 = 256;

#[cfg(feature = "no-windows-permissions")]
pub fn get_file_data(path: &Path) -> Result<(Owner, Permissions), io::Error> {
let owner = Owner::new("?".to_string(), "?".to_string());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to make owner optional in the struct in case of windows(we could probably have #473 added in after that).
Also have the user/group as - with a greyish colors simliar to when there are no permissions. Something like this.
Screenshot 2021-02-13 at 8 45 14 PM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea -- I'll get on it today. I may split the no-windows-perms stuff into a separate .rs file, so that it's easier to cfg out stuff to avoid warnings too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry, life got in the way this past week. will get to it when I can!)


let permissions = Permissions {
user_read: false,
user_write: false,
user_execute: false,

group_read: false,
group_write: false,
group_execute: false,

other_read: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make this as false as well.

other_write: true,
other_execute: true,

sticky: false,
setuid: false,
setgid: false,
};

Ok((owner, permissions))
}

#[cfg(not(feature = "no-windows-permissions"))]
pub fn get_file_data(path: &Path) -> Result<(Owner, Permissions), io::Error> {
// Overall design:
// This function allocates some data with GetNamedSecurityInfoW,
Expand Down