Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix drop_privileges() on Linux
jrmarino committed 8 years ago
commit c05884d9fd45e06aa5305eb1ffb7ad074e36228e
parent ebd5b30
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");
	}