mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	Use uzers crate
This commit is contained in:
		| @@ -24,7 +24,7 @@ redact-engine.workspace = true | ||||
| url.workspace = true | ||||
| regex.workspace = true | ||||
| dotenvy_macro.workspace = true | ||||
| users.workspace = true | ||||
| uzers.workspace = true | ||||
|  | ||||
| tauri = { workspace = true, optional = true } | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| use anyhow::bail; | ||||
| use std::{env, ffi::OsStr}; | ||||
| use tokio::process::Command; | ||||
| use users::{os::unix::UserExt, User}; | ||||
| use uzers::{os::unix::UserExt, User}; | ||||
|  | ||||
| pub trait CommandExt { | ||||
|   fn new_pkexec<S: AsRef<OsStr>>(program: S) -> Command; | ||||
| @@ -42,7 +42,7 @@ fn get_non_root_user() -> anyhow::Result<User> { | ||||
|   let user = if current_user == "root" { | ||||
|     get_real_user()? | ||||
|   } else { | ||||
|     users::get_user_by_name(¤t_user) | ||||
|     uzers::get_user_by_name(¤t_user) | ||||
|       .ok_or_else(|| anyhow::anyhow!("User ({}) not found", current_user))? | ||||
|   }; | ||||
|  | ||||
| @@ -60,5 +60,5 @@ fn get_real_user() -> anyhow::Result<User> { | ||||
|     _ => env::var("PKEXEC_UID")?.parse::<u32>()?, | ||||
|   }; | ||||
|  | ||||
|   users::get_user_by_uid(uid).ok_or_else(|| anyhow::anyhow!("User not found")) | ||||
|   uzers::get_user_by_uid(uid).ok_or_else(|| anyhow::anyhow!("User not found")) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user