186d7f5d3SJohn MarinoVixie Cron Changes from V2 to V3 286d7f5d3SJohn MarinoPaul Vixie 386d7f5d3SJohn Marino29-Dec-1993 486d7f5d3SJohn Marino 586d7f5d3SJohn MarinoThe crontab command now conforms to POSIX 1003.2. This means that when you 686d7f5d3SJohn Marinoinstall it, if you have any "crontab" command lines floating around in shell 786d7f5d3SJohn Marinoscripts (such as /etc/rc or /etc/rc.local), you will need to change them. 886d7f5d3SJohn Marino 986d7f5d3SJohn MarinoI have integrated several changes made by BSDi for their BSD/386 operating 1086d7f5d3SJohn Marinosystem; these were offerred to me before I started consulting for them, so 1186d7f5d3SJohn Marinoit is safe to say that they were intended for publication. Most notably, 1286d7f5d3SJohn Marinothe name of the cron daemon has changed from "crond" to "cron". This was 1386d7f5d3SJohn Marinodone for compatibility with 4.3BSD. Another change made for the same reason 1486d7f5d3SJohn Marinois the ability to read in an /etc/crontab file which has an extra field in 1586d7f5d3SJohn Marinoeach entry, between the time fields and the command. This field is a user 1686d7f5d3SJohn Marinoname, and it permits the /etc/crontab command to contain commands which are 1786d7f5d3SJohn Marinoto be run by any user on the system. /etc/crontab is not "installed" via 1886d7f5d3SJohn Marinothe crontab(1) command; it is automatically read at startup time and it will 1986d7f5d3SJohn Marinobe reread whenever it changes. 2086d7f5d3SJohn Marino 2186d7f5d3SJohn MarinoI also added a "-e" option to crontab(1). Nine people also sent me diffs 2286d7f5d3SJohn Marinoto add this option, but I had already implemented it on my own. I actually 2386d7f5d3SJohn Marinoreleased an interrim version (V2.2, I think) for limited testing, and got a 2486d7f5d3SJohn Marinochance to fix a bad security bug in the "-e" option thanks to XXX. 2586d7f5d3SJohn Marino 2686d7f5d3SJohn MarinoThe daemon used to be extraordinarily sloppy in its use of file descriptors. 2786d7f5d3SJohn MarinoA heck of a lot of them were left open in spawned jobs, which caused problems 2886d7f5d3SJohn Marinofor the daemon and also caused problems with the spawned jobs if they were 2986d7f5d3SJohn Marinoshell scripts since "sh" and "csh" have traditionally used hidden file 3086d7f5d3SJohn Marinodescriptors to pass information to subshells, and cron was causing them to 3186d7f5d3SJohn Marinothink they were subshells. If you had trouble with "sh" or "csh" scripts in 3286d7f5d3SJohn MarinoV2, chances are good that V3 will fix your problems. 3386d7f5d3SJohn Marino 3486d7f5d3SJohn MarinoAbout a dozen people have reminded me that I forgot to initialize 3586d7f5d3SJohn Marino"crontab_fd" in database.c. Keith Cantrell was the first, so he gets the 3686d7f5d3SJohn Marinopoint. 3786d7f5d3SJohn Marino 3886d7f5d3SJohn MarinoSteve Simmons reminded me that once an account has been deleted from the 3986d7f5d3SJohn Marinosystem, "crontab -u USER -d" will not work. My solution is to suggest to 4086d7f5d3SJohn Marinoall of you that before you delete a user's account, you first delete that 4186d7f5d3SJohn Marinouser's crontab file if any. From cron's point of view, usernames can never 4286d7f5d3SJohn Marinobe treated as arbitrary strings. Either they are valid user names, or they 4386d7f5d3SJohn Marinoare not. I will not make an exception for the "-d" case, for security 4486d7f5d3SJohn Marinoreasons that I consider reasonable. It is trivial for a root user to delete 4586d7f5d3SJohn Marinothe entry by hand if necessary. 4686d7f5d3SJohn Marino 4786d7f5d3SJohn MarinoDan O'Neil reminded me that I forgot to reset "log_fd" in misc.c. A lot of 4886d7f5d3SJohn Marinoothers also reminded me of this, but Dan gets the point. I didn't fix it 4986d7f5d3SJohn Marinothere, since the real bug was that it should have been open in the parent. 5086d7f5d3SJohn Marino 5186d7f5d3SJohn MarinoPeter Kabal reminded me that I forgot to "#ifdef DEBUGGING" some code in 5286d7f5d3SJohn Marinomisc.c. Hans Trompert actually told me first, but Peter sent the patch so 5386d7f5d3SJohn Marinohe gets the point. 5486d7f5d3SJohn Marino 5586d7f5d3SJohn MarinoRussell Nelson told me that I'd forgotten to "#include <syslog.h>" in misc.c, 5686d7f5d3SJohn Marinowhich explains why a lot of other people complained that it wasn't using 5786d7f5d3SJohn Marinosyslog even when they configured it that way :-). Steve Simmons told me 5886d7f5d3SJohn Marinofirst, though, so he gets the point. 5986d7f5d3SJohn Marino 6086d7f5d3SJohn MarinoAn interrim version of the daemon tried to "stat" every file before 6186d7f5d3SJohn Marinoexecuting it; this turned out to be a horribly bad idea since finding the 6286d7f5d3SJohn Marinoname of a file from a shell command is a hard job (that's why we have 6386d7f5d3SJohn Marinoshells, right?) I removed this bogus code. Dave Burgess gets the point. 6486d7f5d3SJohn Marino 6586d7f5d3SJohn MarinoDennis R. Conley sent a suggestion for MMDF systems, which I've added to the 6686d7f5d3SJohn Marinocomments in cron.h. 6786d7f5d3SJohn Marino 6886d7f5d3SJohn MarinoMike Heisler noted that I use comments in the CONVERSION file which are 6986d7f5d3SJohn Marinodocumented as illegal in the man pages. Thanks, Mike. 7086d7f5d3SJohn Marino 7186d7f5d3SJohn MarinoIrving Wolfe sent me some very cheerful changes for a NeXT system, but I 7286d7f5d3SJohn Marinoconsider the system itself broken and I can't bring myself to #ifdef for 7386d7f5d3SJohn Marinosomething as screwed up as this system seems to be. However, various others 7486d7f5d3SJohn Marinodid send me smaller patches which appear to have cause cron to build and run 7586d7f5d3SJohn Marinocorrectly on (the latest) NeXT machines, with or without the "-posix" CFLAG. 7686d7f5d3SJohn MarinoIrving also asked for a per-job MAILTO, and this was finally added later when 7786d7f5d3SJohn MarinoI integrated the BSD/386 changes contributed by BSDi, and generalized some of 7886d7f5d3SJohn Marinothe parsing. 7986d7f5d3SJohn Marino 8086d7f5d3SJohn MarinoLots of folks complained that the autogenerated "Date:" header wasn't in 8186d7f5d3SJohn MarinoARPA format. I didn't understand this -- either folks will use Sendmail and 8286d7f5d3SJohn Marinonot generate a Date: at all (since Sendmail will do it), or folks will use 8386d7f5d3SJohn Marinosomething other than Sendmail which won't care about Date: formats. But 8486d7f5d3SJohn MarinoI've "fixed" it anyway... 8586d7f5d3SJohn Marino 8686d7f5d3SJohn MarinoSeveral people suggested that "*" should be able to take a "/step". One person 8786d7f5d3SJohn Marinosuggested that "N/step" ought to mean "N-last/step", but that's stretching things 8886d7f5d3SJohn Marinoa bit far. "*/step" seems quite intuitive to me, so I've added it. Colin Plumb 8986d7f5d3SJohn Marinosent in the first and most polite request for this feature. 9086d7f5d3SJohn Marino 9186d7f5d3SJohn MarinoAs with every release of Cron, BIND, and seemingly everything else I do, one 9286d7f5d3SJohn Marinouser stands out with the most critical but also the most useful analysis. 9386d7f5d3SJohn MarinoCron V3's high score belongs to Peter Holzer, who sent in the nicest looking 9486d7f5d3SJohn Marinopatch for the "%" interpretation problem and also helped me understand a 9586d7f5d3SJohn Marinotricky bit of badness in the "log_fd" problem. 9686d7f5d3SJohn Marino 9786d7f5d3SJohn Marinoagulbra@flode.nvg.unit.no wins the honors for being the first to point out the 9886d7f5d3SJohn Marinonasty security hole in "crontab -r". 'Nuff said. 9986d7f5d3SJohn Marino 10086d7f5d3SJohn MarinoSeveral folks pointed out that log_it() needed to exist even if logging was 10186d7f5d3SJohn Marinodisabled. Some day I will create a tool that will compile a subsystem with 10286d7f5d3SJohn Marinoevery possible combination and permutation of #ifdef options, but meanwhile 10386d7f5d3SJohn Marinothanks to everybody. 10486d7f5d3SJohn Marino 10586d7f5d3SJohn Marinojob_runqueue() was using storage after freeing it, since Jordan told me back 10686d7f5d3SJohn Marinoin 1983 that C let you do that, and I believed him in 1986 when I wrote all 10786d7f5d3SJohn Marinothis junk. Linux was the first to die from this error, and the Linux people 10886d7f5d3SJohn Marinosent me the most amazing, um, collection of patches for this problem. Thanks 10986d7f5d3SJohn Marinofor all the fish. 11086d7f5d3SJohn Marino 11186d7f5d3SJohn MarinoJeremy Bettis reminded me that popen() isn't safe. I grabbed Ken Arnold's 11286d7f5d3SJohn Marinoversion of popen/pclose from the ftpd and hacked it to taste. We're safe now, 11386d7f5d3SJohn Marinofrom this at least. 11486d7f5d3SJohn Marino 11586d7f5d3SJohn MarinoBranko Lankester sent me a very timely and helpful fix for a looming security 11686d7f5d3SJohn Marinoproblem in my "crontab -e" implementation. 11786d7f5d3SJohn Marino 11886d7f5d3SJohn Marino-------- 11986d7f5d3SJohn Marino 12086d7f5d3SJohn MarinoVixie Cron Changes from V1 to V2 12186d7f5d3SJohn MarinoPaul Vixie 12286d7f5d3SJohn Marino8-Feb-1988 12386d7f5d3SJohn Marino 12486d7f5d3SJohn MarinoMany changes were made in a rash of activity about six months ago, the exact 12586d7f5d3SJohn Marinolist of which is no longer clear in my memory. I know that V1 used a file 12686d7f5d3SJohn Marinocalled POKECRON in /usr/spool/cron to tell it that it was time to re-read 12786d7f5d3SJohn Marinoall the crontab files; V2 uses the modtime the crontab directory as a flag to 12886d7f5d3SJohn Marinocheck out the crontab files; those whose modtime has changed will be re-read, 12986d7f5d3SJohn Marinoand the others left alone. Note that the crontab(1) command will do a utimes 13086d7f5d3SJohn Marinocall to make sure the mtime of the dir changes, since the filename/inode will 13186d7f5d3SJohn Marinooften remain the same after a replacement and the mtime wouldn't change in 13286d7f5d3SJohn Marinothat case. 13386d7f5d3SJohn Marino 13486d7f5d3SJohn Marino8-Feb-88: made it possible to use much larger environment variable strings. 13586d7f5d3SJohn Marino V1 allowed 100 characters; V2 allows 1000. This was needed for PATH 13686d7f5d3SJohn Marino variables on some systems. Thanks to Toerless Eckert for this idea. 13786d7f5d3SJohn Marino E-mail: UUCP: ...pyramid!fauern!faui10!eckert 13886d7f5d3SJohn Marino 13986d7f5d3SJohn Marino16-Feb-88: added allow/deny, moved /usr/spool/cron/crontabs to 14086d7f5d3SJohn Marino /usr/lib/cron/tabs. allow and deny are /usr/lib/cron/{allow,deny}, 14186d7f5d3SJohn Marino since the sysv naming for this depends on 'at' using the same 14286d7f5d3SJohn Marino dir, which would be stupid (hint: use /usr/{lib,spool}/at). 14386d7f5d3SJohn Marino 14486d7f5d3SJohn Marino22-Feb-88: made it read the spool directory for crontabs and look each one 14586d7f5d3SJohn Marino up using getpwnam() rather than reading all passwds with getpwent() 14686d7f5d3SJohn Marino and trying to open each crontab. 14786d7f5d3SJohn Marino 14886d7f5d3SJohn Marino9-Dec-88: made it sync to :00 after the minute, makes cron predictable. 14986d7f5d3SJohn Marino added logging to /var/cron/log. 15086d7f5d3SJohn Marino 15186d7f5d3SJohn Marino14-Apr-90: (actually, changes since December 1989) 15286d7f5d3SJohn Marino fixed a number of bugs reported from the net and from John Gilmore. 15386d7f5d3SJohn Marino added syslog per Keith Bostic. security features including not 15486d7f5d3SJohn Marino being willing to run a command owned or writable by other than 15586d7f5d3SJohn Marino the owner of the crontab 9not working well yet) 156