Skip to content

Commit

Permalink
Move away from deprecated users to uzers
Browse files Browse the repository at this point in the history
It hasn't been updated in years. Move to the adopted crate `uzers`.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2214223
Related: https://rustsec.org/advisories/RUSTSEC-2023-0040.html
Related: ogham/rust-users#54
  • Loading branch information
jlebon committed Sep 12, 2023
1 parent b042ccb commit 0efb08b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 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 @@ -31,7 +31,7 @@ path = "src/main.rs"
[dependencies]
anyhow = ">= 1.0.38, < 2"
clap = { version = "4", default-features = false, features = ["std", "cargo", "help", "string", "usage"] }
users = ">= 0.10, < 0.12"
uzers = ">= 0.10, < 0.12"

[dev-dependencies]
nix = ">= 0.17, < 0.27"
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Changes:

- Replace deprecated dependency users by uzers


## ssh-key-dir 0.1.4 (2022-09-27)
Expand Down
2 changes: 1 addition & 1 deletion src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::{Path, PathBuf};

use anyhow::{bail, Context, Result};
use users::get_effective_uid;
use uzers::get_effective_uid;

const KEYS_SUBDIR: &str = "authorized_keys.d";

Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use std::io;

use anyhow::{Context, Result};
use clap::{crate_version, value_parser, Arg, Command};
use users::os::unix::UserExt;
use users::switch::{switch_user_group, SwitchUserGuard};
use users::{get_current_username, get_user_by_name, User};
use uzers::os::unix::UserExt;
use uzers::switch::{switch_user_group, SwitchUserGuard};
use uzers::{get_current_username, get_user_by_name, User};

use crate::keys::read_keys;

Expand Down Expand Up @@ -87,7 +87,7 @@ fn main() -> Result<()> {
mod tests {
use super::*;

use users::{get_current_username, get_effective_uid};
use uzers::{get_current_username, get_effective_uid};

fn wrap_switch_user(username: &str) -> Result<User> {
switch_user(&OsString::from(username)).map(|(u, _g)| u)
Expand Down

0 comments on commit 0efb08b

Please sign in to comment.