From df61df8f4ed6a890d09d1d2051fdf3ce2f62029f Mon Sep 17 00:00:00 2001 From: jewelcodes Date: Mon, 30 Sep 2024 21:39:38 -0400 Subject: [PATCH] exec: pass uid and gid in execve() --- src/sched/exec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sched/exec.c b/src/sched/exec.c index 22ccc7c..3a5610b 100644 --- a/src/sched/exec.c +++ b/src/sched/exec.c @@ -117,9 +117,14 @@ int execve(Thread *t, uint16_t id, const char *name, const char **argv, const ch ExecCommand *cmd = calloc(1, sizeof(ExecCommand)); if(!cmd) return -ENOMEM; + Process *p = getProcess(t->pid); + if(!p) return -ESRCH; + cmd->header.header.command = COMMAND_EXEC; cmd->header.header.length = sizeof(ExecCommand); cmd->header.id = id; + cmd->uid = p->user; + cmd->gid = p->group; strcpy(cmd->path, name); int status = requestServer(t, cmd);