From ccae9c0b0abb9b6d2708655bdd4ef2f25be42d67 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 10 Jan 2017 09:50:23 -0700 Subject: [PATCH] Correctly set environment --- src/bin/su.rs | 3 +++ src/bin/sudo.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/bin/su.rs b/src/bin/su.rs index 87a540f3b1..3b6cd7897d 100644 --- a/src/bin/su.rs +++ b/src/bin/su.rs @@ -64,7 +64,10 @@ pub fn main() { command.gid(passwd.gid); command.env("USER", &user); + command.env("UID", format!("{}", passwd.uid)); + command.env("GROUPS", format!("{}", passwd.gid)); command.env("HOME", passwd.home); + command.env("SHELL", passwd.shell); match command.spawn() { Ok(mut child) => match child.wait() { diff --git a/src/bin/sudo.rs b/src/bin/sudo.rs index 471a574b5e..0e8a0636ca 100644 --- a/src/bin/sudo.rs +++ b/src/bin/sudo.rs @@ -57,6 +57,8 @@ pub fn main() { command.uid(0); command.gid(0); command.env("USER", "root"); + command.env("UID", "0"); + command.env("GROUPS", "0"); match command.spawn() { Ok(mut child) => match child.wait() {