summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/secure.rs8
1 files changed, 7 insertions, 1 deletions
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<String> {
}
+/// 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
+}