summaryrefslogtreecommitdiff
path: root/uidswap.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-27 02:10:15 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-27 02:10:15 +0000
commit0f85348e899fd2243c833d078a5106de5531678e (patch)
treee2c007b03a064d79e60a83c2e1f0274e102b87d6 /uidswap.c
parent26f33893a60f712b3a6fb572cde6538bfe5ce394 (diff)
- (bal) Cygwin lacks setgroups() API. Patch by Corinna Vinschen
<vinschen@redhat.com>
Diffstat (limited to 'uidswap.c')
-rw-r--r--uidswap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/uidswap.c b/uidswap.c
index 2c43877d..3b264cf9 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -80,9 +80,11 @@ temporarily_use_uid(struct passwd *pw)
if (user_groupslen < 0)
fatal("getgroups: %.100s", strerror(errno));
}
+#ifndef HAVE_CYGWIN
/* Set the effective uid to the given (unprivileged) uid. */
if (setgroups(user_groupslen, user_groups) < 0)
fatal("setgroups: %.100s", strerror(errno));
+#endif /* !HAVE_CYWIN */
#ifndef SAVED_IDS_WORK_WITH_SETEUID
/* Propagate the privileged gid to all of our gids. */
if (setgid(getegid()) < 0)
@@ -130,8 +132,10 @@ restore_uid(void)
setgid(getgid());
#endif /* SAVED_IDS_WORK_WITH_SETEUID */
+#ifndef HAVE_CYGWIN
if (setgroups(saved_egroupslen, saved_egroups) < 0)
fatal("setgroups: %.100s", strerror(errno));
+#endif /* !HAVE_CYGWIN */
temporarily_use_uid_effective = 0;
}