summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-14 14:45:30 +0000
committerpeter <peter@FreeBSD.org>1997-03-14 14:45:30 +0000
commitda35a9d7c30f12cfb04b5b29e53e66713d2091a7 (patch)
treef91b2819ea23e9f1c8a851d2f4f0d4e8a24dd630 /usr.sbin/cron
parent8abbe02b7ec0bb6e55d1c4ad70ba17bda538e096 (diff)
downloadFreeBSD-src-da35a9d7c30f12cfb04b5b29e53e66713d2091a7.zip
FreeBSD-src-da35a9d7c30f12cfb04b5b29e53e66713d2091a7.tar.gz
Tone down the paranoia a bit in from the previous commit. setusercontext()
automatically Does The Right Thing when lc == NULL, which just happens to be what the extra code in cron was trying to do. Simplify.
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r--usr.sbin/cron/cron/do_command.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c
index cc23842..7edfe59 100644
--- a/usr.sbin/cron/cron/do_command.c
+++ b/usr.sbin/cron/cron/do_command.c
@@ -16,7 +16,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$Id: do_command.c,v 1.10 1997/02/22 16:04:43 peter Exp $";
+static char rcsid[] = "$Id: do_command.c,v 1.11 1997/03/14 13:48:04 peter Exp $";
#endif
@@ -82,7 +82,6 @@ child_process(e, u)
int children = 0;
# if defined(LOGIN_CAP)
struct passwd *pwd;
- login_cap_t *lc;
# endif
Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd))
@@ -224,16 +223,13 @@ child_process(e, u)
* as cron provides a separate interface for this
*/
pwd = getpwuid(e->uid);
- if (pwd)
- lc = login_getclass(pwd);
- else
- lc = NULL;
- if (lc && pwd) {
- setusercontext(lc, pwd, e->uid,
- LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETENV));
- login_close(lc);
- } else {
+ if (pwd &&
+ setusercontext(NULL, pwd, e->uid,
+ LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETENV)) == 0)
+ (void) endpwent();
+ else {
/* fall back to the old method */
+ (void) endpwent();
# endif
/* set our directory, uid and gid. Set gid first,
* since once we set uid, we've lost root privledges.
OpenPOWER on IntegriCloud