move REDUCE_PRIV [always remain uid0] to after when "infile" specified by

"at -f file" so that opening this file is done with the users uid, not 0.
problem noted in PR#5658 from Wolfgang Rupprecht <wolfgang@wsrcc.com>.
This commit is contained in:
mrg 1998-06-26 07:04:00 +00:00
parent 3f90953b05
commit e1a1cc165d
1 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: at.c,v 1.8 1998/03/30 02:19:02 mrg Exp $ */
/* $NetBSD: at.c,v 1.9 1998/06/26 07:04:00 mrg Exp $ */
/*
* at.c : Put file into atrun queue
@ -64,7 +64,7 @@
/* File scope variables */
#ifndef lint
__RCSID("$NetBSD: at.c,v 1.8 1998/03/30 02:19:02 mrg Exp $");
__RCSID("$NetBSD: at.c,v 1.9 1998/06/26 07:04:00 mrg Exp $");
#endif
char *no_export[] =
@ -248,13 +248,6 @@ writefile(runtimer, queue)
PRIV_END
/*
* We no longer need suid root; now we just need to be able to
* write to the directory, if necessary.
*/
REDUCE_PRIV(effective_uid);
/*
* We've successfully created the file; let's set the flag so it
* gets removed in case of an interrupt or error.
@ -292,6 +285,14 @@ writefile(runtimer, queue)
if (fpin == NULL)
perr("Cannot open input file");
}
/*
* We no longer need suid root; now we just need to be able to
* write to the directory, if necessary.
*/
REDUCE_PRIV(effective_uid);
fprintf(fp, "#! /bin/sh\n# mail %8s %d\n", mailname, send_mail);
/* Write out the umask at the time of invocation */