1$FreeBSD$ 2-------- 3 4Vixie Cron Changes from V2 to V3 5Paul Vixie 629-Dec-1993 7 8The crontab command now conforms to POSIX 1003.2. This means that when you 9install it, if you have any "crontab" command lines floating around in shell 10scripts (such as /etc/rc or /etc/rc.local), you will need to change them. 11 12I have integrated several changes made by BSDi for their BSD/386 operating 13system; these were offerred to me before I started consulting for them, so 14it is safe to say that they were intended for publication. Most notably, 15the name of the cron daemon has changed from "crond" to "cron". This was 16done for compatibility with 4.3BSD. Another change made for the same reason 17is the ability to read in an /etc/crontab file which has an extra field in 18each entry, between the time fields and the command. This field is a user 19name, and it permits the /etc/crontab command to contain commands which are 20to be run by any user on the system. /etc/crontab is not "installed" via 21the crontab(1) command; it is automatically read at startup time and it will 22be reread whenever it changes. 23 24I also added a "-e" option to crontab(1). Nine people also sent me diffs 25to add this option, but I had already implemented it on my own. I actually 26released an interim version (V2.2, I think) for limited testing, and got a 27chance to fix a bad security bug in the "-e" option thanks to XXX. 28 29The daemon used to be extraordinarily sloppy in its use of file descriptors. 30A heck of a lot of them were left open in spawned jobs, which caused problems 31for the daemon and also caused problems with the spawned jobs if they were 32shell scripts since "sh" and "csh" have traditionally used hidden file 33descriptors to pass information to subshells, and cron was causing them to 34think they were subshells. If you had trouble with "sh" or "csh" scripts in 35V2, chances are good that V3 will fix your problems. 36 37About a dozen people have reminded me that I forgot to initialize 38"crontab_fd" in database.c. Keith Cantrell was the first, so he gets the 39point. 40 41Steve Simmons reminded me that once an account has been deleted from the 42system, "crontab -u USER -d" will not work. My solution is to suggest to 43all of you that before you delete a user's account, you first delete that 44user's crontab file if any. From cron's point of view, usernames can never 45be treated as arbitrary strings. Either they are valid user names, or they 46are not. I will not make an exception for the "-d" case, for security 47reasons that I consider reasonable. It is trivial for a root user to delete 48the entry by hand if necessary. 49 50Dan O'Neil reminded me that I forgot to reset "log_fd" in misc.c. A lot of 51others also reminded me of this, but Dan gets the point. I didn't fix it 52there, since the real bug was that it should have been open in the parent. 53 54Peter Kabal reminded me that I forgot to "#ifdef DEBUGGING" some code in 55misc.c. Hans Trompert actually told me first, but Peter sent the patch so 56he gets the point. 57 58Russell Nelson told me that I'd forgotten to "#include <syslog.h>" in misc.c, 59which explains why a lot of other people complained that it wasn't using 60syslog even when they configured it that way :-). Steve Simmons told me 61first, though, so he gets the point. 62 63An interim version of the daemon tried to "stat" every file before 64executing it; this turned out to be a horribly bad idea since finding the 65name of a file from a shell command is a hard job (that's why we have 66shells, right?) I removed this bogus code. Dave Burgess gets the point. 67 68Dennis R. Conley sent a suggestion for MMDF systems, which I've added to the 69comments in cron.h. 70 71Mike Heisler noted that I use comments in the CONVERSION file which are 72documented as illegal in the man pages. Thanks, Mike. 73 74Irving Wolfe sent me some very cheerful changes for a NeXT system, but I 75consider the system itself broken and I can't bring myself to #ifdef for 76something as screwed up as this system seems to be. However, various others 77did send me smaller patches which appear to have cause cron to build and run 78correctly on (the latest) NeXT machines, with or without the "-posix" CFLAG. 79Irving also asked for a per-job MAILTO, and this was finally added later when 80I integrated the BSD/386 changes contributed by BSDi, and generalized some of 81the parsing. 82 83Lots of folks complained that the autogenerated "Date:" header wasn't in 84ARPA format. I didn't understand this -- either folks will use Sendmail and 85not generate a Date: at all (since Sendmail will do it), or folks will use 86something other than Sendmail which won't care about Date: formats. But 87I've "fixed" it anyway... 88 89Several people suggested that "*" should be able to take a "/step". One person 90suggested that "N/step" ought to mean "N-last/step", but that's stretching things 91a bit far. "*/step" seems quite intuitive to me, so I've added it. Colin Plumb 92sent in the first and most polite request for this feature. 93 94As with every release of Cron, BIND, and seemingly everything else I do, one 95user stands out with the most critical but also the most useful analysis. 96Cron V3's high score belongs to Peter Holzer, who sent in the nicest looking 97patch for the "%" interpretation problem and also helped me understand a 98tricky bit of badness in the "log_fd" problem. 99 100agulbra@flode.nvg.unit.no wins the honors for being the first to point out the 101nasty security hole in "crontab -r". 'Nuff said. 102 103Several folks pointed out that log_it() needed to exist even if logging was 104disabled. Some day I will create a tool that will compile a subsystem with 105every possible combination and permutation of #ifdef options, but meanwhile 106thanks to everybody. 107 108job_runqueue() was using storage after freeing it, since Jordan told me back 109in 1983 that C let you do that, and I believed him in 1986 when I wrote all 110this junk. Linux was the first to die from this error, and the Linux people 111sent me the most amazing, um, collection of patches for this problem. Thanks 112for all the fish. 113 114Jeremy Bettis reminded me that popen() isn't safe. I grabbed Ken Arnold's 115version of popen/pclose from the ftpd and hacked it to taste. We're safe now, 116from this at least. 117 118Branko Lankester sent me a very timely and helpful fix for a looming security 119problem in my "crontab -e" implementation. 120 121-------- 122 123Vixie Cron Changes from V1 to V2 124Paul Vixie 1258-Feb-1988 126 127Many changes were made in a rash of activity about six months ago, the exact 128list of which is no longer clear in my memory. I know that V1 used a file 129called POKECRON in /usr/spool/cron to tell it that it was time to re-read 130all the crontab files; V2 uses the modtime the crontab directory as a flag to 131check out the crontab files; those whose modtime has changed will be re-read, 132and the others left alone. Note that the crontab(1) command will do a utimes 133call to make sure the mtime of the dir changes, since the filename/inode will 134often remain the same after a replacement and the mtime wouldn't change in 135that case. 136 1378-Feb-88: made it possible to use much larger environment variable strings. 138 V1 allowed 100 characters; V2 allows 1000. This was needed for PATH 139 variables on some systems. Thanks to Toerless Eckert for this idea. 140 E-mail: UUCP: ...pyramid!fauern!faui10!eckert 141 14216-Feb-88: added allow/deny, moved /usr/spool/cron/crontabs to 143 /usr/lib/cron/tabs. allow and deny are /usr/lib/cron/{allow,deny}, 144 since the sysv naming for this depends on 'at' using the same 145 dir, which would be stupid (hint: use /usr/{lib,spool}/at). 146 14722-Feb-88: made it read the spool directory for crontabs and look each one 148 up using getpwnam() rather than reading all passwds with getpwent() 149 and trying to open each crontab. 150 1519-Dec-88: made it sync to :00 after the minute, makes cron predictable. 152 added logging to /var/cron/log. 153 15414-Apr-90: (actually, changes since December 1989) 155 fixed a number of bugs reported from the net and from John Gilmore. 156 added syslog per Keith Bostic. security features including not 157 being willing to run a command owned or writable by other than 158 the owner of the crontab 9not working well yet) 159