From 04c32b660dfc90f72644a1eace7774abf72115d9 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Mon, 18 May 1998 18:23:25 +0000 Subject: [PATCH] setuid before setgid git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4896 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/popper/pop_dropcopy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/appl/popper/pop_dropcopy.c b/appl/popper/pop_dropcopy.c index 6cdcc5529..7e3502719 100644 --- a/appl/popper/pop_dropcopy.c +++ b/appl/popper/pop_dropcopy.c @@ -14,14 +14,6 @@ RCSID("$Id$"); int changeuser(POP *p, struct passwd *pwd) { - if(setuid(pwd->pw_uid) < 0) { - pop_log (p, POP_PRIORITY, - "Unable to change to uid %u: %s", - (unsigned)pwd->pw_uid, - strerror(errno)); - return pop_msg (p, POP_FAILURE, - "Unable to change uid"); - } if(setgid(pwd->pw_gid) < 0) { pop_log (p, POP_PRIORITY, "Unable to change to gid %u: %s", @@ -30,6 +22,14 @@ changeuser(POP *p, struct passwd *pwd) return pop_msg (p, POP_FAILURE, "Unable to change gid"); } + if(setuid(pwd->pw_uid) < 0) { + pop_log (p, POP_PRIORITY, + "Unable to change to uid %u: %s", + (unsigned)pwd->pw_uid, + strerror(errno)); + return pop_msg (p, POP_FAILURE, + "Unable to change uid"); + } #ifdef DEBUG if(p->debug) pop_log(p, POP_DEBUG,"uid = %u, gid = %u",