Skip to content

Commit

Permalink
Merge pull request #124 from nc7s/replace-users
Browse files Browse the repository at this point in the history
sec: replace users with uzers, RUSTSEC-2023-0059
  • Loading branch information
kpcyrd authored Dec 13, 2023
2 parents e4c47c7 + 806851f commit e5ac91f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ toml = "0.5"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
users = "0.11"
nix = "0.23"
sha2 = "0.10"
dirs-next = "2.0"
base64 = "0.13"
libc = "0.2"
bstr = "0.2.16"
uzers = "0.11.3"

[target.'cfg(target_os="linux")'.dependencies]
syscallz = "0.16"
Expand Down
18 changes: 9 additions & 9 deletions src/sandbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ pub fn chroot(path: &str) -> Result<()> {

#[cfg(target_os="linux")]
pub fn id() -> String {
let uid = users::get_current_uid();
let euid = users::get_effective_uid();
let gid = users::get_current_gid();
let egid = users::get_effective_gid();
let uid = uzers::get_current_uid();
let euid = uzers::get_effective_uid();
let gid = uzers::get_current_gid();
let egid = uzers::get_effective_gid();
let groups = getgroups().unwrap();

format!(
Expand All @@ -66,10 +66,10 @@ pub fn id() -> String {
// TODO: use the other id function everywhere after nix added getgroups/setgroups support to osx
#[cfg(not(target_os="linux"))]
pub fn id() -> String {
let uid = users::get_current_uid();
let euid = users::get_effective_uid();
let gid = users::get_current_gid();
let egid = users::get_effective_gid();
let uid = uzers::get_current_uid();
let euid = uzers::get_effective_uid();
let gid = uzers::get_current_gid();
let egid = uzers::get_effective_gid();

format!(
"uid={:?} euid={:?} gid={:?} egid={:?}",
Expand All @@ -84,7 +84,7 @@ fn apply_config(config: config::Config) -> Result<()> {
debug!("got config: {:?}", config);

let user = if let Some(user) = config.sandbox.user {
let user = match users::get_user_by_name(&user) {
let user = match uzers::get_user_by_name(&user) {
Some(user) => user,
None => bail!("Invalid sandbox user"),
};
Expand Down

0 comments on commit e5ac91f

Please sign in to comment.