History log of /openbsd-current/usr.bin/lock/lock.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.46 24-Jul-2019 schwarze

Make sure that -n overrides -t even when -n precedes -t, like it
does in FreeBSD and in NetBSD, and fully document that behaviour.
Input, feedback, and OK jca@.


# 1.45 21-Jul-2019 jca

While -n is now the default, it's been useful since 1996. Keep it for compat.

Agreement from schwarze@ (who proposed a thorough but longer diff) and millert@
ok tb@ kn@ cheloha@


# 1.44 21-Jul-2019 jca

Amend comment: entering the root password won't unlock the terminal

Mention -p (user password) while here.


# 1.43 19-Jul-2019 cheloha

lock(1): remove default timeout

It makes little sense from a security standpoint to unlock the terminal
and expose the user's session after fifteen minutes by default.

Default behavior is now to reserve the terminal forever. Add instructions
to the manpage to help the user employ the -t timeout option more safely.

Manpage greatly improved by jmc@; bug(s) caught by millert@; with input
from claudio@.

ok millert@


# 1.42 05-Jul-2019 cheloha

lock(1): make "-n" and "-t timeout" mutually exclusive.

It doesn't make sense to simultaneously say "never time out" and "release
this terminal in a few minutes".

Input from kn@.

"just go for it" deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.41 06-Sep-2017 tb

After recent changes, we need to clear hash, not s1.

From Scott Cheloha
ok deraadt


# 1.40 08-Jul-2017 tedu

this program was infected with lint era casts. i think we're past that now.


# 1.39 08-Jul-2017 tedu

remove ARGSUSED, from Scott Cheloha.
and while we're cleaning, switch __progname to getprogname.


# 1.38 08-Jul-2017 tedu

use crypt_newhash to protect the password. from Scott Cheloha


# 1.37 08-Jul-2017 tedu

clean up some unused variables. also, making a variable global isn't the
best way to zero initialize it if that's all you need.


# 1.36 08-Jul-2017 tedu

instead of using time(), refer to getitimer to find out how long the
timeout is.
from Scott Cheloha


# 1.35 08-Jul-2017 tedu

can just continue after readpassphrase returns null, the sighandler will
have already printed a message.
from Scott Cheloha


# 1.34 03-May-2017 mestre

Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on
this diff won't benefit that much since it happens near the terminal path, but
someone might copy the unsafe idiom to another program and place it where it
may leak sensitive data.

Discussed aeons ago with tb@, OK deraadt@ and beck@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 28-May-2016 tedu

repair braces. from ilya.kaliman/gsoares/natano


Revision tags: OPENBSD_5_9_BASE
# 1.32 15-Oct-2015 tedu

lock needs pledge(proc exec) to use bsd auth system. from trondd


# 1.31 10-Oct-2015 deraadt

normalize a few more tame request orderings, to help review


# 1.30 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.29 07-Oct-2015 deraadt

tame "stdio getpw rpath wpath tty". "tty" allows this to use
readpassphrase().


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.28 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.27 22-Aug-2013 guenther

Correct format string mismatches turned up by -Wformat=2

suggestions and ok millert@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.26 13-Jun-2010 tobias

Prevent a segmentation fault. It could occur when login_getclass fails and
the key "s/key" is entered with supplied -a or -p option.

ok millert (with better error message)


Revision tags: OPENBSD_4_7_BASE
# 1.25 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.24 18-Sep-2009 martynas

like login(1), back off password guesses after login-backoff; and
reset cnt after login-tries. tweak & ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.23 26-Apr-2006 deraadt

pleasing lint, without displeasing future developers


# 1.22 26-Apr-2006 deraadt

merge parts of strtonum() cleanup from tan.dang@gmail.com


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.21 14-Jul-2005 jmc

- better synopsis
- sort options
- sync usage()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 15-Aug-2002 deraadt

knf


# 1.18 04-Aug-2002 deraadt

ansi


# 1.17 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.16 08-May-2002 millert

_exit() not exit() in signal handler.


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.14 02-Nov-2001 deraadt

avoid stdio in signal handler


Revision tags: OPENBSD_3_0_BASE
# 1.13 29-May-2001 millert

adapt to BSD authentication and clean things up a bit while I am at it


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.12 06-Mar-1999 millert

back out changes that should not have escaped my local tree


# 1.11 06-Mar-1999 millert

add missing reference to infocmp


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.10 27-Jul-1997 millert

A bit of KNF


# 1.9 27-Jul-1997 millert

-Wall


Revision tags: OPENBSD_2_1_BASE
# 1.8 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.7 16-Oct-1996 millert

s/key support now works (s/key lookup must be done with euid == 0)


Revision tags: OPENBSD_2_0_BASE
# 1.6 06-Sep-1996 downsj

Add -n/no timeout option. FreeBSD PR bin/1567, obrien@Nuxi.cs.ucdavis.edu.


# 1.5 06-Aug-1996 deraadt

type cleanup


# 1.4 25-Jul-1996 deraadt

readable


# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 24-May-1996 deraadt

use protos


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.45 21-Jul-2019 jca

While -n is now the default, it's been useful since 1996. Keep it for compat.

Agreement from schwarze@ (who proposed a thorough but longer diff) and millert@
ok tb@ kn@ cheloha@


# 1.44 21-Jul-2019 jca

Amend comment: entering the root password won't unlock the terminal

Mention -p (user password) while here.


# 1.43 19-Jul-2019 cheloha

lock(1): remove default timeout

It makes little sense from a security standpoint to unlock the terminal
and expose the user's session after fifteen minutes by default.

Default behavior is now to reserve the terminal forever. Add instructions
to the manpage to help the user employ the -t timeout option more safely.

Manpage greatly improved by jmc@; bug(s) caught by millert@; with input
from claudio@.

ok millert@


# 1.42 05-Jul-2019 cheloha

lock(1): make "-n" and "-t timeout" mutually exclusive.

It doesn't make sense to simultaneously say "never time out" and "release
this terminal in a few minutes".

Input from kn@.

"just go for it" deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.41 06-Sep-2017 tb

After recent changes, we need to clear hash, not s1.

From Scott Cheloha
ok deraadt


# 1.40 08-Jul-2017 tedu

this program was infected with lint era casts. i think we're past that now.


# 1.39 08-Jul-2017 tedu

remove ARGSUSED, from Scott Cheloha.
and while we're cleaning, switch __progname to getprogname.


# 1.38 08-Jul-2017 tedu

use crypt_newhash to protect the password. from Scott Cheloha


# 1.37 08-Jul-2017 tedu

clean up some unused variables. also, making a variable global isn't the
best way to zero initialize it if that's all you need.


# 1.36 08-Jul-2017 tedu

instead of using time(), refer to getitimer to find out how long the
timeout is.
from Scott Cheloha


# 1.35 08-Jul-2017 tedu

can just continue after readpassphrase returns null, the sighandler will
have already printed a message.
from Scott Cheloha


# 1.34 03-May-2017 mestre

Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on
this diff won't benefit that much since it happens near the terminal path, but
someone might copy the unsafe idiom to another program and place it where it
may leak sensitive data.

Discussed aeons ago with tb@, OK deraadt@ and beck@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 28-May-2016 tedu

repair braces. from ilya.kaliman/gsoares/natano


Revision tags: OPENBSD_5_9_BASE
# 1.32 15-Oct-2015 tedu

lock needs pledge(proc exec) to use bsd auth system. from trondd


# 1.31 10-Oct-2015 deraadt

normalize a few more tame request orderings, to help review


# 1.30 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.29 07-Oct-2015 deraadt

tame "stdio getpw rpath wpath tty". "tty" allows this to use
readpassphrase().


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.28 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.27 22-Aug-2013 guenther

Correct format string mismatches turned up by -Wformat=2

suggestions and ok millert@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.26 13-Jun-2010 tobias

Prevent a segmentation fault. It could occur when login_getclass fails and
the key "s/key" is entered with supplied -a or -p option.

ok millert (with better error message)


Revision tags: OPENBSD_4_7_BASE
# 1.25 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.24 18-Sep-2009 martynas

like login(1), back off password guesses after login-backoff; and
reset cnt after login-tries. tweak & ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.23 26-Apr-2006 deraadt

pleasing lint, without displeasing future developers


# 1.22 26-Apr-2006 deraadt

merge parts of strtonum() cleanup from tan.dang@gmail.com


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.21 14-Jul-2005 jmc

- better synopsis
- sort options
- sync usage()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 15-Aug-2002 deraadt

knf


# 1.18 04-Aug-2002 deraadt

ansi


# 1.17 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.16 08-May-2002 millert

_exit() not exit() in signal handler.


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.14 02-Nov-2001 deraadt

avoid stdio in signal handler


Revision tags: OPENBSD_3_0_BASE
# 1.13 29-May-2001 millert

adapt to BSD authentication and clean things up a bit while I am at it


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.12 06-Mar-1999 millert

back out changes that should not have escaped my local tree


# 1.11 06-Mar-1999 millert

add missing reference to infocmp


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.10 27-Jul-1997 millert

A bit of KNF


# 1.9 27-Jul-1997 millert

-Wall


Revision tags: OPENBSD_2_1_BASE
# 1.8 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.7 16-Oct-1996 millert

s/key support now works (s/key lookup must be done with euid == 0)


Revision tags: OPENBSD_2_0_BASE
# 1.6 06-Sep-1996 downsj

Add -n/no timeout option. FreeBSD PR bin/1567, obrien@Nuxi.cs.ucdavis.edu.


# 1.5 06-Aug-1996 deraadt

type cleanup


# 1.4 25-Jul-1996 deraadt

readable


# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 24-May-1996 deraadt

use protos


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.43 19-Jul-2019 cheloha

lock(1): remove default timeout

It makes little sense from a security standpoint to unlock the terminal
and expose the user's session after fifteen minutes by default.

Default behavior is now to reserve the terminal forever. Add instructions
to the manpage to help the user employ the -t timeout option more safely.

Manpage greatly improved by jmc@; bug(s) caught by millert@; with input
from claudio@.

ok millert@


# 1.42 05-Jul-2019 cheloha

lock(1): make "-n" and "-t timeout" mutually exclusive.

It doesn't make sense to simultaneously say "never time out" and "release
this terminal in a few minutes".

Input from kn@.

"just go for it" deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.41 06-Sep-2017 tb

After recent changes, we need to clear hash, not s1.

From Scott Cheloha
ok deraadt


# 1.40 08-Jul-2017 tedu

this program was infected with lint era casts. i think we're past that now.


# 1.39 08-Jul-2017 tedu

remove ARGSUSED, from Scott Cheloha.
and while we're cleaning, switch __progname to getprogname.


# 1.38 08-Jul-2017 tedu

use crypt_newhash to protect the password. from Scott Cheloha


# 1.37 08-Jul-2017 tedu

clean up some unused variables. also, making a variable global isn't the
best way to zero initialize it if that's all you need.


# 1.36 08-Jul-2017 tedu

instead of using time(), refer to getitimer to find out how long the
timeout is.
from Scott Cheloha


# 1.35 08-Jul-2017 tedu

can just continue after readpassphrase returns null, the sighandler will
have already printed a message.
from Scott Cheloha


# 1.34 03-May-2017 mestre

Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on
this diff won't benefit that much since it happens near the terminal path, but
someone might copy the unsafe idiom to another program and place it where it
may leak sensitive data.

Discussed aeons ago with tb@, OK deraadt@ and beck@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 28-May-2016 tedu

repair braces. from ilya.kaliman/gsoares/natano


Revision tags: OPENBSD_5_9_BASE
# 1.32 15-Oct-2015 tedu

lock needs pledge(proc exec) to use bsd auth system. from trondd


# 1.31 10-Oct-2015 deraadt

normalize a few more tame request orderings, to help review


# 1.30 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.29 07-Oct-2015 deraadt

tame "stdio getpw rpath wpath tty". "tty" allows this to use
readpassphrase().


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.28 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.27 22-Aug-2013 guenther

Correct format string mismatches turned up by -Wformat=2

suggestions and ok millert@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.26 13-Jun-2010 tobias

Prevent a segmentation fault. It could occur when login_getclass fails and
the key "s/key" is entered with supplied -a or -p option.

ok millert (with better error message)


Revision tags: OPENBSD_4_7_BASE
# 1.25 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.24 18-Sep-2009 martynas

like login(1), back off password guesses after login-backoff; and
reset cnt after login-tries. tweak & ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.23 26-Apr-2006 deraadt

pleasing lint, without displeasing future developers


# 1.22 26-Apr-2006 deraadt

merge parts of strtonum() cleanup from tan.dang@gmail.com


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.21 14-Jul-2005 jmc

- better synopsis
- sort options
- sync usage()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 15-Aug-2002 deraadt

knf


# 1.18 04-Aug-2002 deraadt

ansi


# 1.17 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.16 08-May-2002 millert

_exit() not exit() in signal handler.


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.14 02-Nov-2001 deraadt

avoid stdio in signal handler


Revision tags: OPENBSD_3_0_BASE
# 1.13 29-May-2001 millert

adapt to BSD authentication and clean things up a bit while I am at it


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.12 06-Mar-1999 millert

back out changes that should not have escaped my local tree


# 1.11 06-Mar-1999 millert

add missing reference to infocmp


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.10 27-Jul-1997 millert

A bit of KNF


# 1.9 27-Jul-1997 millert

-Wall


Revision tags: OPENBSD_2_1_BASE
# 1.8 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.7 16-Oct-1996 millert

s/key support now works (s/key lookup must be done with euid == 0)


Revision tags: OPENBSD_2_0_BASE
# 1.6 06-Sep-1996 downsj

Add -n/no timeout option. FreeBSD PR bin/1567, obrien@Nuxi.cs.ucdavis.edu.


# 1.5 06-Aug-1996 deraadt

type cleanup


# 1.4 25-Jul-1996 deraadt

readable


# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 24-May-1996 deraadt

use protos


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.42 05-Jul-2019 cheloha

lock(1): make "-n" and "-t timeout" mutually exclusive.

It doesn't make sense to simultaneously say "never time out" and "release
this terminal in a few minutes".

Input from kn@.

"just go for it" deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.41 06-Sep-2017 tb

After recent changes, we need to clear hash, not s1.

From Scott Cheloha
ok deraadt


# 1.40 08-Jul-2017 tedu

this program was infected with lint era casts. i think we're past that now.


# 1.39 08-Jul-2017 tedu

remove ARGSUSED, from Scott Cheloha.
and while we're cleaning, switch __progname to getprogname.


# 1.38 08-Jul-2017 tedu

use crypt_newhash to protect the password. from Scott Cheloha


# 1.37 08-Jul-2017 tedu

clean up some unused variables. also, making a variable global isn't the
best way to zero initialize it if that's all you need.


# 1.36 08-Jul-2017 tedu

instead of using time(), refer to getitimer to find out how long the
timeout is.
from Scott Cheloha


# 1.35 08-Jul-2017 tedu

can just continue after readpassphrase returns null, the sighandler will
have already printed a message.
from Scott Cheloha


# 1.34 03-May-2017 mestre

Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on
this diff won't benefit that much since it happens near the terminal path, but
someone might copy the unsafe idiom to another program and place it where it
may leak sensitive data.

Discussed aeons ago with tb@, OK deraadt@ and beck@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 28-May-2016 tedu

repair braces. from ilya.kaliman/gsoares/natano


Revision tags: OPENBSD_5_9_BASE
# 1.32 15-Oct-2015 tedu

lock needs pledge(proc exec) to use bsd auth system. from trondd


# 1.31 10-Oct-2015 deraadt

normalize a few more tame request orderings, to help review


# 1.30 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.29 07-Oct-2015 deraadt

tame "stdio getpw rpath wpath tty". "tty" allows this to use
readpassphrase().


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.28 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.27 22-Aug-2013 guenther

Correct format string mismatches turned up by -Wformat=2

suggestions and ok millert@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.26 13-Jun-2010 tobias

Prevent a segmentation fault. It could occur when login_getclass fails and
the key "s/key" is entered with supplied -a or -p option.

ok millert (with better error message)


Revision tags: OPENBSD_4_7_BASE
# 1.25 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.24 18-Sep-2009 martynas

like login(1), back off password guesses after login-backoff; and
reset cnt after login-tries. tweak & ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.23 26-Apr-2006 deraadt

pleasing lint, without displeasing future developers


# 1.22 26-Apr-2006 deraadt

merge parts of strtonum() cleanup from tan.dang@gmail.com


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.21 14-Jul-2005 jmc

- better synopsis
- sort options
- sync usage()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 15-Aug-2002 deraadt

knf


# 1.18 04-Aug-2002 deraadt

ansi


# 1.17 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.16 08-May-2002 millert

_exit() not exit() in signal handler.


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.14 02-Nov-2001 deraadt

avoid stdio in signal handler


Revision tags: OPENBSD_3_0_BASE
# 1.13 29-May-2001 millert

adapt to BSD authentication and clean things up a bit while I am at it


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.12 06-Mar-1999 millert

back out changes that should not have escaped my local tree


# 1.11 06-Mar-1999 millert

add missing reference to infocmp


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.10 27-Jul-1997 millert

A bit of KNF


# 1.9 27-Jul-1997 millert

-Wall


Revision tags: OPENBSD_2_1_BASE
# 1.8 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.7 16-Oct-1996 millert

s/key support now works (s/key lookup must be done with euid == 0)


Revision tags: OPENBSD_2_0_BASE
# 1.6 06-Sep-1996 downsj

Add -n/no timeout option. FreeBSD PR bin/1567, obrien@Nuxi.cs.ucdavis.edu.


# 1.5 06-Aug-1996 deraadt

type cleanup


# 1.4 25-Jul-1996 deraadt

readable


# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 24-May-1996 deraadt

use protos


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.41 06-Sep-2017 tb

After recent changes, we need to clear hash, not s1.

From Scott Cheloha
ok deraadt


# 1.40 08-Jul-2017 tedu

this program was infected with lint era casts. i think we're past that now.


# 1.39 08-Jul-2017 tedu

remove ARGSUSED, from Scott Cheloha.
and while we're cleaning, switch __progname to getprogname.


# 1.38 08-Jul-2017 tedu

use crypt_newhash to protect the password. from Scott Cheloha


# 1.37 08-Jul-2017 tedu

clean up some unused variables. also, making a variable global isn't the
best way to zero initialize it if that's all you need.


# 1.36 08-Jul-2017 tedu

instead of using time(), refer to getitimer to find out how long the
timeout is.
from Scott Cheloha


# 1.35 08-Jul-2017 tedu

can just continue after readpassphrase returns null, the sighandler will
have already printed a message.
from Scott Cheloha


# 1.34 03-May-2017 mestre

Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on
this diff won't benefit that much since it happens near the terminal path, but
someone might copy the unsafe idiom to another program and place it where it
may leak sensitive data.

Discussed aeons ago with tb@, OK deraadt@ and beck@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 28-May-2016 tedu

repair braces. from ilya.kaliman/gsoares/natano


Revision tags: OPENBSD_5_9_BASE
# 1.32 15-Oct-2015 tedu

lock needs pledge(proc exec) to use bsd auth system. from trondd


# 1.31 10-Oct-2015 deraadt

normalize a few more tame request orderings, to help review


# 1.30 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.29 07-Oct-2015 deraadt

tame "stdio getpw rpath wpath tty". "tty" allows this to use
readpassphrase().


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.28 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.27 22-Aug-2013 guenther

Correct format string mismatches turned up by -Wformat=2

suggestions and ok millert@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.26 13-Jun-2010 tobias

Prevent a segmentation fault. It could occur when login_getclass fails and
the key "s/key" is entered with supplied -a or -p option.

ok millert (with better error message)


Revision tags: OPENBSD_4_7_BASE
# 1.25 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.24 18-Sep-2009 martynas

like login(1), back off password guesses after login-backoff; and
reset cnt after login-tries. tweak & ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.23 26-Apr-2006 deraadt

pleasing lint, without displeasing future developers


# 1.22 26-Apr-2006 deraadt

merge parts of strtonum() cleanup from tan.dang@gmail.com


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.21 14-Jul-2005 jmc

- better synopsis
- sort options
- sync usage()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 15-Aug-2002 deraadt

knf


# 1.18 04-Aug-2002 deraadt

ansi


# 1.17 23-Jun-2002 deraadt

uid_t and gid_t are unsigned


# 1.16 08-May-2002 millert

_exit() not exit() in signal handler.


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.14 02-Nov-2001 deraadt

avoid stdio in signal handler


Revision tags: OPENBSD_3_0_BASE
# 1.13 29-May-2001 millert

adapt to BSD authentication and clean things up a bit while I am at it


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.12 06-Mar-1999 millert

back out changes that should not have escaped my local tree


# 1.11 06-Mar-1999 millert

add missing reference to infocmp


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.10 27-Jul-1997 millert

A bit of KNF


# 1.9 27-Jul-1997 millert

-Wall


Revision tags: OPENBSD_2_1_BASE
# 1.8 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.7 16-Oct-1996 millert

s/key support now works (s/key lookup must be done with euid == 0)


Revision tags: OPENBSD_2_0_BASE
# 1.6 06-Sep-1996 downsj

Add -n/no timeout option. FreeBSD PR bin/1567, obrien@Nuxi.cs.ucdavis.edu.


# 1.5 06-Aug-1996 deraadt

type cleanup


# 1.4 25-Jul-1996 deraadt

readable


# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 24-May-1996 deraadt

use protos


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision