History log of /openbsd-current/usr.sbin/cron/do_command.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.63 21-May-2022 deraadt

repair a few more backwards compares that create headaches
ok millert


Revision tags: OPENBSD_7_1_BASE
# 1.62 28-Jan-2022 guenther

When it's the possessive of 'it', it's spelled "its", without the
apostrophe.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.61 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_6_BASE
# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 13-Jun-2018 tb

zap a stray ';' and make a comment less ugly


# 1.58 13-Jun-2018 job

Add crontab entry option -n for "No mail when run successful"

OK jmc@ millert@


Revision tags: OPENBSD_6_3_BASE
# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.62 28-Jan-2022 guenther

When it's the possessive of 'it', it's spelled "its", without the
apostrophe.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.61 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_6_BASE
# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 13-Jun-2018 tb

zap a stray ';' and make a comment less ugly


# 1.58 13-Jun-2018 job

Add crontab entry option -n for "No mail when run successful"

OK jmc@ millert@


Revision tags: OPENBSD_6_3_BASE
# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.61 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_6_BASE
# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 13-Jun-2018 tb

zap a stray ';' and make a comment less ugly


# 1.58 13-Jun-2018 job

Add crontab entry option -n for "No mail when run successful"

OK jmc@ millert@


Revision tags: OPENBSD_6_3_BASE
# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 13-Jun-2018 tb

zap a stray ';' and make a comment less ugly


# 1.58 13-Jun-2018 job

Add crontab entry option -n for "No mail when run successful"

OK jmc@ millert@


Revision tags: OPENBSD_6_3_BASE
# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.59 13-Jun-2018 tb

zap a stray ';' and make a comment less ugly


# 1.58 13-Jun-2018 job

Add crontab entry option -n for "No mail when run successful"

OK jmc@ millert@


Revision tags: OPENBSD_6_3_BASE
# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.57 23-Oct-2017 friehm

Close cron sockets in child processes.

ok jca@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.56 17-Nov-2015 millert

Check pipe(2) return value; noticed by deraadt@


# 1.55 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.54 14-Nov-2015 millert

Remove log_it() and call syslog(3) directly using the same format:
"(username) WHAT (details)". Logs due to normal operation (e.g.
crontab operations or running commands) are logged at LOG_INFO like
before. Actual errors are logged at LOG_ERR, less important things
are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now
that there is no log file to reopen.


# 1.53 09-Nov-2015 millert

Remove unused xpid argument to log_it().


# 1.52 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.51 29-Oct-2015 millert

Use stravis(3) instead of a homegrown vis-like function.
OK nicm@


# 1.50 25-Oct-2015 millert

Remove cron.pid support. We still want to avoid multiple crons
running so verify that if the cron socket exists nothing is listening
on it. OK tedu@


# 1.49 23-Oct-2015 tedu

remove some more ifdef maziness


# 1.48 03-Oct-2015 tedu

There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it
their problem.
ok deraadt millert


# 1.47 03-Oct-2015 tedu

unifdef some features we will always have. ok benno zhuk


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.46 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.45 23-Jan-2015 tedu

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


# 1.44 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.43 23-Jan-2015 tedu

minor debug removal cleanup


# 1.42 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.41 14-Jan-2015 millert

Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX
and use limits.h instead of sys/param.h.


# 1.40 14-Jan-2015 millert

Use HAVE_FOO for BSD-specific features instead of relying on the
BSD macro from sys/param.h.


# 1.39 14-Jan-2015 millert

Use standard types for wait, readdir, signals and pids.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.38 23-Nov-2013 deraadt

obvious unsigned char cast for ctype
ok jca


Revision tags: OPENBSD_5_4_BASE
# 1.37 07-Mar-2013 millert

Allow a '+' in the MAILTO email adress; from Constantine A. Murenin


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.36 22-Aug-2011 millert

Use standard EXIT_SUCCESS/EXIT_FAILURE and STD{IN,OUT,ERR}_FILENO
defines instead of using custom macros. OK deraadt@ gilles@


Revision tags: OPENBSD_5_0_BASE
# 1.35 03-Mar-2011 millert

Reset the SIGPIPE signal handler immediately before executing a command.
We ignore it by default so cron doesn't die if sendmail is missing
or exits prematurely but the actual command being run should have the
default handler installed.


Revision tags: OPENBSD_4_9_BASE
# 1.34 14-Dec-2010 millert

Use _exit() not exit() after forking. OK deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.33 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_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.32 25-May-2007 millert

