Commit bb71ac34 authored by Alexis Janon's avatar Alexis Janon
Browse files

get ruid and rgid and remove user parameters

The user should not have the right to execute as any user, therefore
this changes the execution back to the real ids.
parent 1924e567
......@@ -23,8 +23,6 @@ pub struct InCommand {
cmd_args: Option<Vec<String>>,
env: Option<HashMap<String, String>>,
args: Option<Vec<String>>,
uid: Option<u32>,
gid: Option<u32>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
......@@ -92,8 +90,6 @@ impl InCommand {
cmd,
&self.cmd_args,
&self.env,
&self.uid,
&self.gid,
Rc::clone(&controllers),
))),
None => Err(Error::from(MISSING_CMD)),
......@@ -110,8 +106,6 @@ impl InCommand {
cmd,
&self.cmd_args,
&self.env,
&self.uid,
&self.gid,
Rc::clone(&controllers),
))),
None => Err(Error::from(MISSING_CMD)),
......@@ -131,8 +125,6 @@ impl InCommand {
cmd,
&self.cmd_args,
&self.env,
&self.uid,
&self.gid,
self.args.clone(),
&self.properties,
Rc::clone(&controllers),
......
use configuration::sysfscontroller::*;
use libc::{getgid, getuid};
use result::*;
use std::collections::HashMap;
use std::os::unix::process::CommandExt;
......@@ -20,8 +21,6 @@ impl Exec {
cmd: &str,
cmd_args: &Option<Vec<String>>,
env: &Option<HashMap<String, String>>,
uid: &Option<u32>,
gid: &Option<u32>,
controllers: Rc<SysFsControllerList>,
) -> Self {
let subcommands = controllers
......@@ -48,14 +47,8 @@ impl Exec {
if let Some(env) = env {
process_cmd.envs(env);
}
// TODO: cleanup
if let Some(uid) = uid.as_ref().cloned() {
process_cmd.uid(uid);
}
// TODO: cleanup
if let Some(gid) = gid.as_ref().cloned() {
process_cmd.gid(gid);
}
process_cmd.uid(unsafe { getuid() });
process_cmd.gid(unsafe { getgid() });
Exec {
name,
list: CommandList::new(subcommands),
......
......@@ -18,14 +18,12 @@ impl ForkExec {
cmd: &str,
cmd_args: &Option<Vec<String>>,
env: &Option<HashMap<String, String>>,
uid: &Option<u32>,
gid: &Option<u32>,
controllers: Rc<SysFsControllerList>,
) -> Self {
ForkExec {
name: name.clone(),
cmd: cmd.to_owned(),
exec: Exec::new(name, cmd, cmd_args, env, uid, gid, controllers),
exec: Exec::new(name, cmd, cmd_args, env, controllers),
}
}
}
......
......@@ -16,8 +16,6 @@ impl Spawn {
cmd: &str,
cmd_args: &Option<Vec<String>>,
env: &Option<HashMap<String, String>>,
uid: &Option<u32>,
gid: &Option<u32>,
args: Option<Vec<String>>,
properties: &Option<HashMap<String, String>>,
controllers: Rc<SysFsControllerList>,
......@@ -39,8 +37,6 @@ impl Spawn {
cmd,
cmd_args,
env,
uid,
gid,
Rc::clone(&controllers),
)));
Spawn {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment