Skip to content

Commit

Permalink
exec: pass uid and gid in execve()
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Oct 1, 2024
1 parent e9a9681 commit df61df8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sched/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df61df8

Please sign in to comment.