X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/3c33c1b6c80a7bd21d9049470755c641cdfb8862..851d192b680f9b63ec66dd4e1cbf8ffc2baedbb9:/uidswap.c diff --git a/uidswap.c b/uidswap.c index e5b0595a..83764839 100644 --- a/uidswap.c +++ b/uidswap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uidswap.c,v 1.29 2006/06/08 14:45:49 markus Exp $ */ +/* $OpenBSD: uidswap.c,v 1.35 2006/08/03 03:34:42 deraadt Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -14,6 +14,15 @@ #include "includes.h" +#include +#include +#include +#include +#include +#include + +#include + #include "log.h" #include "uidswap.h" #include "xmalloc.h" @@ -224,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));