setuid before setgid
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4896 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -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",
|
||||
|
Reference in New Issue
Block a user