changeset 9182:62b9661b4c7a HEAD

dump-capability: Use nobody's group as process gid.
author Timo Sirainen <tss@iki.fi>
date Tue, 30 Jun 2009 11:03:30 -0400
parents c2f6983a46c6
children 1e47487e482b
files src/master/master-settings.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/master-settings.c	Mon Jun 29 12:37:10 2009 -0400
+++ b/src/master/master-settings.c	Tue Jun 30 11:03:30 2009 -0400
@@ -686,14 +686,13 @@
 		/* try to use some existing user. at least osx launchd
 		   doesn't like non-existing users. */
 		struct passwd *pw;
-		struct group *gr;
 
 		pw = getpwnam("nobody");
-		if (pw != NULL)
+		if (pw != NULL && pw->pw_uid != (uid_t)-1 &&
+		    pw->pw_gid != (gid_t)-1) {
 			args[0] = t_strdup_printf("uid=%s", dec2str(pw->pw_uid));
-		gr = getgrnam("nogroup");
-		if (gr != NULL)
-			args[1] = t_strdup_printf("gid=%s", dec2str(gr->gr_gid));
+			args[1] = t_strdup_printf("gid=%s", dec2str(pw->pw_gid));
+		}
 	}
 
 	if (pipe(fd) < 0) {