Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix drop_privileges() on Linux
jrmarino committed 9 years ago
commit c05884d9fd45e06aa5305eb1ffb7ad074e36228e
parent ebd5b302656128e105a5ca430839f13d9de2296e
1 file changed +2 -5
modified src/utils.c
@@ -1027,14 +1027,11 @@ drop_privileges(void)
	if (geteuid() == 0) {
		nobody = getpwnam("nobody");
		if (nobody == NULL)
-
			err(EXIT_FAILURE, "Unable to drop priviledges");
+
			err(EXIT_FAILURE, "Unable to drop privileges");
		setgroups(1, &nobody->pw_gid);
-
		if (setegid(nobody->pw_gid) == -1)
-
			err(EXIT_FAILURE, "Unable to setegid");
+
		/* setgid also sets egid and setuid also sets euid */
		if (setgid(nobody->pw_gid) == -1)
			err(EXIT_FAILURE, "Unable to setgid");
-
		if (seteuid(nobody->pw_uid) == -1)
-
			err(EXIT_FAILURE, "Unable to seteuid");
		if (setuid(nobody->pw_uid) == -1)
			err(EXIT_FAILURE, "Unable to setuid");
	}