-
-
Save anonymous/96c6db8851221b2c26c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int trinst_xid_swap(void) | |
{ | |
uid_t ruid, euid; | |
gid_t rgid, egid; | |
// Interchange the real and effective user/group IDs | |
ruid = getuid(); | |
euid = geteuid(); | |
if (setreuid(euid, ruid) != 0) | |
return -errno; | |
rgid = getgid(); | |
egid = getegid(); | |
if (setregid(egid, rgid) != 0) | |
return -errno; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment