Commit Graph

35 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
11db7fa42b Make lock(1) use PAM. This makes the -p option work again. (Well, kind of,
because the whole idea of this utility is rather broken.)

This originally come from NetBSD, and was later reworked a bit.

Reviewed by:	des@ (earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4981
2018-02-11 13:35:31 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Conrad Meyer
2c9a33f557 Correct sense of crypt(3) NULL checks in init(8) and lock(1)
In r231994, an attempt was made to fix crypt(3) failure returns (NULL).
However, instead of treating crypt(3) failure as authentication failure,
some of the changes treated crypt(3) failure as authentication success.
This is wrong.

r324225 fixed this for ppp, which also inspired this review.  The other
changes in the 231994 revision were audited for correctness and look ok.

Reviewed by:	jhb
Security:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12571
2017-10-03 00:53:11 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Neel Natu
06224a9492 Remove LOG_ODELAY because it does nothing.
Reviewed by:	jilles
CR:		https://reviews.freebsd.org/D611
2014-08-17 19:06:26 +00:00
Aleksandr Rybalko
b8a7acdf7b Rollback r266496.
Different meaning of flags for lock(1) and vidcontrol(1) confuse me.

Pointy hat to:	ray
Sponsored by:	The FreeBSD Foundation
2014-05-22 09:28:36 +00:00
Aleksandr Rybalko
0cc7a38567 Sync lock(1) on VT_LOCKSWITCH usage with syscons(4), vt(4) and vidcontrol(1).
Sponsored by:	The FreeBSD Foundation
2014-05-21 11:53:15 +00:00
Eitan Adler
50e04779c4 Check the return error of set[e][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.

Submitted by:	Erik Cederstrand
Approved by:	cperciva
MFC after:	3 days
2012-10-22 03:07:05 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
Kevin Lo
29dcf726d2 Handle NULL return from crypt(3). Mostly from DragonFly 2012-02-22 06:27:20 +00:00
Ed Schouten
20a9b7ee4e Add missing static keywords to lock(1) 2011-11-06 08:15:48 +00:00
Ed Schouten
88d5e71efe Fix style bug introduced in r216696.
Additional indentation caused the line to become longer than 80 columns.
2010-12-27 15:05:15 +00:00
Ed Schouten
2d491fabff Slightly improve output of lock(1).
- Remove the /dev/ portion of the TTY name.
- In case we use lock -p, print the username that was used to obtain the
  password hash.
2010-12-25 11:24:27 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Gavin Atkinson
84f70ae360 Make WARNS=6 safe.
Tested by:	make universe
2010-06-28 08:30:10 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Colin Percival
54ca359425 Two fixes here:
1. If fgets fails, don't go into an infinite cpu-intensive loop.  Instead,
check to see if the terminal still exists, and sleep(1) otherwise.
2. When we check to see if the terminal still exists, make sure we're not
mislead by EINTR.  This could have been a security issue, but fortunately
the current implementation of tcgetattr doesn't EINTR.

PR: bin/60758
Approved by: rwatson (mentor)
2004-01-22 04:24:15 +00:00
Alexander Kabaev
84c0a48249 Eliminate last three uses of varargs.h in the tree. These three files
were including varargs.h file but did not use any of its macros,
so they escaped the clean-up before.
2003-09-01 04:12:18 +00:00
Tim J. Robbins
f8e84641ec Make this work without COMPAT_43 by using tcgetattr()/tcsetattr() instead
of ioctl TIOCGETP/TIOCSETP.
2003-02-10 02:08:49 +00:00
David Malone
f4ac32def2 ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
Dima Dorfman
16a8de73d2 Add a -v option that prevents switching virtual terminals while this
terminal is locked.  This permits the user to easily lock the entire
console from a single terminal.
2002-07-28 07:13:53 +00:00
Dima Dorfman
046e2b07fa Correct a comment: Typing in the root password at the "Key:" prompt
doesn't (and shouldn't) work.
2002-07-10 04:05:33 +00:00
Dima Dorfman
d80646a4a0 Fix indentation: Don't use space where tabs will do; specifically,
don't use spaces at the beginning of a line where tabs are normally
used (the worst thing was that half of this file was right (tabs) and
half was wrong (spaces), making for painful reading).

Reviewed by:	/sbin/md5, diff -b
2002-07-10 04:03:33 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
David Malone
4285ad09c9 Warns cleanups:
Signal handlers are supposed to take an int as an arg.
Don't locally declare crypt or ttyname.
2001-12-03 21:01:52 +00:00
Jacques Vidrine
64ff567e0a Fix a style bug that I introduced (both sys/param.h and sys/types.h
included).

Caught by:	sheldonh@freebsd.org
1999-10-12 13:53:30 +00:00
Jacques Vidrine
65c543c764 log root unlock attempts
PR:	bin/13932
1999-10-12 13:33:48 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bruce Evans
375557fcad Don't assume that time_t is long. 1998-06-29 17:06:00 +00:00
Philippe Charnier
a4a2bc1716 Use err(3). Add usage(). 1997-07-21 12:09:34 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Ollivier Robert
2280509ca1 Closes PR bin/1567
/usr/bin/lock can be used to lock a terminal much like xlock does
for your X-windows session.  Problem is, /usr/bin/lock cannot lock
your terminal indefinately.  Rather you must specify a timeout
value, after which, your terminal is unlocked and become unsecured.

I have added a ``-n'' no timeout option to /usr/bin/lock
Currently the only way to get this functionality is to use a huge
timeout value and hope it is long enought (in time).  This method
also requires you to know the maxium number of minutes you are
allowed to specify.

Submitted by:	David E. O'Brien <obrien@Nuxi.cs.ucdavis.edu>
1996-09-14 09:00:52 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00