History log of /freebsd-10.0-release/usr.sbin/cron/crontab/crontab.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


# 239991 01-Sep-2012 ed

Rework all non-contributed files that use `struct timezone'.

This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.


# 238024 02-Jul-2012 jhb

Add a one second sleep before touching the spool directory. If the touch
occurs in the same second as the earlier operations to create the temporary
file and the cron(8) daemon is rescans the spool directory during that
second, then the daemon may miss a cron edit and not properly update its
internal database.

MFC after: 1 month


# 232202 27-Feb-2012 delphij

Drop setuid status while doing file operations to prevent potential
information leak. This changeset is intended to be a minimal one
to make backports easier.

Reviewed by: kevlo, remko
MFC after: 1 week


# 185041 17-Nov-2008 matteo

Be more precise and use sizeof(tn)
Pointed out by: glewis@

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


# 184784 09-Nov-2008 matteo

Revert to previous revision.
I should not commit anything at 3.50 AM.
In addition to danfe's comments, I got others.
I'll work on a better version of the patch.


# 184780 09-Nov-2008 matteo

Don't leave files in /var/cront/tabs when interrupted

PR: 17363
MFC after: 3 days


# 184779 09-Nov-2008 matteo

Be paranoid and use snprintf

PR: bin/122137
Submitted by: Steven Kreuzer <skreuzer@exit2shell.com>
MFC after: 3 days


# 184706 06-Nov-2008 matteo

Be paranoid and zero out passwd

PR: 122070
Submitted by: Steven Kreuzer <skreuzer@exit2shell.com>
Reminded by: gnn@
MFC after: 3 days


# 173412 07-Nov-2007 kevlo

Cleanup of userland __P use


# 161964 03-Sep-2006 ru

Use a #define to refer to /etc/crontab.


# 154166 10-Jan-2006 brooks

/etc/crontab is similar enough to parse as correct if you run
"crontab /etc/crontab", but not the same format due to the who field.
Add some limited anti-foot-shooting support and refuse to load
/etc/crontab as someone's crontab. Users wishing shoot their foot in
this manner may copy /etc/crontab elsewhere. :)

MFC After: 1 week


# 135242 14-Sep-2004 dds

Ensure that edits that do not span a clock tick are not lost.

PR: bin/22612
MT5: 4 weeks
MT4: 2 weeks


# 135174 13-Sep-2004 dds

Refactoring: move two similar code blocks into a seprate function.


# 135165 13-Sep-2004 dds

Fix for the following behavior:
$ crontab -e
[Add an entry with an error in the crontab file.]
crontab: errors in crontab file, can't install
Do you want to retry the same edit? yes
[Exit the editor without any changes.]
crontab: no changes made to crontab
[Entry is lost.]

Now crontab will loop until the error is fixed, or the
user answers no.


# 104326 01-Oct-2002 dd

Actually use the exitstatus value that we maintain.

PR: 43562
Submitted by: Marc Olzheim <marcolz@ilse.nl>


# 79452 09-Jul-2001 brian

Fix the type of the NULL arg to execl()

Idea from: Theo de Raadt <deraadt@openbsd.org>


# 78321 16-Jun-2001 peter

Where is the pointy hat? Fix cut/paste error. (hey, it compiled! :-)


# 75456 12-Apr-2001 peter

Remove the 'DO NOT EDIT THIS FILE' crud that we spit out with 'crontab -l'.
Otherwise, "crontab -l > file; vi file; crontab file" adds an extra set
of "DO NOT EDIT" markers each and every time which is a bit silly.


# 69793 09-Dec-2000 obrien

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


# 68388 06-Nov-2000 dwmalone

Attempt to fix problem with users being able to convince the crontab
program to read any file which is a valid crontab file.

The fix is based on that used in NetBSD and OpenBSD - we keep the
file open while the user is editing it. This means that files must
be edited in place. Cron attempts to warn you if your editor does
not do this. The fact that the file must be edited in place is also
noted in the man page.

This patch has been confirmed to work by atleast one person on
-security and has been tested locally.

Obtained from: OpenBSD


# 67127 14-Oct-2000 paul

Since -e and -r are right next to each other prompt before clobbering
a crontab you were planning to edit.


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 29452 15-Sep-1997 charnier

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


# 24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 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 16-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


# 17439 04-Aug-1996 pst

Gratuitous whitespace change so that I can commit the source of the recent
buffer overflow patch.
Reviewed by: pst
Submitted by: Dave Andersen <angio@aros.net>


# 17436 04-Aug-1996 pst

Fix up some more buffer overflow problems.


# 15161 09-Apr-1996 scrappy

Quick patch to fix a bug where issuing ctl-c while in crontab -e
leaves editor running in background (PR: bin/751)

Submitted by: candy@fct.kgc.co.jp (Toshihiro Kanda)


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 5176 21-Dec-1994 ache

Now crontab works not only for vi editor, i.e. refers to
file name not to file fd


# 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