History log of /openbsd-current/usr.sbin/cron/user.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.22 16-Apr-2020 millert

Add a mechanism to prevent cron jobs from running concurrently.
This adds a new "-s" flag to the command field which indicates that
only a single instance of the job should run concurrenty.
OK beck@ job@ deraadt@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.21 05-Feb-2018 millert

Pass a FILE * instead of a file descriptor into load_user() and
perform the fclose() in process_crontab(). Previously we were
closing the crontab fd twice--once in load_user() via fclose() and
once in process_crontab(). OK tb@


Revision tags: OPENBSD_6_2_BASE
# 1.20 07-Jun-2017 millert

In cron(8), require that crontab and at files in the spool be owned
by group crontab. The at(1) command now creates files owned by
group crontab, the crontab(1) command already does this.

Files in the crontab spool with parse errors are now ignored;
crontab(1) will not install a crontab file with parse errors.
The system crontab file (/etc/crontab) is not affected by this.

The required permissions on crontab files have been tightened.
Files in the cron spool must be mode 0600 (as created by crontab(1)).
The system crontab file may be readable/writable by the owner,
readable by group and readable by other. The system crontab must
be readable by the owner.


Revision tags: OPENBSD_6_1_BASE
# 1.19 30-Aug-2016 millert

Fix fd leak on error. OK jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 15-Nov-2015 millert

Clean up the remaining uses of stderr and perror() and use warn/err
and/or syslog depending on whether stderr is hooked up at the time.
Also remove closelog() which is not needed since we are headed for exec.
OK guenther@


# 1.17 09-Nov-2015 millert

queue(3) instead of homegrown queues and lists. This also fixes
some potential memory leaks in error paths. OK guenther@


# 1.16 04-Nov-2015 millert

Change cron from including all headers in every file to only including
what each .c file needs. I have not removed cron.h since it will
be used in a future clean up of the cron's .h files. OK nicm@


# 1.15 06-Oct-2015 tedu

clear out some more legacy code and whatnot


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.14 09-Feb-2015 deraadt

correct copyright, upon approval from paul vixie via todd miller. the
head copyright assertion was seperated from the remaining ones.


# 1.13 23-Jan-2015 tedu

braces to open a function go on their own line like god intended


# 1.12 23-Jan-2015 tedu

delete some code that doesn't (and shouldn't) run. ok deraadt millert


# 1.11 23-Jan-2015 tedu

Remove the OK and ERR macros. They obfuscate the code and don't
help legibility. (unix system calls use 0 for ok, but hundreds of
other projects use 1 to indicate success.) Despite the name, many
system calls (e.g., open) also return not OK values for success.
It also cleans up some weird code like int crontab_fd = OK - 1;
This diff is mechanical in nature. Later I will fix the bugs it reveals.
ok deraadt


# 1.10 23-Jan-2015 tedu

remove debug code.
I think the level of debug code in cron is excessive for a program
that has reached feature complete. If cron needs to provide more
information to the user about its operational status, I think syslog
would be more appropriate. (The debug flags also disable forking
into the background, so they aren't even that useful for debugging a
live system.)
ok deraadt millert


# 1.9 22-Jan-2015 tedu

delete useless casts. ok deraadt guenther millert


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.8 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.7 17-Jun-2004 millert

UUpdate ISC copyright year to 2004
Remove unused macros Skip_Line and MkLower
Remove trailing whitespace


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.6 20-Feb-2003 millert

Sync with ISC cron-current + my at(1) integration.
The at(1) code is now more tightly integrated into the cron codebase.


Revision tags: OPENBSD_3_2_BASE
# 1.5 11-Jul-2002 millert

More syncing with my cron 4.0 patch tree, basically cosmetic:
o change an instance of e_none to e_memory that I missed (forgot?)
o kill some whitespace
o modify malloc failure recovery a bit


# 1.4 08-Jul-2002 millert

Merge in some changes from Paul Vixie's tree; most are cosmetic
o ANSI function headers
o return (foo) not return foo
o add -oi to sendmail flags
o update email address in man pages
o make some strings const
o completely remove globbing cruft from popen.c
o whitespace changes
o add DOW_STAR to flags for "monthly", "weekly", and "daily" cron entries


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.3 18-Feb-2001 millert

