Commit graph

245 commits

Author SHA1 Message Date
David Nugent 4a9e66b57b Fix a possible NULL reference that would be triggered
by invalid input in /etc/crontab.

MFC after:	2 days
2001-07-20 06:46:48 +00:00
David E. O'Brien 90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Dima Dorfman b30f37abbb Remove an unused variable, and don't try to print a char[] using %d.
Submitted by:	Mark Peek <mark@whistle.com>
2001-07-18 11:49:45 +00:00
Dima Dorfman 5d3e1fcab1 free_entry(): Don't free e->envp if it's already NULL; likewise for
e->cmd.  free_entry() now does the right thing with
partially-initialized structures.

load_entry(): Don't call env_free() on e->envp throughout the routine
before jumping to eof; the free_entry() call at that label will take
care of it.  The previous behavior resulted in e->envp being free'd
twice (well, the second time would usually result in a crash, but
that's besides the point); once in load_entry(), and once in
free_entry() after the former called the latter.  Also note that the
check added to free_entry() (above) doesn't help, since e->envp wasn't
reset to NULL after env_free().

Submitted by:	Mark Peek <mark@whistle.com>
2001-07-18 11:48:00 +00:00
Dima Dorfman f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Brian Somers 7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Peter Wemm d952a14dbb Where is the pointy hat? Fix cut/paste error. (hey, it compiled! :-) 2001-06-16 03:16:52 +00:00
Dima Dorfman fa0590b3d3 Plug two memory leaks: call login_close() after login_getclass(), and
use free_entry() instead of free() to free a struct _entry.

PR:		28108
Submitted by:	Mark Peek <mark@whistle.com>
2001-06-13 05:49:37 +00:00
Peter Wemm 8966f5046e Remove the 'DO NOT EDIT THIS FILE' crud that we spit out with 'crontab -l'.
Otherwise, "crontab -l > file; vi file; crontab file" adds an extra set
of "DO NOT EDIT" markers each and every time which is a bit silly.
2001-04-13 01:45:22 +00:00
Ruslan Ermilov 345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Peter Wemm c7517d5af9 Stop cron from shouting in the syslog. Use setproctitle() instead, since
smashing argv[0] doesn't have the intended effect of changing the ps(1)
output these days.

PR:		25850
2001-03-17 00:21:54 +00:00
Ruslan Ermilov ac94747952 mdoc(7) police revision 1.15:
- replaced Oo/Oc enclosures with Op;
- removed hard sentence breaks;
- removed doubled space.
2001-03-09 11:02:01 +00:00
Sergey Babkin 404363cc17 The new version of the daylight time saving support. This time it works
for any change of the time zone offset from GMT. To enable use the
option -s.
2001-03-09 03:14:09 +00:00
Peter Wemm 1db78faf47 Properly detach at startup. We could be passing revoked fd's to
child processes or starting children with no fd 0 (stdin) at all etc.
This is currently breaking on hub.freebsd.org.
2001-03-07 10:38:46 +00:00
Jeroen Ruigrok van der Werven 1a6e52d0e9 Fix typo: seperate -> separate.
Seperate does not exist in the english language.
2001-02-06 11:21:58 +00:00
Ruslan Ermilov 610a5778c5 mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:44:04 +00:00
Sergey Babkin 6548bd5646 Backed out the DST support changes. 2001-01-23 01:17:40 +00:00
Ruslan Ermilov 9c11143f2c mdoc(7) police: ``Ds'' is not certified (no macro with such name exist)
to be used as the -width parameter, it is provided solely for backwards
compatibility with old mdoc(7).  To make this work, mdocNG is forced to
provide a dummy ``Ds'' macro.
2001-01-22 10:27:07 +00:00
Sergey Babkin be821963c1 Made the special handling of the daylight time switches optional,
enabled by the option "-s" (for dSt). This returned the default behavior
to its original form.

The new option name is not "-d" because that would cause associations with
"debug" and cron already has "-x" for debugging, so this would cause
confusion.
2001-01-22 01:54:51 +00:00
Sergey Babkin 08b2398e6d Added sensible handling of switch to and from daylight saving time
for the jobs that fall into the disappearing or duplicated time
interval.

PR:		bin/24494
2001-01-20 21:28:16 +00:00
Ruslan Ermilov c5083414f8 mdoc(7) police: removed leading whitespaces that are not inside
Bd/Ed; these hardly degrade the quality of the produced output.
2001-01-19 14:15:40 +00:00
Ruslan Ermilov 1bfea903ed Prepare for mdoc(7)NG. 2001-01-16 09:39:23 +00:00
David E. O'Brien 1a37aa566b Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
Kris Kennaway f313a39933 Correct definition of MAXHOSTNAMELEN in ifdef'ed out code 2000-11-26 22:21:39 +00:00
Ruslan Ermilov e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Ruslan Ermilov 726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
David Malone 25e9ca2b19 Attempt to fix problem with users being able to convince the crontab
program to read any file which is a valid crontab file.

The fix is based on that used in NetBSD and OpenBSD - we keep the
file open while the user is editing it. This means that files must
be edited in place. Cron attempts to warn you if your editor does
not do this. The fact that the file must be edited in place is also
noted in the man page.

This patch has been confirmed to work by atleast one person on
-security and has been tested locally.

Obtained from:	OpenBSD
2000-11-06 11:17:37 +00:00
Paul Richards 30cfb24129 Since -e and -r are right next to each other prompt before clobbering
a crontab you were planning to edit.
2000-10-15 00:35:34 +00:00
Andrey A. Chernov 3d99cebff4 Call login_close() to prevent parent from memory leaking in some
cases due to vfork()
2000-07-02 04:15:15 +00:00
Andrey A. Chernov fe46d6a8f3 Prevent user from breaking his limits and restrictions or
abusing sendmail by any other way via MAILTO tag (since sendmail is running
from daemon). Now run sendmail from user, as any other cron user command.

Obtained from:	Inspired by OpenBSD, but implementation is different
2000-07-01 22:58:16 +00:00
Andrey A. Chernov c38d808de1 Make sure argv gets NULL terminated if cron entry has >= MAX_ARGS arguments
Obtained from:	OpenBSD popen.c v1.3
2000-07-01 22:37:02 +00:00
Andrey A. Chernov 5e4a74ec02 Enable SIGCHLD to stop childs complaining to SIG_IGN of it.
It helps perl f.e.

Obtained from:	OpenBSD do_command.c v1.7
2000-07-01 21:25:33 +00:00
Guy Helmer 64ae78cb9d Catch and report fdopen failures. 2000-05-23 13:46:04 +00:00
Guy Helmer 5c7cba96bc Catch and report memory allocation failures. 2000-05-23 13:44:00 +00:00
Guy Helmer d02e530b50 Allocate space for arrays of type "char *", not "char **".
Rev 1.8 made the type consistently incorrect.

Noted by:	Ben Smithurst <ben@scientia.demon.co.uk>
2000-04-30 15:57:00 +00:00
Guy Helmer 8261236de4 Fix a situation where a pointer which should point to dynamically
allocated memory was instead pointed to a static string.  A later
free() on the value of the pointer was a possible source of reported
"warning: pointer to wrong page" messages from cron.

Use consistent types in sizeof when malloc'ing memory for the
environment.

PR:		kern/12248, bin/11169, bin/9722
2000-04-28 15:31:28 +00:00
Sheldon Hearn c3e1da6b96 Revive rev 1.12 (NetBSD improvements including @ shortcuts). 2000-03-14 14:51:55 +00:00
Guy Helmer 5b0e9f8cb1 Fix parsing of commands after @ keywords (@hourly, @daily, etc.).
Fix setting of "hour" bitmap when @hourly keyword is specified.

MFC candidate after 4.0-RELEASE.

Problem-found-by: Sheldon Hearn <sheldonh@uunet.co.za>
2000-03-13 19:21:17 +00:00
Sheldon Hearn 465c6ce100 Back out previous commit. The code is not ready for it. 2000-03-13 19:13:48 +00:00
Sheldon Hearn 874072c7bb Merge in NetBSD improvements:
* Clarify quoting value in of name = value pairs.
	* Describe the @reboot, @yearly, @annually, @monthly, @weekly,
	  @daily, @midnight and @hourly extensions.

PR:		17261
Submitted by:	MIHIRA Yoshiro <sanpei@sanpei.org>
Obtained from:	NetBSD
2000-03-08 11:48:01 +00:00
Peter Wemm 97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Chris Costello 866d7f2809 Bad reference of su(8) changed to su(1). 1999-08-14 06:34:50 +00:00
Sheldon Hearn 81f4b03663 Christen a BUGS section for an explanation of the impact of Daylight
Savings Time on cron(8). If we ever introduce some work-around code for
handling jobs scheduled for a time that "doesn't happen" due to DST,
the section should be renamed to IMPLEMENTATION NOTES.

PR:	10947
Reported by:	Scott Drassinower <scottd@cloud9.net>
Submitted by:	Seth Bromberger <seth@freebie.dp.ny.frb.org>
Reviewed by:	mpp
1999-08-11 13:00:19 +00:00
Nick Hibma d2a864e4ba Changed 'overriding what /etc/passwd says' to 'overriding default set
by cron'

PR:		12520
Submitted by:	(not specified)
1999-07-27 16:39:02 +00:00
Peter Wemm 5ef4895832 This is a hack. Cron runs with stdin/out/err pointing to /dev/console,
which init thoughtfully revoke()'s when starting a getty on ttyv0.  This
Cron's popen() was passing these fd's through to cron children (ie:
sendmail, *not* normal cron jobs).  The side effects were usually
not noticed, but it tripped up postfix which did a sanity check to see
that stdin/out/err were open, and got EBADF even thought the fd's were
in use.  I seem to recall sendmail itself has hacks to work around
this problem, it had a checkfd012() function, possibly for this same
problem.  (Postfix has a workaround too now though..)

This is a hack, not a fix.  It's probably best to check and perhaps
close/reopen() /dev/console if needed each time around the event loop.
It would probably be useful to actually see any error messages from cron.
1999-04-06 04:31:23 +00:00
Daniel O'Callaghan b9a1702cc2 y2k nit: print 4 digit years correctly.
PR:		9506
Submitted by:	Peter Jeremy <peter.jeremy@alcatel.com.au>
1999-01-16 01:51:03 +00:00
Matthew Dillon 4ef875d707 PR: bin/5572
Prevent cron from going crazy if the time steps.  For example, if you
    have a system with hundreds of users and lots of different crontabs
    and your time steps back an hour, the old cron would then attempt to
    run an hours worth of cron jobs in a few seconds.
1998-12-13 06:07:38 +00:00
Bruce Evans 78cda23056 Fixed printf format errors. 1998-07-06 20:28:08 +00:00
Philippe Charnier f12a14713b .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 08:31:20 +00:00
Bruce Evans 3d1442be99 Added forgotten new file for -Lfoo -lbar' -> foo/bar.a' change. 1998-03-08 00:19:19 +00:00
Bruce Evans 06c779979a Use foo/bar.a' instead of -Lfoo -lbar' for linking to static internal
libraries so that `ld -f' in can create correct dependencies for
yet-to-be-built libraries.

Get the default BINDIR correctly (by including ../Makefile.inc recursively.
Override the default it it is wrong.

Don't override defaults when the defaults are correct.
1998-03-07 09:48:14 +00:00
Bruce Evans f34b67af93 Don't use LDDESTDIR. Just put the -L arg in LDADD. 1997-12-17 15:11:43 +00:00
Andrey A. Chernov 0435c15004 Log run-time parsing errors now
Use getpwnam before getpwuid since two users with same uids can exists
(affects new login classes code only)

The same fixes as in inetd: by default run `system crontab things' with
daemon login class now, not restrict them to user class breaking
compatibility with old way (so-called nobody limits problem)

Implement user[:group][/login-class] syntax in system crontab
for more flexible control (the same as in inetd)
1997-11-02 17:22:20 +00:00
Wolfram Schneider bf5cbf3551 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
Philippe Charnier 401e64688b Use err(3). Rewrote man page in mdoc format. 1997-09-15 06:39:25 +00:00
Paul Traina 72b4ef7179 NOSHARED takes a yes/YES no/NO value, not "true, false, hey mon!".
NOPIC is used to not generate a shared library, not NOSHARED.
Make NOSHARED advisory where appropriate.
Remove bogus NOSHARED (kbdio).
1997-06-29 06:03:42 +00:00
Warner Losh 6c3f552a31 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-31 05:11:47 +00:00
Peter Wemm 9efe2eccdd Tone down the paranoia a bit in from the previous commit. setusercontext()
automatically Does The Right Thing when lc == NULL, which just happens to
be what the extra code in cron was trying to do.  Simplify.
1997-03-14 14:45:30 +00:00
Peter Wemm c00d650f25 For some reason, the old login class code didn't seem to be working here.
I suspect it was because the child exec code's parent was doing the
initial lookups, then forking, then doing other things (possibly trashing
the static data in the getpw*() buffer), then attempting to dereference
*pwd and *lc.  Also, no error checking appeared to be done - I've allowed
it to fall back to the old "become user" code on critical failure rather than
risk running a user's cron jobs as root.
1997-03-14 13:48:04 +00:00
Peter Wemm 476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
Mike Pritchard 043c578eb4 crontab(5) incorrectly documented the dom/month arguments.
They have valid ranges of 1-31 and 1-12, not 0-31 and 0-12.
1997-02-13 07:16:12 +00:00
David Nugent efc4a83cd0 Fix compile breakage: link against libutil. 1997-01-21 05:56:38 +00:00
David Nugent b25b7bc1be Make cron login class savvy.
Use setusercontext() rather than setuid()/setgid()/setlogin()/initgroups()
which is all handled. Login environment is NOT set by this call as crontab
provides its own means of doing so.
1997-01-20 15:31:33 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Paul Traina bdddbd2f3f Replace my "inane" usage of snprintf to copy strings with strncpy as
used by OpenBSD.  (Quite frankly, I think it's perfectly reasonable to
use snprintf to copy strings, given that the semantics for strncpy()
are utterly idiotic and there is no POSIX sstrncpy().)

While I'm at it, incorporate some of OpenBSD's bugfixes to cron.

NOT for 2.2
1996-12-17 00:55:20 +00:00
Paul Traina 482bfccc70 Close yet another buffer overrun 1996-12-16 18:21:00 +00:00
Wolfram Schneider 970402c71b Add sendmail option '-oi'
-oi	Do not take dots on a line by themselves as a
		message terminator.

Now this crontab entry works:
* * * *	*	echo foo; echo .; echo blah
1996-11-10 04:46:58 +00:00
Peter Wemm 73b2606378 personal (ie: with the crontab command) cron tabs were broken by the
last change. :-(
ie: /var/cron/log would report: .. cron[206]: (usage) CAN'T OPEN (%s/%s)
1996-09-10 03:38:20 +00:00
Paul Traina 30aaae26c6 Fix some buffer overflow problems... 1996-09-08 23:50:23 +00:00
Paul Traina 18fb104c5a Gratuitous whitespace change so that I can commit the source of the recent
buffer overflow patch.
Reviewed by:	pst
Submitted by:	Dave Andersen <angio@aros.net>
1996-08-05 00:50:02 +00:00
Paul Traina b04b7cf55d Fix up some more buffer overflow problems. 1996-08-05 00:31:27 +00:00
Wolfram Schneider 3eacc3d7fd fix: debug flag 'test' cause endless loop
document debug flags

close PR bin/683
1996-06-30 22:11:51 +00:00
Jordan K. Hubbard cd9a2f5c28 Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src.  This is the final version of the
patches, incorporating the feedback I've received from -current.
1996-06-24 04:26:21 +00:00
Marc G. Fournier fd2c4394ca Quick patch to fix a bug where issuing ctl-c while in crontab -e
leaves editor running in background (PR: bin/751)

Submitted by:	 candy@fct.kgc.co.jp (Toshihiro Kanda)
1996-04-09 20:28:16 +00:00
Peter Wemm a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Joerg Wunsch 86ed6de3b2 Fix a bug that prevented %'s and \'s from being passed to the program
invoked.

Submitted by:	fenner@parc.xerox.com (Bill Fenner)
1995-09-10 13:02:56 +00:00
Mike Pritchard ae532ecb79 Check for expired passwords before allowing access to the system. 1995-08-28 21:30:59 +00:00
Andrey A. Chernov 03aa8f08c7 Remove LOG_FILE definition, close PR 595
Submitted by: roberto@blaise.ibp.fr
1995-07-06 22:47:30 +00:00
Rodney W. Grimes 709e8f9ae1 Remove trailing whitespace. 1995-05-30 03:57:47 +00:00
Rodney W. Grimes ad753d5151 Fix nested comments for -Wcomment warnings. 1995-05-09 12:48:21 +00:00
Andrey A. Chernov 280bdae500 HAVE_SAVED_UIDS not depends of BSD version but depends
of _POSIX_SAVED_IDS from unistd.h, fix it.
1995-04-29 15:16:41 +00:00
Andrey A. Chernov aa4f20e4df Fix typo in HAVE_SAVED_UIDS define 1995-04-29 13:25:13 +00:00
Andrey A. Chernov c5dda01527 Fix MAILTO hole by passing -t to sendmail
Submitted by: Mike Pritchard <pritc003@maroon.tc.umn.edu>
1995-04-14 21:54:18 +00:00
Andrey A. Chernov 7ed12e2a4a Really fix MAILTO hole by parsing spaces.
Remove local bitstring copy
1995-04-13 20:58:13 +00:00
Andrey A. Chernov f8cb57f574 Don't set -or0s (timeout 0) for possible network MAILTO 1995-04-12 19:28:30 +00:00
Andrey A. Chernov 4c256f710e Fix home dir cheating 1995-04-12 19:04:26 +00:00
Andrey A. Chernov 1cb37d6325 Close MAILTO security hole 1995-04-12 18:57:37 +00:00
Andrey A. Chernov 8dac9202c0 Now crontab works not only for vi editor, i.e. refers to
file name not to file fd
1994-12-21 11:06:08 +00:00
Scott Mace 6831597a60 Make /usr/bin/crontab install setuid root. (doesn't work otherwise)
The distributed makefile in the package installs it setuid root..
Reviewed by:	jkh
1994-11-06 01:13:59 +00:00
Jordan K. Hubbard 760365067e Use LDDESTDIR and DPADD more consistently with what Bruce suggests..
Submitted by:	jkh
1994-08-29 18:42:12 +00:00
Jordan K. Hubbard ab0f611dff Make the LDADD stuff work properly with obj dirs. Whoops.
Submitted by:	jkh
1994-08-29 07:22:41 +00:00
Jordan K. Hubbard 688b53ece4 Prevent installation.
Submitted by:	jkh
1994-08-28 13:05:23 +00:00
Jordan K. Hubbard 9af842aebd Set proper destination directory for cron.
Submitted by:	jkh
1994-08-28 13:05:14 +00:00
Jordan K. Hubbard 84f33dea62 Paul Vixie's cron, version 3.0. Munged into bmake format. If this goes
well, expect our two seperate directories for cron and crontab to go away
shortly.
Submitted by:	jkh
1994-08-27 13:43:04 +00:00