Check fdopen() return value.
Ignore SIG_PIPE when writing to sendmail. This allows cron to still
run jobs when sendmail is missing or broken (a warning will be logged).
Move mailto variable to the same scope as mail and use the mail
variable, not mailto, to test whether we have an open pipe to the mailer.


# 1.31 10-Apr-2007 miod

privledges -> privileges


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.30 13-Aug-2006 millert

Add Auto-Submitted header in generated mail as per RFC 3834.
OK henning@, ckuethe@, krw@, ian@. From Tamas TEVESZ.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 17-Jun-2004 millert

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


# 1.28 06-Jun-2004 millert

Fix typo in last commit for non-compiled code. Dmitry V. Levin


# 1.27 03-Jun-2004 millert

More changes from Dmitry V. Levin:

Check return values for setgid, initgroups and setuid in code we don't compile.
Print the correct filename for the at job in mail sent.
Add some #if DEBUGGING in cron.c's usage().
Set sunlen each time before using it in accept().
Don't send mail at all if MAILTO is set but empty.


# 1.26 26-Apr-2004 millert

isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.25 30-Jul-2003 millert

Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev


# 1.24 14-Apr-2003 millert

Use setproctitle() instead of the CAPITALIZE_FOR_PS hack. Inspired
by similar changes in FreeBSD and NetBSD. For at jobs, include the
job number in the proctitle.


Revision tags: OPENBSD_3_3_BASE
# 1.23 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.22 08-Aug-2002 millert

Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.


# 1.21 15-Jul-2002 millert

fix typo (pw vs. pwd) in unused code


# 1.20 15-Jul-2002 millert

Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines


# 1.19 15-Jul-2002 millert

Move atrun(8) functionality into cron(8) proper. This fixes the
long-standing annoyance that atrun's granularity is 10 minutes.
Most at jobs run with a 1 minute granularity. Jobs submitted via
"at now" or "batch" will run immediately. Includes a rewritten
cron(8) man page. at(1) will be integrated more closely into
cron at a future date.

Upgrading notes:
the atrun job in root's crontab should be removed.
the /var/at/spool directory is no longer used


# 1.18 12-Jul-2002 millert

Do not collapse \\ -> \ in a command, the shell will be unhappy with
bare backslashes.


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


# 1.16 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.15 21-Jun-2002 millert

Correctly close the writing end of the pipe when dup'ing the fd to
stdout. This was a pasto/thinko on my part. Problem found by
jean-philippe wan-hoi.


# 1.14 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


Revision tags: OPENBSD_3_1_BASE
# 1.13 19-Feb-2002 mpech

Fix gethostname() usage.

deraadt@ ok


# 1.12 09-Jan-2002 millert

Kill volatile now that jongjmp is history.


# 1.11 24-Oct-2001 millert

When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.10 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_8_BASE
# 1.9 21-Aug-2000 deraadt

snprintf sprinkles; solar@false.com & I


# 1.8 20-Aug-2000 millert

Add calls to setusercontext() and login_get*(). We basically call
setusercontext() in most places where previously we did a setlogin().
Add default login.conf file and put root in the "daemon" login class.


# 1.7 03-Jun-2000 millert

Set SIGCHLD to SIG_DFL not SIG_IGN to prevent "perl -w" from
complaining "Can't ignore signal CHLD, forcing to default".

Setting SIGCHLD to SIG_IGN means "don't provide exit status for my
children" on some OSes which is not what we want--we just don't
want to catch SIGCHLD since our parent does that for us.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.6 28-Aug-1999 millert

Run sendmail as the user corresponding to the crontab entry.
This keeps a user from abusing sendmail via the MAILTO var.
Had to drop -or0s from MAILARGS since that causes sendmail
to drop its privs (contrary to the sendmail docs).


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.5 08-May-1998 deraadt

when handling % line breaks, correctly handle escaped % which should be embedded; fenner@parc.xerox.com


Revision tags: OPENBSD_2_3_BASE
# 1.4 30-Mar-1998 deraadt

Y2K fixes from Andreas.Gunnarsson@emw.ericsson.se; culled from various places


# 1.3 22-Dec-1997 deraadt

handle timing normally except when clock jumps between 1 and 3 hours. If it
jumps, attempt as best as possible to gaurantee that jobs DO run, but only
run ONCE; patch by thompson@.tgsoft.com


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 07-Aug-1996 deraadt

setlogin(username)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision