]> andersk Git - openssh.git/blobdiff - uidswap.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / uidswap.c
index 878258704e14fb12fec89f6bc5d6d546b3c5503b..8376483967a9f609f089a1879423ee6b3ea4d4d0 100644 (file)
--- a/uidswap.c
+++ b/uidswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uidswap.c,v 1.34 2006/07/26 02:35:17 stevesk Exp $ */
+/* $OpenBSD: uidswap.c,v 1.35 2006/08/03 03:34:42 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 
 #include "includes.h"
 
-#include <sys/types.h>
 #include <sys/param.h>
-
 #include <errno.h>
 #include <pwd.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdarg.h>
 
 #include <grp.h>
 
@@ -234,6 +233,16 @@ permanently_set_uid(struct passwd *pw)
                fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
 #endif
 
+#ifdef __APPLE__
+       /*
+        * OS X requires initgroups after setgid to opt back into
+        * memberd support for >16 supplemental groups.
+        */
+       if (initgroups(pw->pw_name, pw->pw_gid) < 0)
+               fatal("initgroups %.100s %u: %.100s",
+                   pw->pw_name, (u_int)pw->pw_gid, strerror(errno));
+#endif
+
 #if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID)
        if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
                fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
This page took 0.033638 seconds and 4 git commands to generate.