History log of /freebsd-10-stable/usr.sbin/cron/lib/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
321242 19-Jul-2017 ngie

MFC r308139,r308157,r308158:

r308139 (by bapt):

cron(8): add support for /etc/cron.d and /usr/local/etc/cron.d

For automation tools it is way easier to maintain files in directories rather
than modifying /etc/crontab.

The files in those directories are in the same format as /etc/crontab

Relnotes: yes

r308157 (by bapt):

Fix typo in cron(8) date

r308158 (by bapt):

Allow symlinks to be followed in cron.d directories and fix detection of
regular files on NFS

320229 22-Jun-2017 ngie

Revert r320222,r320223,r320224

The committed changes (reverted after this commit) break POLA on
a stable branch.

Requested by: jhb

320222 22-Jun-2017 ngie

MFC r308139,r308157,r308160,r316818,r318250,r318443:

r308139 (by bapt):

cron(8): add support for /etc/cron.d and /usr/local/etc/cron.d

For automation tools it is way easier to maintain files in directories rather
than modifying /etc/crontab.

The files in those directories are in the same format as /etc/crontab

Relnotes: yes

r308157 (by bapt):

Fix typo in cron(8) date

r308160 (by bapt):

syslogd(8): add an 'include' keyword

All the '.conf' files not beginning with a '.' contained int he directory
following the keyword will be included.

This keyword can only be used in the first level configuration files.

Modify the default syslogd.conf to 'include' /etc/syslog.d and
/usr/local/etc/syslog.d

It simplify a lot handling of syslog from automation tools.

Relnotes: yes

r316818:

Conditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd

/etc/pam.d/ftp* should be installed with MK_FTP != no and
/etc/pam.d/telnetd should be installed when MK_TELNET != no.

r318250:

Handle the logfiles in newsyslog and syslogd conditionally, based on
src.conf(5) knobs

This will allow consumers of FreeBSD to use the unmodified configuration
files out of the box more than previously.

Both newsyslog.conf and syslog.conf:
- /var/log/lpd-errs (MK_LPR != no)
- /var/log/ppp.log (MK_PPP != no)
- /var/log/xferlog (MK_FTP != no)

newsyslog.conf:
- /var/log/amd.log (MK_AMD != no)
- /var/log/pflog (MK_PF != no)
- /var/log/sendmail.st (MK_SENDMAIL != no)

r318443:

Conditionally handle the crontab entry for atrun(8)

The default crontab prior to this commit assumes atrun(8) is always
present, which isn't true if MK_AT == no. Move atrun(8) execution
from /etc/crontab to /etc/cron.d/at, and base /etc/cron.d/at's installation
on MK_AT. cron(8) will detect /etc/cron.d/at's presence when the configuration
is loaded and run atrun every 5 minutes like it would prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
set in the current default /etc/crontab.

Noted by: bdrewery (in an internal review)
Relnotes: yes (may need to add environmental modifications to
/etc/cron.d/at)

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


241125 02-Oct-2012 pluknet

Fix build with LOG_FILE undefined and DEBUGGING disabled.


228990 30-Dec-2011 uqs

Spelling fixes for usr.sbin/


185043 18-Nov-2008 matteo

remove a pointless prototype and static-fy the corresponding function

MFC after: 3 days


185042 18-Nov-2008 matteo

use WARNS?= instead of WARNS=

MFC after: 3 days


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


149430 24-Aug-2005 pjd

Use pidfile(3) in cron(8).

Note, that when cron(8) cannot create pidfile, it'll exit. I didn't
changed this behaviour, but its better to ignore errors other than
EEXIST, so daemon can be started on systems where /var/ file system
doesn't support locking (like NFS without rpc.lockd(8)).


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


141571 09-Feb-2005 stefanf

Properly initialise the variable `deny'.


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


110638 10-Feb-2003 thomas

Allow inner whitespace in the right-hand side of an environment variable
assignment even if it is not quoted (as advertised by the man page).
This fixes a regression wrt RELENG_4 introduced in rev. 1.11.

Problem noted and patch tested by: CHOI Junho <cjh@kr.FreeBSD.org>
Reviewed by: roberto


101293 04-Aug-2002 tjr

Never allow a user to use crontab if opening /var/cron/{allow,deny} fails
for any reason other than ENOENT (think resource limits). Close allow and
deny files before allowed() returns to stop the user's EDITOR being able to
read them.

Obtained from: OpenBSD (partially)


97165 23-May-2002 roberto

load_env(), the function that attempts to parse a crontab
line as an environment variable assignment, is broken
and not conformant to its description in the manual page.

I think it is worthwhile to have that fix in 4.6.

PR: bin/38374
Submitted by: Thomas Quinot <thomas@cuivre.fr.eu.org>
MFC after: 2 days


96514 13-May-2002 ru

Mark all internal libraries with INTERNALLIB.


94389 10-Apr-2002 dwmalone

Only remove the '\n' at the end of a line if there is one.
I missed this as part of the fix to the PR below.

PR: 31265
Submitted by: Matthew D. Fuller <fullermd@over-yonder.net>
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


80030 20-Jul-2001 davidn

Fix a possible NULL reference that would be triggered
by invalid input in /etc/crontab.

MFC after: 2 days


80029 20-Jul-2001 obrien

Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.


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>


69793 09-Dec-2000 obrien

Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.


60825 23-May-2000 ghelmer

Catch and report memory allocation failures.


59785 30-Apr-2000 ghelmer

Allocate space for arrays of type "char *", not "char **".
Rev 1.8 made the type consistently incorrect.

Noted by: Ben Smithurst <ben@scientia.demon.co.uk>


59727 28-Apr-2000 ghelmer

Fix a situation where a pointer which should point to dynamically
allocated memory was instead pointed to a static string. A later
free() on the value of the pointer was a possible source of reported
"warning: pointer to wrong page" messages from cron.

Use consistent types in sizeof when malloc'ing memory for the
environment.

PR: kern/12248, bin/11169, bin/9722


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 28-Aug-1999 peter

$Id$ -> $FreeBSD$


42711 16-Jan-1999 danny

y2k nit: print 4 digit years correctly.
PR: 9506
Submitted by: Peter Jeremy <peter.jeremy@alcatel.com.au>


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.


27040 29-Jun-1997 pst

NOSHARED takes a yes/YES no/NO value, not "true, false, hey mon!".
NOPIC is used to not generate a shared library, not NOSHARED.
Make NOSHARED advisory where appropriate.
Remove bogus NOSHARED (kbdio).


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.


20573 17-Dec-1996 pst

Replace my "inane" usage of snprintf to copy strings with strncpy as
used by OpenBSD. (Quite frankly, I think it's perfectly reasonable to
use snprintf to copy strings, given that the semantics for strncpy()
are utterly idiotic and there is no POSIX sstrncpy().)

While I'm at it, incorporate some of OpenBSD's bugfixes to cron.

NOT for 2.2


20557 16-Dec-1996 pst

Close yet another buffer overrun


10401 28-Aug-1995 mpp

Check for expired passwords before allowing access to the system.


8857 30-May-1995 rgrimes

Remove trailing whitespace.


8164 29-Apr-1995 ache

Fix typo in HAVE_SAVED_UIDS define


7776 12-Apr-1995 ache

Fix home dir cheating


2329 28-Aug-1994 jkh

Prevent installation.
Submitted by: jkh


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.