Commit Graph

196 Commits

Author SHA1 Message Date
billf
6cfdb0f461 fix misspelling introduced in rev 1.14 (sames as -> same as) 2001-07-25 04:13:01 +00:00
davidn
011fe38c96 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
obrien
9c97c8f02d 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
dd
c821518dec 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
dd
cb0776eac7 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
dd
911ca14c87 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
brian
8636b161b3 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
c4b28e836b Where is the pointy hat? Fix cut/paste error. (hey, it compiled! :-) 2001-06-16 03:16:52 +00:00
dd
70471fcd50 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
d74956ff51 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
ru
afd506414e - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
ru
f10dc9aca1 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
peter
31a37074ac 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
ru
20da37272b 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
babkin
ec83952d16 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
ac3628fd7e 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
asmodai
2f1d3e2cdf Fix typo: seperate -> separate.
Seperate does not exist in the english language.
2001-02-06 11:21:58 +00:00
ru
66cd8f698e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:44:04 +00:00
babkin
1a75d1a0c2 Backed out the DST support changes. 2001-01-23 01:17:40 +00:00
ru
79125d6dc0 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
babkin
2a8a2cb55a 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
babkin
6511a9a1a9 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
ru
8ad24f0a49 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
ru
ffef081534 Prepare for mdoc(7)NG. 2001-01-16 09:39:23 +00:00
obrien
c2ee1dcc02 Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
kris
638b5b2282 Correct definition of MAXHOSTNAMELEN in ifdef'ed out code 2000-11-26 22:21:39 +00:00
ru
71e2293ad4 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
ru
a6f5d950d8 Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
dwmalone
10728d93bc 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
71e06852db 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
ache
c350a86095 Call login_close() to prevent parent from memory leaking in some
cases due to vfork()
2000-07-02 04:15:15 +00:00
ache
487d171b65 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
ache
3f913e3f23 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
ache
018c31c01e 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
ghelmer
c9e7aa307a Catch and report fdopen failures. 2000-05-23 13:46:04 +00:00
ghelmer
bd8a6b7ec3 Catch and report memory allocation failures. 2000-05-23 13:44:00 +00:00
ghelmer
f80ecf46c4 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
ghelmer
5869eff890 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
sheldonh
4cca06398e Revive rev 1.12 (NetBSD improvements including @ shortcuts). 2000-03-14 14:51:55 +00:00
ghelmer
7381ebe4fe 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
sheldonh
3b110e37c6 Back out previous commit. The code is not ready for it. 2000-03-13 19:13:48 +00:00
sheldonh
f528d8970c 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
efabb9ccb1 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
chris
4db9029d44 Bad reference of su(8) changed to su(1). 1999-08-14 06:34:50 +00:00
sheldonh
fe79cb6242 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
n_hibma
cf674ada59 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
9f884254c7 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
danny
5eb872561f 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
dillon
d2013aefd0 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
bde
a5b3c3ea4f Fixed printf format errors. 1998-07-06 20:28:08 +00:00
charnier
6e321f37d4 .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 08:31:20 +00:00
bde
9261b686f3 Added forgotten new file for -Lfoo -lbar' -> foo/bar.a' change. 1998-03-08 00:19:19 +00:00
bde
2f15ee6724 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
bde
1a1b424469 Don't use LDDESTDIR. Just put the -L arg in LDADD. 1997-12-17 15:11:43 +00:00
ache
0402968a2b 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
wosch
8ee659dd96 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
charnier
bdee4a3e4b Use err(3). Rewrote man page in mdoc format. 1997-09-15 06:39:25 +00:00
pst
1b991716a4 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
imp
691010efad 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
da35a9d7c3 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
8e1c208b61 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
b782f4df30 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
mpp
67a1a81fad 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
davidn
f03888db80 Fix compile breakage: link against libutil. 1997-01-21 05:56:38 +00:00
davidn
f4e00f119e 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
jkh
808a36ef65 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
pst
253df5b08a 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
pst
ec712ef476 Close yet another buffer overrun 1996-12-16 18:21:00 +00:00
wosch
e15ba7df33 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
9733973c2d 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
pst
c292e5a7ba Fix some buffer overflow problems... 1996-09-08 23:50:23 +00:00
pst
67d02bf67e 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
pst
1386f27d09 Fix up some more buffer overflow problems. 1996-08-05 00:31:27 +00:00
wosch
2025f2a59a fix: debug flag 'test' cause endless loop
document debug flags

close PR bin/683
1996-06-30 22:11:51 +00:00
jkh
8eb37231d4 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
scrappy
35b5c03864 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
c3f352d4ad This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.
1995-12-30 19:02:48 +00:00
joerg
b4e6cbbd8a 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
mpp
684146e8ce Check for expired passwords before allowing access to the system. 1995-08-28 21:30:59 +00:00
ache
f87500968f Remove LOG_FILE definition, close PR 595
Submitted by: roberto@blaise.ibp.fr
1995-07-06 22:47:30 +00:00
rgrimes
4f960dd75f Remove trailing whitespace. 1995-05-30 03:57:47 +00:00
rgrimes
f2df5b608b Fix nested comments for -Wcomment warnings. 1995-05-09 12:48:21 +00:00
ache
d0845530db 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
ache
43bf61af63 Fix typo in HAVE_SAVED_UIDS define 1995-04-29 13:25:13 +00:00
ache
d12c09e5c2 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
ache
81860156cc Really fix MAILTO hole by parsing spaces.
Remove local bitstring copy
1995-04-13 20:58:13 +00:00
ache
e3bdb075c7 Don't set -or0s (timeout 0) for possible network MAILTO 1995-04-12 19:28:30 +00:00
ache
2e4fea754b Fix home dir cheating 1995-04-12 19:04:26 +00:00
ache
64adcd35a4 Close MAILTO security hole 1995-04-12 18:57:37 +00:00
ache
bf3a1964a9 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
smace
ef18154140 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
jkh
4e29f11c60 Use LDDESTDIR and DPADD more consistently with what Bruce suggests..
Submitted by:	jkh
1994-08-29 18:42:12 +00:00
jkh
b5fd718695 Make the LDADD stuff work properly with obj dirs. Whoops.
Submitted by:	jkh
1994-08-29 07:22:41 +00:00
jkh
a0d92e8d14 Prevent installation.
Submitted by:	jkh
1994-08-28 13:05:23 +00:00
jkh
fa20e1be69 Set proper destination directory for cron.
Submitted by:	jkh
1994-08-28 13:05:14 +00:00
jkh
54a3fb7337 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