Merge pull request #36 from fischerling/implement-id-separation

Implement user and group ID separation
This commit is contained in:
Enrico Fraccaroli
2024-02-29 13:58:04 -05:00
committed by GitHub
15 changed files with 211 additions and 43 deletions
+2 -2
View File
@@ -37,10 +37,10 @@ typedef unsigned int ino_t;
typedef unsigned int dev_t;
/// The type of user-id.
typedef unsigned int uid_t;
typedef int uid_t;
/// The type of group-id.
typedef unsigned int gid_t;
typedef int gid_t;
/// The type of offset.
typedef long int off_t;
+29 -7
View File
@@ -106,26 +106,48 @@ pid_t getpgid(pid_t pid);
/// @return returns zero. On error, -1 is returned, and errno is set appropriately.
int setpgid(pid_t pid, pid_t pgid);
///@brief returns the group ID of the calling process.
///@brief returns the real group ID of the calling process.
///@return GID of the current process
extern pid_t getgid(void);
extern gid_t getgid(void);
///@brief sets the effective group ID of the calling process.
///@param pid process identifier to
///@brief returns the effective group ID of the calling process.
///@return GID of the current process
extern gid_t getegid(void);
///@brief sets the group IDs of the calling process.
///@param gid the Group ID to set
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
extern int setgid(pid_t pid);
extern int setgid(gid_t gid);
///@brief Returns the User ID of the calling process.
///@brief sets the real and effective group IDs of the calling process.
///@param rgid the new real Group ID.
///@param egid the effective real Group ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set EPERM
extern int setregid(gid_t rgid, gid_t egid);
///@brief Returns the real User ID of the calling process.
///@return User ID of the current process.
extern uid_t getuid(void);
///@brief Sets the effective User ID of the calling process.
///@brief Returns the effective User ID of the calling process.
///@return User ID of the current process.
extern uid_t geteuid(void);
///@brief Sets the User IDs of the calling process.
///@param uid the new User ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
extern int setuid(uid_t uid);
///@brief Sets the effective and real User IDs of the calling process.
///@param ruid the new real User ID.
///@param euid the effective real User ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to EPERM
extern int setreuid(uid_t ruid, uid_t euid);
/// @brief Returns the parent process ID (PPID) of the calling process.
/// @return pid_t parent process identifier.
extern pid_t getppid(void);
+1
View File
@@ -8,3 +8,4 @@
#include "system/syscall_types.h"
_syscall0(pid_t, getgid)
_syscall0(gid_t, getegid)
+1
View File
@@ -8,3 +8,4 @@
#include "system/syscall_types.h"
_syscall0(uid_t, getuid)
_syscall0(uid_t, geteuid)
+1
View File
@@ -8,3 +8,4 @@
#include "system/syscall_types.h"
_syscall1(int, setgid, pid_t, pid)
_syscall2(int, setregid, gid_t, rgid, gid_t, egid)
+1
View File
@@ -8,3 +8,4 @@
#include "system/syscall_types.h"
_syscall1(int, setuid, uid_t, pid)
_syscall2(int, setreuid, uid_t, ruid, uid_t, euid)