Commit Graph

92 Commits

Author SHA1 Message Date
Pietro Cerutti
1a47f28b71 - Do not bail out if stat(2) fails with ENOENT in the spool directory. This
happens if another atrm process removes a job while we're scanning through
  the directory.
- While at it, optimize a bit the directory scanning, so that we quit looping
  as soon as all jobs specified in argv have been dealt with.

Approved by:	cognet
2013-04-12 14:32:16 +00:00
Pietro Cerutti
b9e6237dab - Switch order of setting real uid and gid. If we set uid first, then we
don't have enough privileges to set gid.

  This looks like a long standing bug, just recently revealed by r241852.

Approved by:	cognet
2013-04-12 14:19:44 +00:00
Eitan Adler
1d1d4a4727 Check the return error of set[ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API.  Custom
security modules, or future implementations of the setuid and setgid
may fail.

PR:		bin/172289
PR:		bin/172290
PR:		bin/172291
Submittud by:	Erik Cederstrand <erik@cederstrand.dk>
Discussed by:	freebsd-security
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:31:22 +00:00
Ed Schouten
bf70becee6 More -Wmissing-variable-declarations fixes.
In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
2012-10-19 14:49:42 +00:00
Martin Cracauer
93a2fe45a6 Allow time offsets to be negative, e.g. at 1530 - 15 minutes.
This is useful if you have been given some time for some event in some
format and you want your computer to do something to prepare for it.
Without having to do time arithmetic in a shellscript.

The syntax matches what the at(1) usually used on Linux supports.
2012-10-05 17:54:27 +00:00
Ed Schouten
a35353de88 Partially revert r227233.
The privs.h header is not only used by at(1), it's also used by
atrun(8). Just let the code the way it used to be (for now).

Reported by:	kwm, tinderbox
Hat to:		me
2011-11-06 20:30:21 +00:00
Ed Schouten
f64efe8b60 Add missing static keywords to at(1).
While there, tidy up the privs.h part, where at.c has to #define to
declare some globals. Also group static and non-static global variables
in at.c.
2011-11-06 17:32:29 +00:00
Ed Schouten
196769ee58 Build at(1) with NO_WFORMAT instead of WARNS=1. 2011-10-16 07:57:01 +00:00
Kevin Lo
f9af8a7b9c Close file and directory descriptors
MFC after:	3 days
2010-11-19 10:15:29 +00:00
Ed Schouten
0806dd9238 Remove stale references to utmp(5) and its corresponding filenames.
I removed utmp and its manpage, but not other manpages referring to it.
2010-01-21 17:25:12 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Ed Schouten
ef636796f6 ANSIfy various tools in usr.bin/.
Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.
2010-01-02 10:09:20 +00:00
Kevin Lo
8bcd62f2ff Use NULL instead of 0 for the return value of fopen().
Approved by: re (kensmith)
2007-09-21 01:55:11 +00:00
Stefan Farfeleder
4ed7018006 While revision 1.26 fixed the code to really subtract 3600 due to
daylight-saving, this was actually wrong because mktime() already does that for
us.
2005-08-18 08:18:02 +00:00
Stefan Farfeleder
3dc44a8992 Don't throw away the adjusted `runtimer' value. 2005-08-05 08:07:02 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Giorgos Keramidas
85785286b4 Explain the format of the at.allow and at.deny files in detail.
PR:		35942
Submitted by:	Gary W. Swearingen <swear@blarg.net>
2003-03-26 02:38:18 +00:00
Giorgos Keramidas
9d5eb445a3 The .Nm utility. 2003-02-28 21:04:17 +00:00
Ruslan Ermilov
e27480d64d mdoc(7) police:
Revert to using the .Tn POSIX and .Tn ANSI instead of \*[Px] and \*[Ai]
strings; using these strings is unsafe in troff mode, as they include a
change in a font size.

Approved by:	re
2002-11-26 17:55:41 +00:00
Ruslan Ermilov
a654c53e16 mdoc(7) police: Removed redundant .Ns calls. 2002-08-13 16:07:28 +00:00
Robert Drehmel
6d6c6baac4 - Use MAXLOGNAME - 1 instead of UT_NAMESIZE.
- Do not pretend there is something like '/etc/utmp'.
2002-07-22 11:32:16 +00:00
Ruslan Ermilov
5ec37969a1 mdoc(7) police: lint. 2002-05-29 18:00:23 +00:00
Tim J. Robbins
dfd339a02c Add the SUSv3 -l option to at. This is an alias for atq. Allow job ids
to be specified on the command line for which information should be reported.

Submitted by:	Joe Halpin <joe.halpin@attbi.com>
Reviewed by:	mike
2002-05-16 00:47:14 +00:00
Jun Kuriyama
18ddb1400d Change whtespace indent in format string to fit new output form of
timestamp.

Reviewed by:	markm
2002-05-08 11:23:45 +00:00
Jeroen Ruigrok van der Werven
cdb886795d Document the fact that at(1) is run through cron(8) and that this affects
the granularity of the at queue runs.

Submitted by:	mux
2002-05-04 15:33:12 +00:00
Ruslan Ermilov
4af011c32b mdoc(7) police: markup fixes. 2002-03-15 15:26:57 +00:00
Bruce Evans
8b179749d8 #include <sys/time.h> instead of depending on namespace pollution in
<sys/stat.h> for the declaration of struct timeval (sys/stat.h> only
needs timespecs even when its POSIX support is not turned on, so it
shouldn't declare timevals).

Fixed some #include messes.
2002-02-25 04:47:39 +00:00
Mark Murray
91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
Mike Barcroft
e1bc822ebe o Remove the -V [version number] option, since our version of at(1) no
longer resembles the original.
o Remove references to `you' in the manual.

Submitted by:	Joe Halpin <joe.halpin@attbi.com>
2002-01-22 03:04:15 +00:00
Mike Barcroft
00e39e5ea1 Fix a typo introduced in the previous delta. The mistake was mine
rather than the submitter's.
2002-01-17 07:48:12 +00:00
Mike Barcroft
d81986de07 Implement the POSIX 1003.1-2001 -r and -t options in at(1). Fix some
minor issues in the rest of the source and manual.

Submitted by:	Joe Halpin <joe.halpin@attbi.com>
Obtained from:	touch(1) (partially)
MFC after:	1 month
2002-01-13 20:21:08 +00:00
Giorgos Keramidas
1309232c90 - Add 4-digit year variants in the manpage, since at(1) already
understands them.

PR:		docs/32843
Submitted by:	Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
2002-01-10 08:21:31 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
51e2220c27 Use __FBSDID() 2001-12-02 20:23:02 +00:00
Mark Murray
3ce6c35745 WARNS=2 fixup. 2001-12-02 12:26:18 +00:00
Brian Somers
bafdc304b0 Allow an ``at now'' specification.
PR:		32242
Submitted by:	Alan E <alane@geeksrus.net>
MFC after:	3 weeks
2001-11-24 10:43:53 +00:00
Ruslan Ermilov
ec2eb6a2ff mdoc(7) police: kill whitespace at EOL and HSB. 2001-11-20 15:43:25 +00:00
Murray Stokely
f6db21a6eb Use .Nm to correctly display the program name.
PR:           docs/32086
Submitted by: setantae@submonkey.net
MFC After:    2 days
2001-11-19 08:12:17 +00:00
Ruslan Ermilov
cda2a9b2f0 Set BINOWN=root explicitly for setuid root binaries.
This is not "useless", as one may have non-default
setting for BINOWN in make.conf, and we still want
these to be installed setuid root in this case.
2001-09-13 06:48:18 +00:00
Ruslan Ermilov
9dd887f1a6 SECURITY.
Fixed macros for temporarily relinquishing and restoring setuid/setgid
privileges so that they never change the real user and group IDs of
the calling process.

The setre[ug]id() calls are still used in the REDUCE_PERM macro (with
the r[ug]id arguments of -1) so that the call changes the saved user
and group IDs of the process to that specified.

Also, the panic() and perr() functions had insufficient privileges to
delete the problematic file under /var/at.
2001-09-04 16:15:51 +00:00
Kris Kennaway
ffacb1a399 Remove some unsafe function calls from the signal handlers.
Obtained from:	OpenBSD
Reviewed by:	audit
MFC after:	2 weeks
2001-09-01 07:35:25 +00:00
Dima Dorfman
dd6ba956da An empty at.deny doesn't mean everyone can use at.
PR:		29549
Submitted by:	swear@aa.net
2001-08-14 06:41:20 +00:00
David E. O'Brien
a9be9be874 Expland `mymalloc' with malloc + error checking. 2001-07-24 14:15:51 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
Ruslan Ermilov
dc12be5258 MAN[1-9] -> MAN. 2001-03-27 10:52:19 +00:00
Ruslan Ermilov
0414fc4dd0 Don't use MANDEPEND and MANSRC. 2001-03-26 07:28:26 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Ruslan Ermilov
9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Ruslan Ermilov
ed40311694 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00
Sheldon Hearn
f4510294cb Y2K fix. at(1) would die with 'garbled time' when assign_date() was
pased a year > 99.  This change fixes the conversion of 2-digit years
into tm_year format.

This change is differs from the OpenBSD fix because of differences
in our assign_date().

PR:		15872
Reported by:	"Crist J. Clark" <cjclark@home.com>
Submitted by:	"Sergey N. Voronkov" <serg@dor.zaural.ru>
Obtained from:	OpenBSD
2000-03-27 09:32:23 +00:00