diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 05:44:36 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 05:44:36 +0000 |
commit | 3cfd5c82fb4a8cd553756bb8354ce3b91327726d (patch) | |
tree | f3e55f091971ad16d65095ca73bb935a5963793c /usr.sbin/popa3d/pop_root.c | |
parent | ccea40a793d4d704e3b9ed9dc47d3160081ee0b0 (diff) |
setres[ug]id; ok deraadt@
Diffstat (limited to 'usr.sbin/popa3d/pop_root.c')
-rw-r--r-- | usr.sbin/popa3d/pop_root.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/popa3d/pop_root.c b/usr.sbin/popa3d/pop_root.c index a5db754f84a..972d8a63557 100644 --- a/usr.sbin/popa3d/pop_root.c +++ b/usr.sbin/popa3d/pop_root.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pop_root.c,v 1.4 2005/01/18 19:13:27 otto Exp $ */ +/* $OpenBSD: pop_root.c,v 1.5 2005/05/03 05:44:35 djm Exp $ */ /* * Main daemon code: invokes the actual POP handling routines. Most calls @@ -57,11 +57,12 @@ static int set_user(struct passwd *pw) if (!pw->pw_uid) return 1; groups[0] = groups[1] = pw->pw_gid; - if (setgroups(1, groups)) return log_error("setgroups"); - if (setegid(pw->pw_gid)) return log_error("setegid"); - if (setgid(pw->pw_gid)) return log_error("setgid"); - if (seteuid(pw->pw_uid)) return log_error("seteuid"); - if (setuid(pw->pw_uid)) return log_error("setuid"); + if (setgroups(1, groups)) + return log_error("setgroups"); + if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid)) + return log_error("setresgid"); + if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) + return log_error("setresuid"); return 0; } |