From f528a215f5effb748c04ee7f646f3ac0b34a8d29 Mon Sep 17 00:00:00 2001 From: tylermurphy534 Date: Thu, 10 Nov 2022 19:23:21 -0500 Subject: [PATCH] add doc string for elevate_privlages --- src/secure.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/secure.rs b/src/secure.rs index 352e02b..13d67b0 100644 --- a/src/secure.rs +++ b/src/secure.rs @@ -40,6 +40,12 @@ pub fn read_file(dir: &str, file: &str) -> Option { } +/// Ekevate tge oruvukages if the current process +/// #### Arguments +/// * `uid` - The uid to set the process to +/// * `gid` - The gid to set the process to +/// #### Returns +/// If the process failes to elevate, it returns false pub fn elevate_privilages(uid: u32, gid: u32) -> bool { if unistd::setuid(Uid::from(uid)).is_err() { return false; @@ -92,4 +98,4 @@ fn check_file_permissions(uid: u32, gid: u32, mode: u32, path: &str) -> bool { /// Get the path of a file given a directory and file name fn path(dir: &str, file: &str) -> String { return format!("{}/{}.persist", dir, file); -} \ No newline at end of file +}