From 0efb08b18f0edb4e3654537a3b6bce4b01c35216 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 12 Sep 2023 09:54:55 -0400 Subject: [PATCH] Move away from deprecated `users` to `uzers` 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: https://github.com/ogham/rust-users/issues/54 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- docs/release-notes.md | 1 + src/keys.rs | 2 +- src/main.rs | 8 ++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dddf310..8e2a55a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -177,7 +177,7 @@ dependencies = [ "clap", "nix", "tempfile", - "users", + "uzers", ] [[package]] @@ -200,10 +200,10 @@ dependencies = [ ] [[package]] -name = "users" -version = "0.11.0" +name = "uzers" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" +checksum = "76d283dc7e8c901e79e32d077866eaf599156cbf427fffa8289aecc52c5c3f63" dependencies = [ "libc", "log", diff --git a/Cargo.toml b/Cargo.toml index cae2968..ec975d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/docs/release-notes.md b/docs/release-notes.md index d04a9e9..12fb32a 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ Changes: +- Replace deprecated dependency users by uzers ## ssh-key-dir 0.1.4 (2022-09-27) diff --git a/src/keys.rs b/src/keys.rs index d5535dc..7d83a63 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -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"; diff --git a/src/main.rs b/src/main.rs index 7391ca9..a095020 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; @@ -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 { switch_user(&OsString::from(username)).map(|(u, _g)| u)