Update to ISC cron 4.0b1 + our patches. This is now under a BSD license.
I also fixed the signal handlers while I was at it.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.2 01-Nov-1996 millert

Check malloc/strdup ret val and deal.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.21 05-Feb-2018 millert

Pass a FILE * instead of a file descriptor into load_user() and
perform the fclose() in process_crontab(). Previously we were
closing the crontab fd twice--once in load_user() via fclose() and
once in process_crontab(). OK tb@


Revision tags: OPENBSD_6_2_BASE
# 1.20 07-Jun-2017 millert

In cron(8), require that crontab and at files in the spool be owned
by group crontab. The at(1) command now creates files owned by
group crontab, the crontab(1) command already does this.

Files in the crontab spool with parse errors are now ignored;
crontab(1) will not install a crontab file with parse errors.
The system crontab file (/etc/crontab) is not affected by this.

The required permissions on crontab files have been tightened.
Files in the cron spool must be mode 0600 (as created by crontab(1)).
The system crontab file may be readable/writable by the owner,
readable by group and readable by other. The system crontab must
be readable by the owner.


Revision tags: OPENBSD_6_1_BASE
# 1.19 30-Aug-2016 millert

Fix fd leak on error. OK jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 15-Nov-2015 millert

Clean up the remaining uses of stderr and perror() and use warn/err
and/or syslog depending on whether stderr is hooked up at the time.
Also remove closelog() which is not needed since we are headed for exec.
OK guenther@


# 1.17 09-Nov-2015 millert

queue(3) instead of homegrown queues and lists. This also fixes
some potential memory leaks in error paths. OK guenther@


# 1.16 04-Nov-2015 millert

Change cron from including all headers in every file to only including
what each .c file needs. I have not removed cron.h since it will
be used in a future clean up of the cron's .h files. OK nicm@


# 1.15 06-Oct-2015 tedu

clear out some more legacy code and whatnot


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.14 09-Feb-2015 deraadt

correct copyright, upon approval from paul vixie via todd miller. the
head copyright assertion was seperated from the remaining ones.


# 1.13 23-Jan-2015 tedu

braces to open a function go on their own line like god intended


# 1.12 23-Jan-2015 tedu

delete some code that doesn't (and shouldn't) run. ok deraadt millert


# 1.11 23-Jan-2015 tedu

Remove the OK and ERR macros. They obfuscate the code and don't
help legibility. (unix system calls use 0 for ok, but hundreds of
other projects use 1 to indicate success.) Despite the name, many
system calls (e.g., open) also return not OK values for success.
It also cleans up some weird code like int crontab_fd = OK - 1;
This diff is mechanical in nature. Later I will fix the bugs it reveals.
ok deraadt


# 1.10 23-Jan-2015 tedu

remove debug code.
I think the level of debug code in cron is excessive for a program
that has reached feature complete. If cron needs to provide more
information to the user about its operational status, I think syslog
would be more appropriate. (The debug flags also disable forking
into the background, so they aren't even that useful for debugging a
live system.)
ok deraadt millert


# 1.9 22-Jan-2015 tedu

delete useless casts. ok deraadt guenther millert


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.8 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.7 17-Jun-2004 millert

UUpdate ISC copyright year to 2004
Remove unused macros Skip_Line and MkLower
Remove trailing whitespace


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.6 20-Feb-2003 millert

Sync with ISC cron-current + my at(1) integration.
The at(1) code is now more tightly integrated into the cron codebase.


Revision tags: OPENBSD_3_2_BASE
# 1.5 11-Jul-2002 millert

More syncing with my cron 4.0 patch tree, basically cosmetic:
o change an instance of e_none to e_memory that I missed (forgot?)
o kill some whitespace
o modify malloc failure recovery a bit


# 1.4 08-Jul-2002 millert

Merge in some changes from Paul Vixie's tree; most are cosmetic
o ANSI function headers
o return (foo) not return foo
o add -oi to sendmail flags
o update email address in man pages
o make some strings const
o completely remove globbing cruft from popen.c
o whitespace changes
o add DOW_STAR to flags for "monthly", "weekly", and "daily" cron entries


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.3 18-Feb-2001 millert

