History log of /freebsd-10.0-release/usr.sbin/cron/lib/entry.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 242101 25-Oct-2012 sobomax

Second attempt to add @every_second keyword support. Due to multiple
requests, default to the previous 60-seconds scheduling method
unless there is any @every_second entries to conserve CPU cycles and
power.

This change also improves scheduling in the default mode by running
as close to the beginning of the minnute as possible by replacing
sleep(3) with nanosleep(2). Previously, the tasks would run anywhere
within the first second of the minute and that offset drifted back
and forth each time cron(8) was engaged.

MFC after: 1 month


# 241672 18-Oct-2012 sobomax

Fully backout latest changes.

Pointy hat to: sobomax


# 241649 17-Oct-2012 sobomax

Revert latest changes to cron, until better version is worked out (I hope).

Requested by: few


# 241618 16-Oct-2012 sobomax

Properly handle non-keyword case by setting e->second to 0.


# 241576 15-Oct-2012 sobomax

Add per-second scheduling into the cron(8). Right now it's
only available via the new @every_second shortcut. ENOTIME to
implement crontab(5) format extensions to allow more flexible
scheduling.

In order to address some concerns expressed by Terry Lambert
while discussing the topic few years ago, about per-second cron
possibly causing some bad effects on /etc/crontab by stat()ing
it every second instead of every minute now (i.e. atime update),
only check that database needs to be reloaded on every 60-th
loop run. This should be close enough to the current behaviour.

Add "@every_minute" shortcut while I am here.

MFC after: 1 month


# 228990 30-Dec-2011 uqs

Spelling fixes for usr.sbin/


# 184809 10-Nov-2008 matteo

Make usr.sbin/cron/crontab and usr.sbin/cron/lib WARNS=3 clean

Tested with: make universe

MFC after: 3 days


# 173412 07-Nov-2007 kevlo

Cleanup of userland __P use


# 170890 17-Jun-2007 yar

Add PAM support to cron(8). Now cron(8) will skip commands scheduled
by unavailable accounts, e.g., those locked, expired, not allowed in at
the moment by nologin(5), or whatever, depending on cron's pam.conf(5).
This applies to personal crontabs only, /etc/crontab is unaffected.

In other words, now the account management policy will apply to
commands scheduled by users via crontab(1) so that a user can no
longer use cron(8) to set up a delayed backdoor and run commands
during periods when the admin doesn't want him to.

The PAM check is done just before running a command, not when loading
a crontab, because accounts can get locked, expired, and re-enabled
any time with no changes to their crontabs. E.g., imagine that you
provide a system with payed access, or better a cluster of such
systems with centralized account management via PAM. When a user
pays for some days of access, you set his expire field respectively.
If the account expires before its owner pays more, its crontab
commands won't run until the next payment is made. Then it'll be
enough to set the expire field in future for the commands to run
again. And so on.

Document this change in the cron(8) manpage, which includes adding
a FILES section and touching the document date.

X-Security: should benefit as users have access to cron(8) by default


# 167328 08-Mar-2007 will

Fix a bug where HOME was not allowed to be overridden by an user's crontab
as crontab(5) states it can be. This is supported by all vixie-cron derived
implementations; not sure why FreeBSD was any different.

PR: bin/106442
MFC after: 2 weeks


# 162666 26-Sep-2006 brian

Behave as documented when reading fields saying "X/Y" where X != *
rather than mis-parsing them as "X".

MFC after: 1 day


# 141915 14-Feb-2005 delphij

Fix parsing of '0' and non-alphanumerics in steps. Previously, an
entry having stepping value of zero can cause crontab to hang there,
and if the main crontab is being changed in this way, then cron(8)
will keep spining.

Obtained from: OpenBSD [src/usr.sbin/cron/entry.c,v 1.17]
PR: 68683 (my own, but forgot to commit it...)
MFC After: 1 week


# 81778 16-Aug-2001 mikeh

Fix the @monthly and @weekly shortcuts so that they actually run
monthly and weekly, respectively. Also fix the @yearly shortcut so
that it doesn't execute daily during January. OpenBSD and NetBSD also
appear to have this bug.

PR: bin/21152


# 79861 18-Jul-2001 dd

Remove an unused variable, and don't try to print a char[] using %d.

Submitted by: Mark Peek <mark@whistle.com>


# 79860 18-Jul-2001 dd

free_entry(): Don't free e->envp if it's already NULL; likewise for
e->cmd. free_entry() now does the right thing with
partially-initialized structures.

load_entry(): Don't call env_free() on e->envp throughout the routine
before jumping to eof; the free_entry() call at that label will take
care of it. The previous behavior resulted in e->envp being free'd
twice (well, the second time would usually result in a crash, but
that's besides the point); once in load_entry(), and once in
free_entry() after the former called the latter. Also note that the
check added to free_entry() (above) doesn't help, since e->envp wasn't
reset to NULL after env_free().

Submitted by: Mark Peek <mark@whistle.com>


# 78156 13-Jun-2001 dd

Plug two memory leaks: call login_close() after login_getclass(), and
use free_entry() instead of free() to free a struct _entry.

PR: 28108
Submitted by: Mark Peek <mark@whistle.com>


# 60825 23-May-2000 ghelmer

Catch and report memory allocation failures.


# 58017 13-Mar-2000 ghelmer

Fix parsing of commands after @ keywords (@hourly, @daily, etc.).
Fix setting of "hour" bitmap when @hourly keyword is specified.

MFC candidate after 4.0-RELEASE.

Problem-found-by: Sheldon Hearn <sheldonh@uunet.co.za>


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 30895 02-Nov-1997 ache

Log run-time parsing errors now

Use getpwnam before getpwuid since two users with same uids can exists
(affects new login classes code only)

The same fixes as in inetd: by default run `system crontab things' with
daemon login class now, not restrict them to user class breaking
compatibility with old way (so-called nobody limits problem)

Implement user[:group][/login-class] syntax in system crontab
for more flexible control (the same as in inetd)


# 29452 15-Sep-1997 charnier

Use err(3). Rewrote man page in mdoc format.


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 10401 28-Aug-1995 mpp

Check for expired passwords before allowing access to the system.


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 7776 12-Apr-1995 ache

Fix home dir cheating


# 2312 27-Aug-1994 jkh

This commit was generated by cvs2svn to compensate for changes in r2311,
which included commits to RCS files with non-trunk default branches.


# 2311 27-Aug-1994 jkh

Paul Vixie's cron, version 3.0. Munged into bmake format. If this goes
well, expect our two seperate directories for cron and crontab to go away
shortly.
Submitted by: jkh