CHANGES revision 2311
12311SjkhVixie Cron		Changes from V2 to V3
22311SjkhPaul Vixie
32311Sjkh29-Dec-1993
42311Sjkh
52311SjkhThe crontab command now conforms to POSIX 1003.2.  This means that when you
62311Sjkhinstall it, if you have any "crontab" command lines floating around in shell
72311Sjkhscripts (such as /etc/rc or /etc/rc.local), you will need to change them.
82311Sjkh
92311SjkhI have integrated several changes made by BSDi for their BSD/386 operating
102311Sjkhsystem; these were offerred to me before I started consulting for them, so
112311Sjkhit is safe to say that they were intended for publication.  Most notably,
122311Sjkhthe name of the cron daemon has changed from "crond" to "cron".  This was
132311Sjkhdone for compatibility with 4.3BSD.  Another change made for the same reason
142311Sjkhis the ability to read in an /etc/crontab file which has an extra field in
152311Sjkheach entry, between the time fields and the command.  This field is a user
162311Sjkhname, and it permits the /etc/crontab command to contain commands which are
172311Sjkhto be run by any user on the system.  /etc/crontab is not "installed" via
182311Sjkhthe crontab(1) command; it is automatically read at startup time and it will
192311Sjkhbe reread whenever it changes.
202311Sjkh
212311SjkhI also added a "-e" option to crontab(1).  Nine people also sent me diffs
222311Sjkhto add this option, but I had already implemented it on my own.  I actually
232311Sjkhreleased an interrim version (V2.2, I think) for limited testing, and got a
242311Sjkhchance to fix a bad security bug in the "-e" option thanks to XXX.
252311Sjkh
262311SjkhThe daemon used to be extraordinarily sloppy in its use of file descriptors.
272311SjkhA heck of a lot of them were left open in spawned jobs, which caused problems
282311Sjkhfor the daemon and also caused problems with the spawned jobs if they were 
292311Sjkhshell scripts since "sh" and "csh" have traditionally used hidden file
302311Sjkhdescriptors to pass information to subshells, and cron was causing them to
312311Sjkhthink they were subshells.  If you had trouble with "sh" or "csh" scripts in
322311SjkhV2, chances are good that V3 will fix your problems.
332311Sjkh
342311SjkhAbout a dozen people have reminded me that I forgot to initialize
352311Sjkh"crontab_fd" in database.c.  Keith Cantrell was the first, so he gets the
362311Sjkhpoint.
372311Sjkh
382311SjkhSteve Simmons reminded me that once an account has been deleted from the
392311Sjkhsystem, "crontab -u USER -d" will not work.  My solution is to suggest to
402311Sjkhall of you that before you delete a user's account, you first delete that
412311Sjkhuser's crontab file if any.  From cron's point of view, usernames can never
422311Sjkhbe treated as arbitrary strings.  Either they are valid user names, or they
432311Sjkhare not.  I will not make an exception for the "-d" case, for security
442311Sjkhreasons that I consider reasonable.  It is trivial for a root user to delete
452311Sjkhthe entry by hand if necessary.
462311Sjkh
472311SjkhDan O'Neil reminded me that I forgot to reset "log_fd" in misc.c.  A lot of
482311Sjkhothers also reminded me of this, but Dan gets the point.  I didn't fix it
492311Sjkhthere, since the real bug was that it should have been open in the parent.
502311Sjkh
512311SjkhPeter Kabal reminded me that I forgot to "#ifdef DEBUGGING" some code in
522311Sjkhmisc.c.  Hans Trompert actually told me first, but Peter sent the patch so
532311Sjkhhe gets the point.
542311Sjkh
552311SjkhRussell Nelson told me that I'd forgotten to "#include <syslog.h>" in misc.c,
562311Sjkhwhich explains why a lot of other people complained that it wasn't using
572311Sjkhsyslog even when they configured it that way :-).  Steve Simmons told me
582311Sjkhfirst, though, so he gets the point.
592311Sjkh
602311SjkhAn interrim version of the daemon tried to "stat" every file before
612311Sjkhexecuting it; this turned out to be a horribly bad idea since finding the
622311Sjkhname of a file from a shell command is a hard job (that's why we have
632311Sjkhshells, right?)  I removed this bogus code.  Dave Burgess gets the point.
642311Sjkh
652311SjkhDennis R. Conley sent a suggestion for MMDF systems, which I've added to the
662311Sjkhcomments in cron.h.
672311Sjkh
682311SjkhMike Heisler noted that I use comments in the CONVERSION file which are
692311Sjkhdocumented as illegal in the man pages.  Thanks, Mike.
702311Sjkh
712311SjkhIrving Wolfe sent me some very cheerful changes for a NeXT system, but I
722311Sjkhconsider the system itself broken and I can't bring myself to #ifdef for
732311Sjkhsomething as screwed up as this system seems to be.  However, various others
742311Sjkhdid send me smaller patches which appear to have cause cron to build and run
752311Sjkhcorrectly on (the latest) NeXT machines, with or without the "-posix" CFLAG.
762311SjkhIrving also asked for a per-job MAILTO, and this was finally added later when
772311SjkhI integrated the BSD/386 changes contributed by BSDi, and generalized some of
782311Sjkhthe parsing.
792311Sjkh
802311SjkhLots of folks complained that the autogenerated "Date:" header wasn't in
812311SjkhARPA format.  I didn't understand this -- either folks will use Sendmail and
822311Sjkhnot generate a Date:  at all (since Sendmail will do it), or folks will use
832311Sjkhsomething other than Sendmail which won't care about Date: formats.  But
842311SjkhI've "fixed" it anyway...
852311Sjkh
862311SjkhSeveral people suggested that "*" should be able to take a "/step".  One person
872311Sjkhsuggested that "N/step" ought to mean "N-last/step", but that's stretching things
882311Sjkha bit far.  "*/step" seems quite intuitive to me, so I've added it.  Colin Plumb
892311Sjkhsent in the first and most polite request for this feature.
902311Sjkh
912311SjkhAs with every release of Cron, BIND, and seemingly everything else I do, one
922311Sjkhuser stands out with the most critical but also the most useful analysis.
932311SjkhCron V3's high score belongs to Peter Holzer, who sent in the nicest looking
942311Sjkhpatch for the "%" interpretation problem and also helped me understand a
952311Sjkhtricky bit of badness in the "log_fd" problem.
962311Sjkh
972311Sjkhagulbra@flode.nvg.unit.no wins the honors for being the first to point out the
982311Sjkhnasty security hole in "crontab -r".  'Nuff said.
992311Sjkh
1002311SjkhSeveral folks pointed out that log_it() needed to exist even if logging was
1012311Sjkhdisabled.  Some day I will create a tool that will compile a subsystem with
1022311Sjkhevery possible combination and permutation of #ifdef options, but meanwhile
1032311Sjkhthanks to everybody.
1042311Sjkh
1052311Sjkhjob_runqueue() was using storage after freeing it, since Jordan told me back
1062311Sjkhin 1983 that C let you do that, and I believed him in 1986 when I wrote all
1072311Sjkhthis junk.  Linux was the first to die from this error, and the Linux people
1082311Sjkhsent me the most amazing, um, collection of patches for this problem.  Thanks
1092311Sjkhfor all the fish.
1102311Sjkh
1112311SjkhJeremy Bettis reminded me that popen() isn't safe.  I grabbed Ken Arnold's 
1122311Sjkhversion of popen/pclose from the ftpd and hacked it to taste.  We're safe now,
1132311Sjkhfrom this at least.
1142311Sjkh
1152311SjkhBranko Lankester sent me a very timely and helpful fix for a looming security
1162311Sjkhproblem in my "crontab -e" implementation.
1172311Sjkh
1182311Sjkh--------
1192311Sjkh
1202311SjkhVixie Cron		Changes from V1 to V2
1212311SjkhPaul Vixie
1222311Sjkh8-Feb-1988
1232311Sjkh
1242311SjkhMany changes were made in a rash of activity about six months ago, the exact
1252311Sjkhlist of which is no longer clear in my memory.  I know that V1 used a file
1262311Sjkhcalled POKECRON in /usr/spool/cron to tell it that it was time to re-read
1272311Sjkhall the crontab files; V2 uses the modtime the crontab directory as a flag to
1282311Sjkhcheck out the crontab files; those whose modtime has changed will be re-read,
1292311Sjkhand the others left alone.  Note that the crontab(1) command will do a utimes
1302311Sjkhcall to make sure the mtime of the dir changes, since the filename/inode will
1312311Sjkhoften remain the same after a replacement and the mtime wouldn't change in
1322311Sjkhthat case.
1332311Sjkh
1342311Sjkh8-Feb-88: made it possible to use much larger environment variable strings.
1352311Sjkh	V1 allowed 100 characters; V2 allows 1000.  This was needed for PATH
1362311Sjkh	variables on some systems.  Thanks to Toerless Eckert for this idea.
1372311Sjkh	E-mail: UUCP: ...pyramid!fauern!faui10!eckert
1382311Sjkh
1392311Sjkh16-Feb-88: added allow/deny, moved /usr/spool/cron/crontabs to
1402311Sjkh	/usr/lib/cron/tabs.  allow and deny are /usr/lib/cron/{allow,deny},
1412311Sjkh	since the sysv naming for this depends on 'at' using the same
1422311Sjkh	dir, which would be stupid (hint: use /usr/{lib,spool}/at).
1432311Sjkh
1442311Sjkh22-Feb-88: made it read the spool directory for crontabs and look each one
1452311Sjkh	up using getpwnam() rather than reading all passwds with getpwent()
1462311Sjkh	and trying to open each crontab.
1472311Sjkh
1482311Sjkh9-Dec-88: made it sync to :00 after the minute, makes cron predictable.
1492311Sjkh	added logging to /var/cron/log.
1502311Sjkh
1512311Sjkh14-Apr-90: (actually, changes since December 1989)
1522311Sjkh	fixed a number of bugs reported from the net and from John Gilmore.
1532311Sjkh	added syslog per Keith Bostic.  security features including not
1542311Sjkh	being willing to run a command owned or writable by other than
1552311Sjkh	the owner of the crontab 9not working well yet)
156