Update to ISC cron 4.0b1 + our patches. This is now under a BSD license.
I also fixed the signal handlers while I was at it.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.2 01-Nov-1996 millert

Check malloc/strdup ret val and deal.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.20 07-Jun-2017 millert

In cron(8), require that crontab and at files in the spool be owned
by group crontab. The at(1) command now creates files owned by
group crontab, the crontab(1) command already does this.

Files in the crontab spool with parse errors are now ignored;
crontab(1) will not install a crontab file with parse errors.
The system crontab file (/etc/crontab) is not affected by this.

The required permissions on crontab files have been tightened.
Files in the cron spool must be mode 0600 (as created by crontab(1)).
The system crontab file may be readable/writable by the owner,
readable by group and readable by other. The system crontab must
be readable by the owner.


Revision tags: OPENBSD_6_1_BASE
# 1.19 30-Aug-2016 millert

Fix fd leak on error. OK jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 15-Nov-2015 millert

Clean up the remaining uses of stderr and perror() and use warn/err
and/or syslog depending on whether stderr is hooked up at the time.
Also remove closelog() which is not needed since we are headed for exec.
OK guenther@


# 1.17 09-Nov-2015 millert

queue(3) instead of homegrown queues and lists. This also fixes
some potential memory leaks in error paths. OK guenther@


# 1.16 04-Nov-2015 millert

Change cron from including all headers in every file to only including
what each .c file needs. I have not removed cron.h since it will
be used in a future clean up of the cron's .h files. OK nicm@


# 1.15 06-Oct-2015 tedu

clear out some more legacy code and whatnot


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.14 09-Feb-2015 deraadt

correct copyright, upon approval from paul vixie via todd miller. the
head copyright assertion was seperated from the remaining ones.


# 1.13 23-Jan-2015 tedu

braces to open a function go on their own line like god intended


# 1.12 23-Jan-2015 tedu

delete some code that doesn't (and shouldn't) run. ok deraadt millert


# 1.11 23-Jan-2015 tedu

Remove the OK and ERR macros. They obfuscate the code and don't
help legibility. (unix system calls use 0 for ok, but hundreds of
other projects use 1 to indicate success.) Despite the name, many
system calls (e.g., open) also return not OK values for success.
It also cleans up some weird code like int crontab_fd = OK - 1;
This diff is mechanical in nature. Later I will fix the bugs it reveals.
ok deraadt


# 1.10 23-Jan-2015 tedu

remove debug code.
I think the level of debug code in cron is excessive for a program
that has reached feature complete. If cron needs to provide more
information to the user about its operational status, I think syslog
would be more appropriate. (The debug flags also disable forking
into the background, so they aren't even that useful for debugging a
live system.)
ok deraadt millert


# 1.9 22-Jan-2015 tedu

delete useless casts. ok deraadt guenther millert


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.8 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.7 17-Jun-2004 millert

UUpdate ISC copyright year to 2004
Remove unused macros Skip_Line and MkLower
Remove trailing whitespace


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.6 20-Feb-2003 millert

Sync with ISC cron-current + my at(1) integration.
The at(1) code is now more tightly integrated into the cron codebase.


Revision tags: OPENBSD_3_2_BASE
# 1.5 11-Jul-2002 millert

More syncing with my cron 4.0 patch tree, basically cosmetic:
o change an instance of e_none to e_memory that I missed (forgot?)
o kill some whitespace
o modify malloc failure recovery a bit


# 1.4 08-Jul-2002 millert

Merge in some changes from Paul Vixie's tree; most are cosmetic
o ANSI function headers
o return (foo) not return foo
o add -oi to sendmail flags
o update email address in man pages
o make some strings const
o completely remove globbing cruft from popen.c
o whitespace changes
o add DOW_STAR to flags for "monthly", "weekly", and "daily" cron entries


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.3 18-Feb-2001 millert

Update to ISC cron 4.0b1 + our patches. This is now under a BSD license.
I also fixed the signal handlers while I was at it.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.2 01-Nov-1996 millert

Check malloc/strdup ret val and deal.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision