Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["xtask", "rar-common"]

[package]
name = "rootasrole"
version = "3.3.1"
version = "3.3.2"
rust-version = "1.83.0"
authors = ["Eddie Billoir <lechatp@outlook.fr>"]
edition = "2021"
Expand Down Expand Up @@ -59,7 +59,7 @@ hashchecker = ["dep:hex", "dep:sha2"]
ssd = []
hierarchy = []
timeout = []
landlock = ["dep:landlock", "dep:bitflags"]
landlock = ["dep:landlock", "dep:bitflags", "dep:glob"]
editor = ["dep:landlock", "dep:libseccomp", "dep:pest", "dep:pest_derive", "dep:linked_hash_set"]

[lints.rust]
Expand All @@ -69,7 +69,7 @@ unexpected_cfgs = { level = "allow", check-cfg = ['cfg(tarpaulin_include)'] }
toml = { version = "0.8", default-features = false, features = ["parse", "display", "preserve_order"] }

[dependencies]
rar-common = { path = "rar-common", version = "3.3.1", package = "rootasrole-core" }
rar-common = { path = "rar-common", version = "3.3.2", package = "rootasrole-core" }
log = { version = "0.4", default-features = false, features = ["std"] }
libc = { version = "0.2", default-features = false, features = ["std"]}
strum = { version = "0.26", default-features = false, features = ["derive"] }
Expand All @@ -87,6 +87,7 @@ bon = { version = "3", default-features = false }
nonstick = { version = "0.1.1", optional = true }
libpam-sys = { version = "0.2.0", default-features = false, optional = true }
pcre2 = { version = "0.2", default-features = false, optional = true }
glob = { version = "0.3", default-features = false, optional = true }
sha2 = { version = "0.10", default-features = false, optional = true }
pty-process = { version = "0.4", default-features = false, optional = true }
once_cell = { version = "1.20", default-features = false, optional = true, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion rar-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rootasrole-core"
version = "3.3.1"
version = "3.3.2"
edition = "2021"
description = "This core crate for the RootAsRole project."
license = "LGPL-3.0-or-later"
Expand Down
2 changes: 1 addition & 1 deletion resources/man/en_US.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% RootAsRole(8) RootAsRole 3.3.1 | System Manager's Manual
% RootAsRole(8) RootAsRole 3.3.2 | System Manager's Manual
% Eddie Billoir <lechatp@outlook.fr>
% August 2025

Expand Down
2 changes: 1 addition & 1 deletion resources/man/fr_FR.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% RootAsRole(8) RootAsRole 3.3.1 | Manuel de l'administrateur système
% RootAsRole(8) RootAsRole 3.3.2 | Manuel de l'administrateur système
% Eddie Billoir <lechatp@outlook.fr>
% Août 2025

Expand Down
24 changes: 20 additions & 4 deletions src/sr/finder/api/landlock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{collections::HashMap, path::PathBuf};

use bitflags::bitflags;
use glob::glob;
use landlock::{
Access, AccessFs, BitFlags, PathBeneath, PathFd, Ruleset, RulesetAttr, RulesetCreatedAttr, ABI,
};
Expand Down Expand Up @@ -130,10 +131,25 @@

for (path, access) in whitelist.iter() {
let landlock_access = get_landlock_access(*access);
let path_fd = PathFd::new(path).map_err(|_| SrError::ConfigurationError)?;
ruleset = ruleset
.add_rule(PathBeneath::new(path_fd, landlock_access))
.map_err(|_| SrError::ConfigurationError)?;
match glob(&path.to_string_lossy()) {
Ok(paths) => {
for entry in paths {
if let Ok(p) = entry {
let path_fd =
PathFd::new(p).map_err(|_| SrError::ConfigurationError)?;
ruleset = ruleset
.add_rule(PathBeneath::new(path_fd, landlock_access))
.map_err(|_| SrError::ConfigurationError)?;
}
}

Check warning on line 144 in src/sr/finder/api/landlock.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary `if let` since only the `Ok` variant of the iterator element is used

warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used --> src/sr/finder/api/landlock.rs:136:25 | 136 | / for entry in paths { 137 | | if let Ok(p) = entry { 138 | | let path_fd = 139 | | PathFd::new(p).map_err(|_| SrError::ConfigurationError)?; ... | 144 | | } | |_________________________^ | help: try `.flatten()` and remove the `if let` statement in the for loop --> src/sr/finder/api/landlock.rs:137:29 | 137 | / ... if let Ok(p) = entry { 138 | | ... let path_fd = 139 | | ... PathFd::new(p).map_err(|_| SrError::ConfigurationError)?; 140 | | ... ruleset = ruleset 141 | | ... .add_rule(PathBeneath::new(path_fd, landlock_access)) 142 | | ... .map_err(|_| SrError::ConfigurationError)?; 143 | | ... } | |_______________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#manual_flatten = note: `#[warn(clippy::manual_flatten)]` on by default help: try | 136 ~ for p in paths.flatten() { 137 + let path_fd = 138 + PathFd::new(p).map_err(|_| SrError::ConfigurationError)?; 139 + ruleset = ruleset 140 + .add_rule(PathBeneath::new(path_fd, landlock_access)) 141 + .map_err(|_| SrError::ConfigurationError)?; 142 + } |
}
Err(_) => {
let path_fd = PathFd::new(path).map_err(|_| SrError::ConfigurationError)?;
ruleset = ruleset
.add_rule(PathBeneath::new(path_fd, landlock_access))
.map_err(|_| SrError::ConfigurationError)?;
}
}
}

ruleset
Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "xtask"
# The project version is managed on json file in resources/rootasrole.json
version = "3.3.1"
version = "3.3.2"
edition = "2021"
publish = false

Expand Down
Loading