get rid of some (bad) setreuid() calls, which caused a security problem.

bug fix from Rick J Weldon <rick@badboy-jr.hq.af.mil>, and also confirmed
by looking at the latest rdist sources.
This commit is contained in:
cgd 1993-10-09 01:11:39 +00:00
parent 82360f892e
commit 8b2f878d38
1 changed files with 1 additions and 5 deletions

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)server.c 5.15 (Berkeley) 3/1/91";*/
static char rcsid[] = "$Id: server.c,v 1.2 1993/08/01 18:09:40 mycroft Exp $";
static char rcsid[] = "$Id: server.c,v 1.3 1993/10/09 01:11:39 cgd Exp $";
#endif /* not lint */
#include "defs.h"
@ -1062,15 +1062,11 @@ chog(file, owner, group, mode)
gid = -1;
}
ok:
if (userid)
setreuid(userid, 0);
if (chown(file, uid, gid) < 0 ||
(mode & 07000) && chmod(file, mode) < 0) {
note("%s: chown or chmod failed: file %s: %s",
host, file, strerror(errno));
}
if (userid)
setreuid(0, userid);
return(0);
}