#
1.96 |
|
05-May-2023 |
millert |
crontab: move spool temp file creation to spool_mkstemp() This fixes a bug introduced in rev 1.86 where if the second seteuid() call failed, a temporary file would be left in the spool directory.
|
Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE
|
#
1.95 |
|
22-Jun-2021 |
jmc |
reduce verbosity in usage and make it match SYNOPSIS; ok millert
|
Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
|
#
1.94 |
|
11-Feb-2020 |
schwarze |
Remove setlocale(3) calls. I checked that no functions are called that are actually locale-dependent on OpenBSD, and the programs should better not be locale-dependent even when compiled on other systems. millert@ points out that the month and weekday names in the fourth and fifth columns of crontab(5) could in theory be made locale-dependent, but we certainly don't want that, and currently, they are only compared against static const char * arrays in entry.c containing English names. Patch sent in by Jan Stary <hans at stare dot cz>. OK millert@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.93 |
|
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_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.92 |
|
11-Jan-2016 |
millert |
When caching the mtime of the spool directory and system crontab files, stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
|
#
1.91 |
|
17-Nov-2015 |
millert |
Check for setgid() failure before executing editor and warn if exec of shell + editor fails.
|
#
1.90 |
|
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.89 |
|
12-Nov-2015 |
millert |
Use absolute paths in pathnames.h. There is no longer a need to chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
|
#
1.88 |
|
11-Nov-2015 |
millert |
Use warn/warnx and err/errx. OK jca@
|
#
1.87 |
|
11-Nov-2015 |
millert |
Niether cron nor crontab need flock permission.
|
#
1.86 |
|
11-Nov-2015 |
millert |
For "crontab -u user -e" change the euid for the mkstemp() call instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
|
#
1.85 |
|
09-Nov-2015 |
millert |
Remove unused xpid argument to log_it().
|
#
1.84 |
|
09-Nov-2015 |
millert |
Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improve readability.
|
#
1.83 |
|
06-Nov-2015 |
millert |
Use __progname instead of the homegrown ProgramName.
|
#
1.82 |
|
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.81 |
|
03-Nov-2015 |
millert |
If pledge(2) fails use perror instead of log_it(RealUser, ...) since RealUser has not been filled in yet.
|
#
1.80 |
|
03-Nov-2015 |
millert |
It is only necessary to swap the effective gid when reading a file. Since we got rid of TMPDIR support there's no need to swap gids when creating or unlinking the temporary file. OK deraadt@
|
#
1.79 |
|
02-Nov-2015 |
millert |
Use setegid() directly instead of swap_gids() / swap_gids_back(). OK jca@ nicm@
|
#
1.78 |
|
31-Oct-2015 |
millert |
swap_gids and swap_gids_back are only used by crontab.c so move them there.
|
#
1.77 |
|
29-Oct-2015 |
millert |
Also need exec to run the editor of course.
|
#
1.76 |
|
29-Oct-2015 |
millert |
crontab needs "proc" for fork(2)
|
#
1.75 |
|
28-Oct-2015 |
deraadt |
pledge ok millert
|
#
1.74 |
|
26-Oct-2015 |
millert |
Remove TMPDIR support, it is not really useful in crontab. OK deraadt@
|
#
1.73 |
|
26-Oct-2015 |
millert |
Remove some useless defines and the set_cron_uid() function. OK jung@
|
#
1.72 |
|
06-Oct-2015 |
tedu |
clear out some more legacy code and whatnot
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.71 |
|
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.70 |
|
23-Jan-2015 |
tedu |
braces to open a function go on their own line like god intended
|
#
1.69 |
|
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.68 |
|
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.67 |
|
14-Jan-2015 |
millert |
Use standard types for wait, readdir, signals and pids.
|
#
1.66 |
|
14-Jan-2015 |
millert |
Remove compatibility defines for ancient systems. We assume a reasonable level of POSIX compliance.
|
#
1.65 |
|
26-Nov-2014 |
millert |
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
|
Revision tags: 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.64 |
|
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@
|
#
1.63 |
|
19-Aug-2011 |
millert |
Use futimens() instead of futimes() to avoid converting to/from struct timeval. OK guenther@
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.62 |
|
19-May-2011 |
phessler |
Fix some possible NULL pointer dereferences, and a little bit of cleanup.
From Lawrence Teo (thanks!)
OK krw@
|
#
1.61 |
|
04-Apr-2011 |
millert |
Remove unused variables; from Michael W. Bombardieri
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.60 |
|
11-Feb-2011 |
guenther |
Make "crontab -l" not crash on crontab files that don't have the expected three lines of comments. Factor out the "copy a crontab" logic and merge it into ignore_comments().
ok miod@
|
#
1.59 |
|
31-Jan-2011 |
millert |
Make "crontab -e" honor TMPDIR; from the Openwall project (ldv) OK miod@ jmc@
|
Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.58 |
|
27-Oct-2009 |
deraadt |
using the rcsid is silly
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
|
#
1.57 |
|
29-Jan-2009 |
sobrado |
tweak usage()
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.56 |
|
10-May-2008 |
okan |
from ray@
- move the ignoring of the top few (3) comments into a function of its own. - ignore these comments for crontab listings.
based on a patch from Slava Semushin
ok ray@ millert@
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.55 |
|
17-Nov-2007 |
millert |
Deal with timespec vs. timeval precision issues. Fixes a problem where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
|
#
1.54 |
|
17-Oct-2007 |
deraadt |
- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
|
#
1.53 |
|
01-Sep-2007 |
ray |
Include err.h and remove unused variables.
OK millert.
|
#
1.52 |
|
31-Aug-2007 |
ray |
Copy editit() from sendbug, synchronizing editor calling code.
OK otto, millert, beck, mbalmer, deraadt.
|
Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
|
#
1.51 |
|
19-Feb-2007 |
jmc |
tidy up synopsis and usage();
|
#
1.50 |
|
13-Feb-2007 |
mglocker |
crontab -e /tmp//crontab.ynUyD24939 versus /tmp/crontab.ynUyD24939.
OK millert@
|
Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
|
#
1.49 |
|
29-Nov-2005 |
millert |
crontab.c uses the rcsid in the crontab head comment so don't protect it from lint. Found by cloder@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.48 |
|
30-Jan-2005 |
millert |
Detect editors that move the edited file out from underneath us and warn. Based on an idea from Han Boetes.
|
#
1.47 |
|
04-Nov-2004 |
millert |
Treat EOF at prompt the same as 'n' instead of looping forever. Noticed by mepch@. OK pedro@ and deraadt@
|
#
1.46 |
|
16-Sep-2004 |
deraadt |
ftruncate() with ftello() instead of ftell(); ok millert
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.45 |
|
22-Jun-2004 |
avsm |
use snprintf(3) instead of home-grown glue_strings() function millert@ ok
|
#
1.44 |
|
17-Jun-2004 |
millert |
UUpdate ISC copyright year to 2004 Remove unused macros Skip_Line and MkLower Remove trailing whitespace
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
|
#
1.43 |
|
30-Jul-2003 |
millert |
Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.42 |
|
15-Mar-2003 |
millert |
Use strlcpy() instead of pre-checking the src len and using strcpy()
|
#
1.41 |
|
09-Mar-2003 |
millert |
Catch lines w/o EOF. Previously they were silently ignored.
|
#
1.40 |
|
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.
|
#
1.39 |
|
20-Feb-2003 |
millert |
If there is no cron.allow or cron.deny file, only the superuser may run the crontab command; for POSIX compliance. Create an empty cron.deny file to allow any user to run crontab: install -c -o root -g crontab -m 660 /dev/null /var/cron/cron.deny
|
#
1.38 |
|
18-Feb-2003 |
millert |
Use the SUN_LEN macro to set sun_len correctly
|
#
1.37 |
|
17-Feb-2003 |
millert |
Add a -n flag and version string; from vixie
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.36 |
|
10-Aug-2002 |
millert |
Just zero out pw_passwd in the pw_dup()'d copy. There's no need to do this elsewhere and my previous commit in this area caused problems on systems with an /etc/crontab file.
|
#
1.35 |
|
07-Aug-2002 |
millert |
paranoia: zero out pw_passwd since we don't need it
|
#
1.34 |
|
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.33 |
|
11-Jul-2002 |
millert |
No need to compare sizes of new/old crontab file now that we stash the st_mtimespec of the original and use that to compare.
|
#
1.32 |
|
09-Jul-2002 |
millert |
o Rename clean_turds() in crontab.c to die() and just _exit(ERROR_EXIT) instead of resetting the signal handler to SIG_DFL and redelivering.
o Use kill(2) instead of raise(3) (which is just a wrapper)
|
#
1.31 |
|
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.30 |
|
09-May-2002 |
millert |
nuke unused variable
|
#
1.29 |
|
09-May-2002 |
millert |
crontab is no longer setuid root, it is now setgid crontab. These changes were modelled after the Owl version of vixie-cron, but developed independently.
Our crontab used to send cron SIGUSR1 to tell cron to reread the spool dir. Now that crontab is not setuid root this doesn't work. Instead, crontab pokes cron via a Unix domain socket located in the tabs dir.
Please note, after these changes, the owner on user crontab files will have to be changed manually from root to the uid of the corresponding user for crontab to be usable. cron itself will accept tab files owned by either root or the user. Also, any /var/cron/{allow,deny} files must be readable by group crontab.
|
#
1.28 |
|
08-May-2002 |
millert |
o Use proper #defines; It is HAVE_*, not HAS_* o #ifdef out the -x flag getopt() stanza if not DEBUGGING
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.27 |
|
16-Feb-2002 |
millert |
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
#
1.26 |
|
20-Dec-2001 |
millert |
Cause crontab to send SIGUSR1 when a user's crontab file has changed. In cron, this interrupts the sleep() in cron_sleep() and causes cron to check to see what signal woke it up and act appropriately. This makes crontab changes take effect more or immediately.
|
#
1.25 |
|
07-Dec-2001 |
deraadt |
do not call abort(), it is tasteless
|
#
1.24 |
|
17-Nov-2001 |
deraadt |
save errno in signal handler
|
#
1.23 |
|
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_3_0_BASE
|
#
1.22 |
|
19-Aug-2001 |
millert |
Better file change detection: o when copying to temp file set utimes on temp file equal to original o use st_mtimespec instead of st_mtime for better granularity
|
#
1.21 |
|
11-Aug-2001 |
millert |
If waitpid() returns -1, check for EINTR
|
#
1.20 |
|
09-Jul-2001 |
deraadt |
correct type on last arg to execl(); nordin@cse.ogi.edu
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.19 |
|
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.18 |
|
21-Aug-2000 |
deraadt |
snprintf sprinkles; solar@false.com & I
|
#
1.17 |
|
21-Aug-2000 |
deraadt |
correct tmp file path; solar@false.com
|
#
1.16 |
|
21-Aug-2000 |
deraadt |
swap_uids_back; solar@false.com
|
Revision tags: OPENBSD_2_7_BASE
|
#
1.15 |
|
20-Nov-1999 |
millert |
Use mkstemp() for the temp file created in the tabs dir and clean up the temp file nicely if we are interupted.
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.14 |
|
29-May-1999 |
millert |
Check size as well as mtime when deciding whether or not the file was changed during edit. Crontab patch from <andrew@untraceable.net>. It may be better to simply do a real compare inline.
|
#
1.13 |
|
23-May-1999 |
aaron |
getopt(3) returns -1, not EOF
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
12-Jul-1998 |
deraadt |
disable debugging in crontab
|
Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
|
#
1.11 |
|
12-Apr-1997 |
millert |
waitpid() can return -1 -- give a useful error message if it does.
|
#
1.10 |
|
12-Apr-1997 |
deraadt |
ign some signals for editor
|
#
1.9 |
|
12-Apr-1997 |
deraadt |
support SIGSTOP in editor, I cannot believe this has always been busted!
|
#
1.8 |
|
25-Dec-1996 |
mickey |
no compile test after last change: no need for that umask too, i guess
|
#
1.7 |
|
25-Dec-1996 |
deraadt |
do not need umask for mkstemp
|
#
1.6 |
|
01-Nov-1996 |
millert |
Check malloc/strdup ret val and deal.
|
#
1.5 |
|
31-Oct-1996 |
millert |
Proper strncpy() usage.
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.4 |
|
16-Sep-1996 |
millert |
umask != file mode
|
#
1.3 |
|
15-Sep-1996 |
deraadt |
use mkstemp; mentioned by sirsyko@ishiboo.com
|
#
1.2 |
|
07-Aug-1996 |
deraadt |
buf oflow, nice error message; from freebsd
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
#
1.95 |
|
22-Jun-2021 |
jmc |
reduce verbosity in usage and make it match SYNOPSIS; ok millert
|
Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
|
#
1.94 |
|
11-Feb-2020 |
schwarze |
Remove setlocale(3) calls. I checked that no functions are called that are actually locale-dependent on OpenBSD, and the programs should better not be locale-dependent even when compiled on other systems. millert@ points out that the month and weekday names in the fourth and fifth columns of crontab(5) could in theory be made locale-dependent, but we certainly don't want that, and currently, they are only compared against static const char * arrays in entry.c containing English names. Patch sent in by Jan Stary <hans at stare dot cz>. OK millert@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.93 |
|
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_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.92 |
|
11-Jan-2016 |
millert |
When caching the mtime of the spool directory and system crontab files, stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
|
#
1.91 |
|
17-Nov-2015 |
millert |
Check for setgid() failure before executing editor and warn if exec of shell + editor fails.
|
#
1.90 |
|
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.89 |
|
12-Nov-2015 |
millert |
Use absolute paths in pathnames.h. There is no longer a need to chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
|
#
1.88 |
|
11-Nov-2015 |
millert |
Use warn/warnx and err/errx. OK jca@
|
#
1.87 |
|
11-Nov-2015 |
millert |
Niether cron nor crontab need flock permission.
|
#
1.86 |
|
11-Nov-2015 |
millert |
For "crontab -u user -e" change the euid for the mkstemp() call instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
|
#
1.85 |
|
09-Nov-2015 |
millert |
Remove unused xpid argument to log_it().
|
#
1.84 |
|
09-Nov-2015 |
millert |
Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improve readability.
|
#
1.83 |
|
06-Nov-2015 |
millert |
Use __progname instead of the homegrown ProgramName.
|
#
1.82 |
|
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.81 |
|
03-Nov-2015 |
millert |
If pledge(2) fails use perror instead of log_it(RealUser, ...) since RealUser has not been filled in yet.
|
#
1.80 |
|
03-Nov-2015 |
millert |
It is only necessary to swap the effective gid when reading a file. Since we got rid of TMPDIR support there's no need to swap gids when creating or unlinking the temporary file. OK deraadt@
|
#
1.79 |
|
02-Nov-2015 |
millert |
Use setegid() directly instead of swap_gids() / swap_gids_back(). OK jca@ nicm@
|
#
1.78 |
|
31-Oct-2015 |
millert |
swap_gids and swap_gids_back are only used by crontab.c so move them there.
|
#
1.77 |
|
29-Oct-2015 |
millert |
Also need exec to run the editor of course.
|
#
1.76 |
|
29-Oct-2015 |
millert |
crontab needs "proc" for fork(2)
|
#
1.75 |
|
28-Oct-2015 |
deraadt |
pledge ok millert
|
#
1.74 |
|
26-Oct-2015 |
millert |
Remove TMPDIR support, it is not really useful in crontab. OK deraadt@
|
#
1.73 |
|
26-Oct-2015 |
millert |
Remove some useless defines and the set_cron_uid() function. OK jung@
|
#
1.72 |
|
06-Oct-2015 |
tedu |
clear out some more legacy code and whatnot
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.71 |
|
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.70 |
|
23-Jan-2015 |
tedu |
braces to open a function go on their own line like god intended
|
#
1.69 |
|
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.68 |
|
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.67 |
|
14-Jan-2015 |
millert |
Use standard types for wait, readdir, signals and pids.
|
#
1.66 |
|
14-Jan-2015 |
millert |
Remove compatibility defines for ancient systems. We assume a reasonable level of POSIX compliance.
|
#
1.65 |
|
26-Nov-2014 |
millert |
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
|
Revision tags: 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.64 |
|
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@
|
#
1.63 |
|
19-Aug-2011 |
millert |
Use futimens() instead of futimes() to avoid converting to/from struct timeval. OK guenther@
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.62 |
|
19-May-2011 |
phessler |
Fix some possible NULL pointer dereferences, and a little bit of cleanup.
From Lawrence Teo (thanks!)
OK krw@
|
#
1.61 |
|
04-Apr-2011 |
millert |
Remove unused variables; from Michael W. Bombardieri
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.60 |
|
11-Feb-2011 |
guenther |
Make "crontab -l" not crash on crontab files that don't have the expected three lines of comments. Factor out the "copy a crontab" logic and merge it into ignore_comments().
ok miod@
|
#
1.59 |
|
31-Jan-2011 |
millert |
Make "crontab -e" honor TMPDIR; from the Openwall project (ldv) OK miod@ jmc@
|
Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.58 |
|
27-Oct-2009 |
deraadt |
using the rcsid is silly
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
|
#
1.57 |
|
29-Jan-2009 |
sobrado |
tweak usage()
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.56 |
|
10-May-2008 |
okan |
from ray@
- move the ignoring of the top few (3) comments into a function of its own. - ignore these comments for crontab listings.
based on a patch from Slava Semushin
ok ray@ millert@
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.55 |
|
17-Nov-2007 |
millert |
Deal with timespec vs. timeval precision issues. Fixes a problem where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
|
#
1.54 |
|
17-Oct-2007 |
deraadt |
- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
|
#
1.53 |
|
01-Sep-2007 |
ray |
Include err.h and remove unused variables.
OK millert.
|
#
1.52 |
|
31-Aug-2007 |
ray |
Copy editit() from sendbug, synchronizing editor calling code.
OK otto, millert, beck, mbalmer, deraadt.
|
Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
|
#
1.51 |
|
19-Feb-2007 |
jmc |
tidy up synopsis and usage();
|
#
1.50 |
|
13-Feb-2007 |
mglocker |
crontab -e /tmp//crontab.ynUyD24939 versus /tmp/crontab.ynUyD24939.
OK millert@
|
Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
|
#
1.49 |
|
29-Nov-2005 |
millert |
crontab.c uses the rcsid in the crontab head comment so don't protect it from lint. Found by cloder@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.48 |
|
30-Jan-2005 |
millert |
Detect editors that move the edited file out from underneath us and warn. Based on an idea from Han Boetes.
|
#
1.47 |
|
04-Nov-2004 |
millert |
Treat EOF at prompt the same as 'n' instead of looping forever. Noticed by mepch@. OK pedro@ and deraadt@
|
#
1.46 |
|
16-Sep-2004 |
deraadt |
ftruncate() with ftello() instead of ftell(); ok millert
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.45 |
|
22-Jun-2004 |
avsm |
use snprintf(3) instead of home-grown glue_strings() function millert@ ok
|
#
1.44 |
|
17-Jun-2004 |
millert |
UUpdate ISC copyright year to 2004 Remove unused macros Skip_Line and MkLower Remove trailing whitespace
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
|
#
1.43 |
|
30-Jul-2003 |
millert |
Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.42 |
|
15-Mar-2003 |
millert |
Use strlcpy() instead of pre-checking the src len and using strcpy()
|
#
1.41 |
|
09-Mar-2003 |
millert |
Catch lines w/o EOF. Previously they were silently ignored.
|
#
1.40 |
|
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.
|
#
1.39 |
|
20-Feb-2003 |
millert |
If there is no cron.allow or cron.deny file, only the superuser may run the crontab command; for POSIX compliance. Create an empty cron.deny file to allow any user to run crontab: install -c -o root -g crontab -m 660 /dev/null /var/cron/cron.deny
|
#
1.38 |
|
18-Feb-2003 |
millert |
Use the SUN_LEN macro to set sun_len correctly
|
#
1.37 |
|
17-Feb-2003 |
millert |
Add a -n flag and version string; from vixie
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.36 |
|
10-Aug-2002 |
millert |
Just zero out pw_passwd in the pw_dup()'d copy. There's no need to do this elsewhere and my previous commit in this area caused problems on systems with an /etc/crontab file.
|
#
1.35 |
|
07-Aug-2002 |
millert |
paranoia: zero out pw_passwd since we don't need it
|
#
1.34 |
|
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.33 |
|
11-Jul-2002 |
millert |
No need to compare sizes of new/old crontab file now that we stash the st_mtimespec of the original and use that to compare.
|
#
1.32 |
|
09-Jul-2002 |
millert |
o Rename clean_turds() in crontab.c to die() and just _exit(ERROR_EXIT) instead of resetting the signal handler to SIG_DFL and redelivering.
o Use kill(2) instead of raise(3) (which is just a wrapper)
|
#
1.31 |
|
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.30 |
|
09-May-2002 |
millert |
nuke unused variable
|
#
1.29 |
|
09-May-2002 |
millert |
crontab is no longer setuid root, it is now setgid crontab. These changes were modelled after the Owl version of vixie-cron, but developed independently.
Our crontab used to send cron SIGUSR1 to tell cron to reread the spool dir. Now that crontab is not setuid root this doesn't work. Instead, crontab pokes cron via a Unix domain socket located in the tabs dir.
Please note, after these changes, the owner on user crontab files will have to be changed manually from root to the uid of the corresponding user for crontab to be usable. cron itself will accept tab files owned by either root or the user. Also, any /var/cron/{allow,deny} files must be readable by group crontab.
|
#
1.28 |
|
08-May-2002 |
millert |
o Use proper #defines; It is HAVE_*, not HAS_* o #ifdef out the -x flag getopt() stanza if not DEBUGGING
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.27 |
|
16-Feb-2002 |
millert |
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
#
1.26 |
|
20-Dec-2001 |
millert |
Cause crontab to send SIGUSR1 when a user's crontab file has changed. In cron, this interrupts the sleep() in cron_sleep() and causes cron to check to see what signal woke it up and act appropriately. This makes crontab changes take effect more or immediately.
|
#
1.25 |
|
07-Dec-2001 |
deraadt |
do not call abort(), it is tasteless
|
#
1.24 |
|
17-Nov-2001 |
deraadt |
save errno in signal handler
|
#
1.23 |
|
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_3_0_BASE
|
#
1.22 |
|
19-Aug-2001 |
millert |
Better file change detection: o when copying to temp file set utimes on temp file equal to original o use st_mtimespec instead of st_mtime for better granularity
|
#
1.21 |
|
11-Aug-2001 |
millert |
If waitpid() returns -1, check for EINTR
|
#
1.20 |
|
09-Jul-2001 |
deraadt |
correct type on last arg to execl(); nordin@cse.ogi.edu
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.19 |
|
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.18 |
|
21-Aug-2000 |
deraadt |
snprintf sprinkles; solar@false.com & I
|
#
1.17 |
|
21-Aug-2000 |
deraadt |
correct tmp file path; solar@false.com
|
#
1.16 |
|
21-Aug-2000 |
deraadt |
swap_uids_back; solar@false.com
|
Revision tags: OPENBSD_2_7_BASE
|
#
1.15 |
|
20-Nov-1999 |
millert |
Use mkstemp() for the temp file created in the tabs dir and clean up the temp file nicely if we are interupted.
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.14 |
|
29-May-1999 |
millert |
Check size as well as mtime when deciding whether or not the file was changed during edit. Crontab patch from <andrew@untraceable.net>. It may be better to simply do a real compare inline.
|
#
1.13 |
|
23-May-1999 |
aaron |
getopt(3) returns -1, not EOF
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
12-Jul-1998 |
deraadt |
disable debugging in crontab
|
Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
|
#
1.11 |
|
12-Apr-1997 |
millert |
waitpid() can return -1 -- give a useful error message if it does.
|
#
1.10 |
|
12-Apr-1997 |
deraadt |
ign some signals for editor
|
#
1.9 |
|
12-Apr-1997 |
deraadt |
support SIGSTOP in editor, I cannot believe this has always been busted!
|
#
1.8 |
|
25-Dec-1996 |
mickey |
no compile test after last change: no need for that umask too, i guess
|
#
1.7 |
|
25-Dec-1996 |
deraadt |
do not need umask for mkstemp
|
#
1.6 |
|
01-Nov-1996 |
millert |
Check malloc/strdup ret val and deal.
|
#
1.5 |
|
31-Oct-1996 |
millert |
Proper strncpy() usage.
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.4 |
|
16-Sep-1996 |
millert |
umask != file mode
|
#
1.3 |
|
15-Sep-1996 |
deraadt |
use mkstemp; mentioned by sirsyko@ishiboo.com
|
#
1.2 |
|
07-Aug-1996 |
deraadt |
buf oflow, nice error message; from freebsd
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
#
1.94 |
|
11-Feb-2020 |
schwarze |
Remove setlocale(3) calls. I checked that no functions are called that are actually locale-dependent on OpenBSD, and the programs should better not be locale-dependent even when compiled on other systems. millert@ points out that the month and weekday names in the fourth and fifth columns of crontab(5) could in theory be made locale-dependent, but we certainly don't want that, and currently, they are only compared against static const char * arrays in entry.c containing English names. Patch sent in by Jan Stary <hans at stare dot cz>. OK millert@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.93 |
|
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_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.92 |
|
11-Jan-2016 |
millert |
When caching the mtime of the spool directory and system crontab files, stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
|
#
1.91 |
|
17-Nov-2015 |
millert |
Check for setgid() failure before executing editor and warn if exec of shell + editor fails.
|
#
1.90 |
|
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.89 |
|
12-Nov-2015 |
millert |
Use absolute paths in pathnames.h. There is no longer a need to chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
|
#
1.88 |
|
11-Nov-2015 |
millert |
Use warn/warnx and err/errx. OK jca@
|
#
1.87 |
|
11-Nov-2015 |
millert |
Niether cron nor crontab need flock permission.
|
#
1.86 |
|
11-Nov-2015 |
millert |
For "crontab -u user -e" change the euid for the mkstemp() call instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
|
#
1.85 |
|
09-Nov-2015 |
millert |
Remove unused xpid argument to log_it().
|
#
1.84 |
|
09-Nov-2015 |
millert |
Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improve readability.
|
#
1.83 |
|
06-Nov-2015 |
millert |
Use __progname instead of the homegrown ProgramName.
|
#
1.82 |
|
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.81 |
|
03-Nov-2015 |
millert |
If pledge(2) fails use perror instead of log_it(RealUser, ...) since RealUser has not been filled in yet.
|
#
1.80 |
|
03-Nov-2015 |
millert |
It is only necessary to swap the effective gid when reading a file. Since we got rid of TMPDIR support there's no need to swap gids when creating or unlinking the temporary file. OK deraadt@
|
#
1.79 |
|
02-Nov-2015 |
millert |
Use setegid() directly instead of swap_gids() / swap_gids_back(). OK jca@ nicm@
|
#
1.78 |
|
31-Oct-2015 |
millert |
swap_gids and swap_gids_back are only used by crontab.c so move them there.
|
#
1.77 |
|
29-Oct-2015 |
millert |
Also need exec to run the editor of course.
|
#
1.76 |
|
29-Oct-2015 |
millert |
crontab needs "proc" for fork(2)
|
#
1.75 |
|
28-Oct-2015 |
deraadt |
pledge ok millert
|
#
1.74 |
|
26-Oct-2015 |
millert |
Remove TMPDIR support, it is not really useful in crontab. OK deraadt@
|
#
1.73 |
|
26-Oct-2015 |
millert |
Remove some useless defines and the set_cron_uid() function. OK jung@
|
#
1.72 |
|
06-Oct-2015 |
tedu |
clear out some more legacy code and whatnot
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.71 |
|
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.70 |
|
23-Jan-2015 |
tedu |
braces to open a function go on their own line like god intended
|
#
1.69 |
|
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.68 |
|
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.67 |
|
14-Jan-2015 |
millert |
Use standard types for wait, readdir, signals and pids.
|
#
1.66 |
|
14-Jan-2015 |
millert |
Remove compatibility defines for ancient systems. We assume a reasonable level of POSIX compliance.
|
#
1.65 |
|
26-Nov-2014 |
millert |
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
|
Revision tags: 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.64 |
|
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@
|
#
1.63 |
|
19-Aug-2011 |
millert |
Use futimens() instead of futimes() to avoid converting to/from struct timeval. OK guenther@
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.62 |
|
19-May-2011 |
phessler |
Fix some possible NULL pointer dereferences, and a little bit of cleanup.
From Lawrence Teo (thanks!)
OK krw@
|
#
1.61 |
|
04-Apr-2011 |
millert |
Remove unused variables; from Michael W. Bombardieri
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.60 |
|
11-Feb-2011 |
guenther |
Make "crontab -l" not crash on crontab files that don't have the expected three lines of comments. Factor out the "copy a crontab" logic and merge it into ignore_comments().
ok miod@
|
#
1.59 |
|
31-Jan-2011 |
millert |
Make "crontab -e" honor TMPDIR; from the Openwall project (ldv) OK miod@ jmc@
|
Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.58 |
|
27-Oct-2009 |
deraadt |
using the rcsid is silly
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
|
#
1.57 |
|
29-Jan-2009 |
sobrado |
tweak usage()
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.56 |
|
10-May-2008 |
okan |
from ray@
- move the ignoring of the top few (3) comments into a function of its own. - ignore these comments for crontab listings.
based on a patch from Slava Semushin
ok ray@ millert@
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.55 |
|
17-Nov-2007 |
millert |
Deal with timespec vs. timeval precision issues. Fixes a problem where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
|
#
1.54 |
|
17-Oct-2007 |
deraadt |
- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
|
#
1.53 |
|
01-Sep-2007 |
ray |
Include err.h and remove unused variables.
OK millert.
|
#
1.52 |
|
31-Aug-2007 |
ray |
Copy editit() from sendbug, synchronizing editor calling code.
OK otto, millert, beck, mbalmer, deraadt.
|
Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
|
#
1.51 |
|
19-Feb-2007 |
jmc |
tidy up synopsis and usage();
|
#
1.50 |
|
13-Feb-2007 |
mglocker |
crontab -e /tmp//crontab.ynUyD24939 versus /tmp/crontab.ynUyD24939.
OK millert@
|
Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
|
#
1.49 |
|
29-Nov-2005 |
millert |
crontab.c uses the rcsid in the crontab head comment so don't protect it from lint. Found by cloder@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.48 |
|
30-Jan-2005 |
millert |
Detect editors that move the edited file out from underneath us and warn. Based on an idea from Han Boetes.
|
#
1.47 |
|
04-Nov-2004 |
millert |
Treat EOF at prompt the same as 'n' instead of looping forever. Noticed by mepch@. OK pedro@ and deraadt@
|
#
1.46 |
|
16-Sep-2004 |
deraadt |
ftruncate() with ftello() instead of ftell(); ok millert
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.45 |
|
22-Jun-2004 |
avsm |
use snprintf(3) instead of home-grown glue_strings() function millert@ ok
|
#
1.44 |
|
17-Jun-2004 |
millert |
UUpdate ISC copyright year to 2004 Remove unused macros Skip_Line and MkLower Remove trailing whitespace
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
|
#
1.43 |
|
30-Jul-2003 |
millert |
Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.42 |
|
15-Mar-2003 |
millert |
Use strlcpy() instead of pre-checking the src len and using strcpy()
|
#
1.41 |
|
09-Mar-2003 |
millert |
Catch lines w/o EOF. Previously they were silently ignored.
|
#
1.40 |
|
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.
|
#
1.39 |
|
20-Feb-2003 |
millert |
If there is no cron.allow or cron.deny file, only the superuser may run the crontab command; for POSIX compliance. Create an empty cron.deny file to allow any user to run crontab: install -c -o root -g crontab -m 660 /dev/null /var/cron/cron.deny
|
#
1.38 |
|
18-Feb-2003 |
millert |
Use the SUN_LEN macro to set sun_len correctly
|
#
1.37 |
|
17-Feb-2003 |
millert |
Add a -n flag and version string; from vixie
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.36 |
|
10-Aug-2002 |
millert |
Just zero out pw_passwd in the pw_dup()'d copy. There's no need to do this elsewhere and my previous commit in this area caused problems on systems with an /etc/crontab file.
|
#
1.35 |
|
07-Aug-2002 |
millert |
paranoia: zero out pw_passwd since we don't need it
|
#
1.34 |
|
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.33 |
|
11-Jul-2002 |
millert |
No need to compare sizes of new/old crontab file now that we stash the st_mtimespec of the original and use that to compare.
|
#
1.32 |
|
09-Jul-2002 |
millert |
o Rename clean_turds() in crontab.c to die() and just _exit(ERROR_EXIT) instead of resetting the signal handler to SIG_DFL and redelivering.
o Use kill(2) instead of raise(3) (which is just a wrapper)
|
#
1.31 |
|
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.30 |
|
09-May-2002 |
millert |
nuke unused variable
|
#
1.29 |
|
09-May-2002 |
millert |
crontab is no longer setuid root, it is now setgid crontab. These changes were modelled after the Owl version of vixie-cron, but developed independently.
Our crontab used to send cron SIGUSR1 to tell cron to reread the spool dir. Now that crontab is not setuid root this doesn't work. Instead, crontab pokes cron via a Unix domain socket located in the tabs dir.
Please note, after these changes, the owner on user crontab files will have to be changed manually from root to the uid of the corresponding user for crontab to be usable. cron itself will accept tab files owned by either root or the user. Also, any /var/cron/{allow,deny} files must be readable by group crontab.
|
#
1.28 |
|
08-May-2002 |
millert |
o Use proper #defines; It is HAVE_*, not HAS_* o #ifdef out the -x flag getopt() stanza if not DEBUGGING
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.27 |
|
16-Feb-2002 |
millert |
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
#
1.26 |
|
20-Dec-2001 |
millert |
Cause crontab to send SIGUSR1 when a user's crontab file has changed. In cron, this interrupts the sleep() in cron_sleep() and causes cron to check to see what signal woke it up and act appropriately. This makes crontab changes take effect more or immediately.
|
#
1.25 |
|
07-Dec-2001 |
deraadt |
do not call abort(), it is tasteless
|
#
1.24 |
|
17-Nov-2001 |
deraadt |
save errno in signal handler
|
#
1.23 |
|
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_3_0_BASE
|
#
1.22 |
|
19-Aug-2001 |
millert |
Better file change detection: o when copying to temp file set utimes on temp file equal to original o use st_mtimespec instead of st_mtime for better granularity
|
#
1.21 |
|
11-Aug-2001 |
millert |
If waitpid() returns -1, check for EINTR
|
#
1.20 |
|
09-Jul-2001 |
deraadt |
correct type on last arg to execl(); nordin@cse.ogi.edu
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.19 |
|
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.18 |
|
21-Aug-2000 |
deraadt |
snprintf sprinkles; solar@false.com & I
|
#
1.17 |
|
21-Aug-2000 |
deraadt |
correct tmp file path; solar@false.com
|
#
1.16 |
|
21-Aug-2000 |
deraadt |
swap_uids_back; solar@false.com
|
Revision tags: OPENBSD_2_7_BASE
|
#
1.15 |
|
20-Nov-1999 |
millert |
Use mkstemp() for the temp file created in the tabs dir and clean up the temp file nicely if we are interupted.
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.14 |
|
29-May-1999 |
millert |
Check size as well as mtime when deciding whether or not the file was changed during edit. Crontab patch from <andrew@untraceable.net>. It may be better to simply do a real compare inline.
|
#
1.13 |
|
23-May-1999 |
aaron |
getopt(3) returns -1, not EOF
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
12-Jul-1998 |
deraadt |
disable debugging in crontab
|
Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
|
#
1.11 |
|
12-Apr-1997 |
millert |
waitpid() can return -1 -- give a useful error message if it does.
|
#
1.10 |
|
12-Apr-1997 |
deraadt |
ign some signals for editor
|
#
1.9 |
|
12-Apr-1997 |
deraadt |
support SIGSTOP in editor, I cannot believe this has always been busted!
|
#
1.8 |
|
25-Dec-1996 |
mickey |
no compile test after last change: no need for that umask too, i guess
|
#
1.7 |
|
25-Dec-1996 |
deraadt |
do not need umask for mkstemp
|
#
1.6 |
|
01-Nov-1996 |
millert |
Check malloc/strdup ret val and deal.
|
#
1.5 |
|
31-Oct-1996 |
millert |
Proper strncpy() usage.
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.4 |
|
16-Sep-1996 |
millert |
umask != file mode
|
#
1.3 |
|
15-Sep-1996 |
deraadt |
use mkstemp; mentioned by sirsyko@ishiboo.com
|
#
1.2 |
|
07-Aug-1996 |
deraadt |
buf oflow, nice error message; from freebsd
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
#
1.93 |
|
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_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.92 |
|
11-Jan-2016 |
millert |
When caching the mtime of the spool directory and system crontab files, stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
|
#
1.91 |
|
17-Nov-2015 |
millert |
Check for setgid() failure before executing editor and warn if exec of shell + editor fails.
|
#
1.90 |
|
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.89 |
|
12-Nov-2015 |
millert |
Use absolute paths in pathnames.h. There is no longer a need to chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
|
#
1.88 |
|
11-Nov-2015 |
millert |
Use warn/warnx and err/errx. OK jca@
|
#
1.87 |
|
11-Nov-2015 |
millert |
Niether cron nor crontab need flock permission.
|
#
1.86 |
|
11-Nov-2015 |
millert |
For "crontab -u user -e" change the euid for the mkstemp() call instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
|
#
1.85 |
|
09-Nov-2015 |
millert |
Remove unused xpid argument to log_it().
|
#
1.84 |
|
09-Nov-2015 |
millert |
Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improve readability.
|
#
1.83 |
|
06-Nov-2015 |
millert |
Use __progname instead of the homegrown ProgramName.
|
#
1.82 |
|
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.81 |
|
03-Nov-2015 |
millert |
If pledge(2) fails use perror instead of log_it(RealUser, ...) since RealUser has not been filled in yet.
|
#
1.80 |
|
03-Nov-2015 |
millert |
It is only necessary to swap the effective gid when reading a file. Since we got rid of TMPDIR support there's no need to swap gids when creating or unlinking the temporary file. OK deraadt@
|
#
1.79 |
|
02-Nov-2015 |
millert |
Use setegid() directly instead of swap_gids() / swap_gids_back(). OK jca@ nicm@
|
#
1.78 |
|
31-Oct-2015 |
millert |
swap_gids and swap_gids_back are only used by crontab.c so move them there.
|
#
1.77 |
|
29-Oct-2015 |
millert |
Also need exec to run the editor of course.
|
#
1.76 |
|
29-Oct-2015 |
millert |
crontab needs "proc" for fork(2)
|
#
1.75 |
|
28-Oct-2015 |
deraadt |
pledge ok millert
|
#
1.74 |
|
26-Oct-2015 |
millert |
Remove TMPDIR support, it is not really useful in crontab. OK deraadt@
|
#
1.73 |
|
26-Oct-2015 |
millert |
Remove some useless defines and the set_cron_uid() function. OK jung@
|
#
1.72 |
|
06-Oct-2015 |
tedu |
clear out some more legacy code and whatnot
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.71 |
|
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.70 |
|
23-Jan-2015 |
tedu |
braces to open a function go on their own line like god intended
|
#
1.69 |
|
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.68 |
|
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.67 |
|
14-Jan-2015 |
millert |
Use standard types for wait, readdir, signals and pids.
|
#
1.66 |
|
14-Jan-2015 |
millert |
Remove compatibility defines for ancient systems. We assume a reasonable level of POSIX compliance.
|
#
1.65 |
|
26-Nov-2014 |
millert |
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
|
Revision tags: 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.64 |
|
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@
|
#
1.63 |
|
19-Aug-2011 |
millert |
Use futimens() instead of futimes() to avoid converting to/from struct timeval. OK guenther@
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.62 |
|
19-May-2011 |
phessler |
Fix some possible NULL pointer dereferences, and a little bit of cleanup.
From Lawrence Teo (thanks!)
OK krw@
|
#
1.61 |
|
04-Apr-2011 |
millert |
Remove unused variables; from Michael W. Bombardieri
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.60 |
|
11-Feb-2011 |
guenther |
Make "crontab -l" not crash on crontab files that don't have the expected three lines of comments. Factor out the "copy a crontab" logic and merge it into ignore_comments().
ok miod@
|
#
1.59 |
|
31-Jan-2011 |
millert |
Make "crontab -e" honor TMPDIR; from the Openwall project (ldv) OK miod@ jmc@
|
Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.58 |
|
27-Oct-2009 |
deraadt |
using the rcsid is silly
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
|
#
1.57 |
|
29-Jan-2009 |
sobrado |
tweak usage()
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.56 |
|
10-May-2008 |
okan |
from ray@
- move the ignoring of the top few (3) comments into a function of its own. - ignore these comments for crontab listings.
based on a patch from Slava Semushin
ok ray@ millert@
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.55 |
|
17-Nov-2007 |
millert |
Deal with timespec vs. timeval precision issues. Fixes a problem where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
|
#
1.54 |
|
17-Oct-2007 |
deraadt |
- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
|
#
1.53 |
|
01-Sep-2007 |
ray |
Include err.h and remove unused variables.
OK millert.
|
#
1.52 |
|
31-Aug-2007 |
ray |
Copy editit() from sendbug, synchronizing editor calling code.
OK otto, millert, beck, mbalmer, deraadt.
|
Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
|
#
1.51 |
|
19-Feb-2007 |
jmc |
tidy up synopsis and usage();
|
#
1.50 |
|
13-Feb-2007 |
mglocker |
crontab -e /tmp//crontab.ynUyD24939 versus /tmp/crontab.ynUyD24939.
OK millert@
|
Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
|
#
1.49 |
|
29-Nov-2005 |
millert |
crontab.c uses the rcsid in the crontab head comment so don't protect it from lint. Found by cloder@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.48 |
|
30-Jan-2005 |
millert |
Detect editors that move the edited file out from underneath us and warn. Based on an idea from Han Boetes.
|
#
1.47 |
|
04-Nov-2004 |
millert |
Treat EOF at prompt the same as 'n' instead of looping forever. Noticed by mepch@. OK pedro@ and deraadt@
|
#
1.46 |
|
16-Sep-2004 |
deraadt |
ftruncate() with ftello() instead of ftell(); ok millert
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.45 |
|
22-Jun-2004 |
avsm |
use snprintf(3) instead of home-grown glue_strings() function millert@ ok
|
#
1.44 |
|
17-Jun-2004 |
millert |
UUpdate ISC copyright year to 2004 Remove unused macros Skip_Line and MkLower Remove trailing whitespace
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
|
#
1.43 |
|
30-Jul-2003 |
millert |
Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.42 |
|
15-Mar-2003 |
millert |
Use strlcpy() instead of pre-checking the src len and using strcpy()
|
#
1.41 |
|
09-Mar-2003 |
millert |
Catch lines w/o EOF. Previously they were silently ignored.
|
#
1.40 |
|
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.
|
#
1.39 |
|
20-Feb-2003 |
millert |
If there is no cron.allow or cron.deny file, only the superuser may run the crontab command; for POSIX compliance. Create an empty cron.deny file to allow any user to run crontab: install -c -o root -g crontab -m 660 /dev/null /var/cron/cron.deny
|
#
1.38 |
|
18-Feb-2003 |
millert |
Use the SUN_LEN macro to set sun_len correctly
|
#
1.37 |
|
17-Feb-2003 |
millert |
Add a -n flag and version string; from vixie
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.36 |
|
10-Aug-2002 |
millert |
Just zero out pw_passwd in the pw_dup()'d copy. There's no need to do this elsewhere and my previous commit in this area caused problems on systems with an /etc/crontab file.
|
#
1.35 |
|
07-Aug-2002 |
millert |
paranoia: zero out pw_passwd since we don't need it
|
#
1.34 |
|
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.33 |
|
11-Jul-2002 |
millert |
No need to compare sizes of new/old crontab file now that we stash the st_mtimespec of the original and use that to compare.
|
#
1.32 |
|
09-Jul-2002 |
millert |
o Rename clean_turds() in crontab.c to die() and just _exit(ERROR_EXIT) instead of resetting the signal handler to SIG_DFL and redelivering.
o Use kill(2) instead of raise(3) (which is just a wrapper)
|
#
1.31 |
|
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.30 |
|
09-May-2002 |
millert |
nuke unused variable
|
#
1.29 |
|
09-May-2002 |
millert |
crontab is no longer setuid root, it is now setgid crontab. These changes were modelled after the Owl version of vixie-cron, but developed independently.
Our crontab used to send cron SIGUSR1 to tell cron to reread the spool dir. Now that crontab is not setuid root this doesn't work. Instead, crontab pokes cron via a Unix domain socket located in the tabs dir.
Please note, after these changes, the owner on user crontab files will have to be changed manually from root to the uid of the corresponding user for crontab to be usable. cron itself will accept tab files owned by either root or the user. Also, any /var/cron/{allow,deny} files must be readable by group crontab.
|
#
1.28 |
|
08-May-2002 |
millert |
o Use proper #defines; It is HAVE_*, not HAS_* o #ifdef out the -x flag getopt() stanza if not DEBUGGING
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.27 |
|
16-Feb-2002 |
millert |
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
#
1.26 |
|
20-Dec-2001 |
millert |
Cause crontab to send SIGUSR1 when a user's crontab file has changed. In cron, this interrupts the sleep() in cron_sleep() and causes cron to check to see what signal woke it up and act appropriately. This makes crontab changes take effect more or immediately.
|
#
1.25 |
|
07-Dec-2001 |
deraadt |
do not call abort(), it is tasteless
|
#
1.24 |
|
17-Nov-2001 |
deraadt |
save errno in signal handler
|
#
1.23 |
|
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_3_0_BASE
|
#
1.22 |
|
19-Aug-2001 |
millert |
Better file change detection: o when copying to temp file set utimes on temp file equal to original o use st_mtimespec instead of st_mtime for better granularity
|
#
1.21 |
|
11-Aug-2001 |
millert |
If waitpid() returns -1, check for EINTR
|
#
1.20 |
|
09-Jul-2001 |
deraadt |
correct type on last arg to execl(); nordin@cse.ogi.edu
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.19 |
|
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.18 |
|
21-Aug-2000 |
deraadt |
snprintf sprinkles; solar@false.com & I
|
#
1.17 |
|
21-Aug-2000 |
deraadt |
correct tmp file path; solar@false.com
|
#
1.16 |
|
21-Aug-2000 |
deraadt |
swap_uids_back; solar@false.com
|
Revision tags: OPENBSD_2_7_BASE
|
#
1.15 |
|
20-Nov-1999 |
millert |
Use mkstemp() for the temp file created in the tabs dir and clean up the temp file nicely if we are interupted.
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.14 |
|
29-May-1999 |
millert |
Check size as well as mtime when deciding whether or not the file was changed during edit. Crontab patch from <andrew@untraceable.net>. It may be better to simply do a real compare inline.
|
#
1.13 |
|
23-May-1999 |
aaron |
getopt(3) returns -1, not EOF
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
12-Jul-1998 |
deraadt |
disable debugging in crontab
|
Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
|
#
1.11 |
|
12-Apr-1997 |
millert |
waitpid() can return -1 -- give a useful error message if it does.
|
#
1.10 |
|
12-Apr-1997 |
deraadt |
ign some signals for editor
|
#
1.9 |
|
12-Apr-1997 |
deraadt |
support SIGSTOP in editor, I cannot believe this has always been busted!
|
#
1.8 |
|
25-Dec-1996 |
mickey |
no compile test after last change: no need for that umask too, i guess
|
#
1.7 |
|
25-Dec-1996 |
deraadt |
do not need umask for mkstemp
|
#
1.6 |
|
01-Nov-1996 |
millert |
Check malloc/strdup ret val and deal.
|
#
1.5 |
|
31-Oct-1996 |
millert |
Proper strncpy() usage.
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.4 |
|
16-Sep-1996 |
millert |
umask != file mode
|
#
1.3 |
|
15-Sep-1996 |
deraadt |
use mkstemp; mentioned by sirsyko@ishiboo.com
|
#
1.2 |
|
07-Aug-1996 |
deraadt |
buf oflow, nice error message; from freebsd
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
|
#
1.92 |
|
11-Jan-2016 |
millert |
When caching the mtime of the spool directory and system crontab files, stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
|
#
1.91 |
|
17-Nov-2015 |
millert |
Check for setgid() failure before executing editor and warn if exec of shell + editor fails.
|
#
1.90 |
|
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.89 |
|
12-Nov-2015 |
millert |
Use absolute paths in pathnames.h. There is no longer a need to chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
|
#
1.88 |
|
11-Nov-2015 |
millert |
Use warn/warnx and err/errx. OK jca@
|
#
1.87 |
|
11-Nov-2015 |
millert |
Niether cron nor crontab need flock permission.
|
#
1.86 |
|
11-Nov-2015 |
millert |
For "crontab -u user -e" change the euid for the mkstemp() call instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
|
#
1.85 |
|
09-Nov-2015 |
millert |
Remove unused xpid argument to log_it().
|
#
1.84 |
|
09-Nov-2015 |
millert |
Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improve readability.
|
#
1.83 |
|
06-Nov-2015 |
millert |
Use __progname instead of the homegrown ProgramName.
|
#
1.82 |
|
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.81 |
|
03-Nov-2015 |
millert |
If pledge(2) fails use perror instead of log_it(RealUser, ...) since RealUser has not been filled in yet.
|
#
1.80 |
|
03-Nov-2015 |
millert |
It is only necessary to swap the effective gid when reading a file. Since we got rid of TMPDIR support there's no need to swap gids when creating or unlinking the temporary file. OK deraadt@
|
#
1.79 |
|
02-Nov-2015 |
millert |
Use setegid() directly instead of swap_gids() / swap_gids_back(). OK jca@ nicm@
|
#
1.78 |
|
31-Oct-2015 |
millert |
swap_gids and swap_gids_back are only used by crontab.c so move them there.
|
#
1.77 |
|
29-Oct-2015 |
millert |
Also need exec to run the editor of course.
|
#
1.76 |
|
29-Oct-2015 |
millert |
crontab needs "proc" for fork(2)
|
#
1.75 |
|
28-Oct-2015 |
deraadt |
pledge ok millert
|
#
1.74 |
|
26-Oct-2015 |
millert |
Remove TMPDIR support, it is not really useful in crontab. OK deraadt@
|
#
1.73 |
|
26-Oct-2015 |
millert |
Remove some useless defines and the set_cron_uid() function. OK jung@
|
#
1.72 |
|
06-Oct-2015 |
tedu |
clear out some more legacy code and whatnot
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.71 |
|
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.70 |
|
23-Jan-2015 |
tedu |
braces to open a function go on their own line like god intended
|
#
1.69 |
|
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.68 |
|
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.67 |
|
14-Jan-2015 |
millert |
Use standard types for wait, readdir, signals and pids.
|
#
1.66 |
|
14-Jan-2015 |
millert |
Remove compatibility defines for ancient systems. We assume a reasonable level of POSIX compliance.
|
#
1.65 |
|
26-Nov-2014 |
millert |
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
|
Revision tags: 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.64 |
|
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@
|
#
1.63 |
|
19-Aug-2011 |
millert |
Use futimens() instead of futimes() to avoid converting to/from struct timeval. OK guenther@
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.62 |
|
19-May-2011 |
phessler |
Fix some possible NULL pointer dereferences, and a little bit of cleanup.
From Lawrence Teo (thanks!)
OK krw@
|
#
1.61 |
|
04-Apr-2011 |
millert |
Remove unused variables; from Michael W. Bombardieri
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.60 |
|
11-Feb-2011 |
guenther |
Make "crontab -l" not crash on crontab files that don't have the expected three lines of comments. Factor out the "copy a crontab" logic and merge it into ignore_comments().
ok miod@
|
#
1.59 |
|
31-Jan-2011 |
millert |
Make "crontab -e" honor TMPDIR; from the Openwall project (ldv) OK miod@ jmc@
|
Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.58 |
|
27-Oct-2009 |
deraadt |
using the rcsid is silly
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
|
#
1.57 |
|
29-Jan-2009 |
sobrado |
tweak usage()
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.56 |
|
10-May-2008 |
okan |
from ray@
- move the ignoring of the top few (3) comments into a function of its own. - ignore these comments for crontab listings.
based on a patch from Slava Semushin
ok ray@ millert@
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.55 |
|
17-Nov-2007 |
millert |
Deal with timespec vs. timeval precision issues. Fixes a problem where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
|
#
1.54 |
|
17-Oct-2007 |
deraadt |
- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
|
#
1.53 |
|
01-Sep-2007 |
ray |
Include err.h and remove unused variables.
OK millert.
|
#
1.52 |
|
31-Aug-2007 |
ray |
Copy editit() from sendbug, synchronizing editor calling code.
OK otto, millert, beck, mbalmer, deraadt.
|
Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
|
#
1.51 |
|
19-Feb-2007 |
jmc |
tidy up synopsis and usage();
|
#
1.50 |
|
13-Feb-2007 |
mglocker |
crontab -e /tmp//crontab.ynUyD24939 versus /tmp/crontab.ynUyD24939.
OK millert@
|
Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
|
#
1.49 |
|
29-Nov-2005 |
millert |
crontab.c uses the rcsid in the crontab head comment so don't protect it from lint. Found by cloder@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.48 |
|
30-Jan-2005 |
millert |
Detect editors that move the edited file out from underneath us and warn. Based on an idea from Han Boetes.
|
#
1.47 |
|
04-Nov-2004 |
millert |
Treat EOF at prompt the same as 'n' instead of looping forever. Noticed by mepch@. OK pedro@ and deraadt@
|
#
1.46 |
|
16-Sep-2004 |
deraadt |
ftruncate() with ftello() instead of ftell(); ok millert
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.45 |
|
22-Jun-2004 |
avsm |
use snprintf(3) instead of home-grown glue_strings() function millert@ ok
|
#
1.44 |
|
17-Jun-2004 |
millert |
UUpdate ISC copyright year to 2004 Remove unused macros Skip_Line and MkLower Remove trailing whitespace
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
|
#
1.43 |
|
30-Jul-2003 |
millert |
Use (char *)NULL instead of (char *)0 in execl and execle; Andrey Matveev
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.42 |
|
15-Mar-2003 |
millert |
Use strlcpy() instead of pre-checking the src len and using strcpy()
|
#
1.41 |
|
09-Mar-2003 |
millert |
Catch lines w/o EOF. Previously they were silently ignored.
|
#
1.40 |
|
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.
|
#
1.39 |
|
20-Feb-2003 |
millert |
If there is no cron.allow or cron.deny file, only the superuser may run the crontab command; for POSIX compliance. Create an empty cron.deny file to allow any user to run crontab: install -c -o root -g crontab -m 660 /dev/null /var/cron/cron.deny
|
#
1.38 |
|
18-Feb-2003 |
millert |
Use the SUN_LEN macro to set sun_len correctly
|
#
1.37 |
|
17-Feb-2003 |
millert |
Add a -n flag and version string; from vixie
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.36 |
|
10-Aug-2002 |
millert |
Just zero out pw_passwd in the pw_dup()'d copy. There's no need to do this elsewhere and my previous commit in this area caused problems on systems with an /etc/crontab file.
|
#
1.35 |
|
07-Aug-2002 |
millert |
paranoia: zero out pw_passwd since we don't need it
|
#
1.34 |
|
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.33 |
|
11-Jul-2002 |
millert |
No need to compare sizes of new/old crontab file now that we stash the st_mtimespec of the original and use that to compare.
|
#
1.32 |
|
09-Jul-2002 |
millert |
o Rename clean_turds() in crontab.c to die() and just _exit(ERROR_EXIT) instead of resetting the signal handler to SIG_DFL and redelivering.
o Use kill(2) instead of raise(3) (which is just a wrapper)
|
#
1.31 |
|
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.30 |
|
09-May-2002 |
millert |
nuke unused variable
|
#
1.29 |
|
09-May-2002 |
millert |
crontab is no longer setuid root, it is now setgid crontab. These changes were modelled after the Owl version of vixie-cron, but developed independently.
Our crontab used to send cron SIGUSR1 to tell cron to reread the spool dir. Now that crontab is not setuid root this doesn't work. Instead, crontab pokes cron via a Unix domain socket located in the tabs dir.
Please note, after these changes, the owner on user crontab files will have to be changed manually from root to the uid of the corresponding user for crontab to be usable. cron itself will accept tab files owned by either root or the user. Also, any /var/cron/{allow,deny} files must be readable by group crontab.
|
#
1.28 |
|
08-May-2002 |
millert |
o Use proper #defines; It is HAVE_*, not HAS_* o #ifdef out the -x flag getopt() stanza if not DEBUGGING
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.27 |
|
16-Feb-2002 |
millert |
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
#
1.26 |
|
20-Dec-2001 |
millert |
Cause crontab to send SIGUSR1 when a user's crontab file has changed. In cron, this interrupts the sleep() in cron_sleep() and causes cron to check to see what signal woke it up and act appropriately. This makes crontab changes take effect more or immediately.
|
#
1.25 |
|
07-Dec-2001 |
deraadt |
do not call abort(), it is tasteless
|
#
1.24 |
|
17-Nov-2001 |
deraadt |
save errno in signal handler
|
#
1.23 |
|
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_3_0_BASE
|
#
1.22 |
|
19-Aug-2001 |
millert |
Better file change detection: o when copying to temp file set utimes on temp file equal to original o use st_mtimespec instead of st_mtime for better granularity
|
#
1.21 |
|
11-Aug-2001 |
millert |
If waitpid() returns -1, check for EINTR
|
#
1.20 |
|
09-Jul-2001 |
deraadt |
correct type on last arg to execl(); nordin@cse.ogi.edu
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.19 |
|
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.18 |
|
21-Aug-2000 |
deraadt |
snprintf sprinkles; solar@false.com & I
|
#
1.17 |
|
21-Aug-2000 |
deraadt |
correct tmp file path; solar@false.com
|
#
1.16 |
|
21-Aug-2000 |
deraadt |
swap_uids_back; solar@false.com
|
Revision tags: OPENBSD_2_7_BASE
|
#
1.15 |
|
20-Nov-1999 |
millert |
Use mkstemp() for the temp file created in the tabs dir and clean up the temp file nicely if we are interupted.
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.14 |
|
29-May-1999 |
millert |
Check size as well as mtime when deciding whether or not the file was changed during edit. Crontab patch from <andrew@untraceable.net>. It may be better to simply do a real compare inline.
|
#
1.13 |
|
23-May-1999 |
aaron |
getopt(3) returns -1, not EOF
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
12-Jul-1998 |
deraadt |
disable debugging in crontab
|
Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
|
#
1.11 |
|
12-Apr-1997 |
millert |
waitpid() can return -1 -- give a useful error message if it does.
|
#
1.10 |
|
12-Apr-1997 |
deraadt |
ign some signals for editor
|
#
1.9 |
|
12-Apr-1997 |
deraadt |
support SIGSTOP in editor, I cannot believe this has always been busted!
|
#
1.8 |
|
25-Dec-1996 |
mickey |
no compile test after last change: no need for that umask too, i guess
|
#
1.7 |
|
25-Dec-1996 |
deraadt |
do not need umask for mkstemp
|
#
1.6 |
|
01-Nov-1996 |
millert |
Check malloc/strdup ret val and deal.
|
#
1.5 |
|
31-Oct-1996 |
millert |
Proper strncpy() usage.
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.4 |
|
16-Sep-1996 |
millert |
umask != file mode
|
#
1.3 |
|
15-Sep-1996 |
deraadt |
use mkstemp; mentioned by sirsyko@ishiboo.com
|
#
1.2 |
|
07-Aug-1996 |
deraadt |
buf oflow, nice error message; from freebsd
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|