mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:57:44 +00:00
Kernel+LibC: Implement seteuid() and friends!
Add seteuid()/setegid() under _POSIX_SAVED_IDS semantics, which also requires adding suid and sgid to Process, and changing setuid()/setgid() to honor these semantics. The exact semantics aren't specified by POSIX and differ between different Unix implementations. This patch makes serenity follow FreeBSD. The 2002 USENIX paper "Setuid Demystified" explains the differences well. In addition to seteuid() and setegid() this also adds setreuid()/setregid() and setresuid()/setresgid(), and the accessors getresuid()/getresgid(). Also reorder uid/euid functions so that they are the same order everywhere (namely, the order that geteuid()/getuid() already have).
This commit is contained in:
parent
0001bbf182
commit
a38754d9f2
5 changed files with 251 additions and 26 deletions
|
@ -84,10 +84,18 @@ uid_t getuid();
|
|||
gid_t getgid();
|
||||
pid_t getpid();
|
||||
pid_t getppid();
|
||||
int getresuid(uid_t *, uid_t *, uid_t *);
|
||||
int getresgid(gid_t *, gid_t *, gid_t *);
|
||||
int getgroups(int size, gid_t list[]);
|
||||
int setgroups(size_t, const gid_t*);
|
||||
int seteuid(uid_t);
|
||||
int setegid(gid_t);
|
||||
int setuid(uid_t);
|
||||
int setgid(gid_t);
|
||||
int setreuid(uid_t, uid_t);
|
||||
int setregid(gid_t, gid_t);
|
||||
int setresuid(uid_t, uid_t, uid_t);
|
||||
int setresgid(gid_t, gid_t, gid_t);
|
||||
pid_t tcgetpgrp(int fd);
|
||||
int tcsetpgrp(int fd, pid_t pgid);
|
||||
ssize_t read(int fd, void* buf, size_t count);
|
||||
|
@ -157,6 +165,8 @@ enum {
|
|||
#define MS_RDONLY (1 << 4)
|
||||
#define MS_REMOUNT (1 << 5)
|
||||
|
||||
#define _POSIX_SAVED_IDS
|
||||
|
||||
/*
|
||||
* We aren't fully compliant (don't support policies, and don't have a wide
|
||||
* range of values), but we do have process priorities.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue