summary refs log tree commit diff
path: root/src/chpst.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chpst.c')
-rw-r--r--src/chpst.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/chpst.c b/src/chpst.c
index cbf34eb..3381a3b 100644
--- a/src/chpst.c
+++ b/src/chpst.c
@@ -70,7 +70,8 @@ void suidgid(char *user, unsigned int dogrp) {
     else
       fatalx("unknown account", user);
   }
-  if (prot_gid(ugid.gid) == -1) fatal("unable to setgid");
+  if (setgroups(ugid.gids, ugid.gid) == -1) fatal("unable to setgroups");
+  if (setgid(*ugid.gid) == -1) fatal("unable to setgid");
   if (prot_uid(ugid.uid) == -1) fatal("unable to setuid");
 }
 
@@ -84,7 +85,7 @@ void euidgid(char *user, unsigned int dogrp) {
     else
       fatalx("unknown account", user);
   }
-  bufnum[fmt_ulong(bufnum, ugid.gid)] =0;
+  bufnum[fmt_ulong(bufnum, *ugid.gid)] =0;
   if (! pathexec_env("GID", bufnum)) die_nomem();
   bufnum[fmt_ulong(bufnum, ugid.uid)] =0;
   if (! pathexec_env("UID", bufnum)) die_nomem();