aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-03-14 14:45:30 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-03-14 14:45:30 +0000
commit9efe2eccdd224b1ebaa57613011350edc1859495 (patch)
tree91929cde499b4d2784daa707553bbc5d4d6ffa08 /usr.sbin/cron
parent39da5de262f3f0965c723b747fbf11d7ed0a1ab6 (diff)
downloadsrc-9efe2eccdd224b1ebaa57613011350edc1859495.tar.gz
src-9efe2eccdd224b1ebaa57613011350edc1859495.zip
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.
Notes
Notes: svn path=/head/; revision=23886
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 cc238424d911..7edfe59bc397 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.