History log of /openbsd-current/libexec/getty/main.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.55 28-Apr-2024 florian

gmtime(3) / locatime(3) can fail when timestamps are way off.

Add missing error checks to all calls under libexec/

Input & OK millert


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.54 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.53 23-Jun-2019 rob

Explicitly lock unveil. Noticed when testing the recent ps(1) commit exposing
the unveil state of running processes.
ok deraadt@


# 1.52 01-May-2019 florian

Pull tname initialization up since it's used in an error path.
Pointed out by jsg, just fix it deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.51 17-Nov-2018 deraadt

need to closefrom(0) before execve(), otherwise tty isn't properly
'hung up'; some testing by Theodore Wynnychenko


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.54 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


# 1.53 23-Jun-2019 rob

Explicitly lock unveil. Noticed when testing the recent ps(1) commit exposing
the unveil state of running processes.
ok deraadt@


# 1.52 01-May-2019 florian

Pull tname initialization up since it's used in an error path.
Pointed out by jsg, just fix it deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.51 17-Nov-2018 deraadt

need to closefrom(0) before execve(), otherwise tty isn't properly
'hung up'; some testing by Theodore Wynnychenko


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.53 23-Jun-2019 rob

Explicitly lock unveil. Noticed when testing the recent ps(1) commit exposing
the unveil state of running processes.
ok deraadt@


# 1.52 01-May-2019 florian

Pull tname initialization up since it's used in an error path.
Pointed out by jsg, just fix it deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.51 17-Nov-2018 deraadt

need to closefrom(0) before execve(), otherwise tty isn't properly
'hung up'; some testing by Theodore Wynnychenko


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.52 01-May-2019 florian

Pull tname initialization up since it's used in an error path.
Pointed out by jsg, just fix it deraadt@


Revision tags: OPENBSD_6_5_BASE
# 1.51 17-Nov-2018 deraadt

need to closefrom(0) before execve(), otherwise tty isn't properly
'hung up'; some testing by Theodore Wynnychenko


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.51 17-Nov-2018 deraadt

need to closefrom(0) before execve(), otherwise tty isn't properly
'hung up'; some testing by Theodore Wynnychenko


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.50 15-Nov-2018 deraadt

Theodore Wynnychenko discovered the gettytab "lo=path" feature didn't work
anymore with unveil wired to /usr/bin/login. So let's parse gettytab a bit
earlier to learn which login path to unveil. Later in the loop gettytab is
re-parsed, if the login changes re-exec getty to reach the unveil from the top.
ok millert, also discussed with mestre


Revision tags: OPENBSD_6_4_BASE
# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.49 24-Sep-2018 deraadt

unveil(2) in getty. This has been in snaps for more than 2 months,
since I worry that a mistake in here will cause significant grief.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.48 29-May-2017 deraadt

do not need dev[] wasting bss space


# 1.47 28-May-2017 deraadt

Do a better job of not printing sequences we cannot reverse in DELETE or
KILL. Therefore we can do a better job cleaning up.
testing by benno


# 1.46 27-May-2017 deraadt

Stop echoing ANSI sequences back to the console, by expanding ESC character
to literal ^[. This makes getty interaction appear more like login, and
stops a mid-ANSI sequence parsing problem that messed up login, making it
freeze the session until timeout.
ok tedu fcambus


# 1.45 27-May-2017 deraadt

Stop supporting primordial # (erase) and @ (kill) sequences.
ok tedu


# 1.44 27-May-2017 tedu

remove the getname() code trying to handle baud < 1200 terminals.
leave the special down under code until somebody unearths why it exists.


Revision tags: OPENBSD_6_1_BASE
# 1.43 23-Jan-2017 deraadt

pledge a tiny bit later. This results in the specified tty being
opened before the first pledge call.
testing by tb and benno and others


Revision tags: OPENBSD_6_0_BASE
# 1.42 16-Mar-2016 krw

More "(<blah> *)0" -> NULL, avoiding any stdarg functions.

Feedback millert@ kettenis@


Revision tags: OPENBSD_5_9_BASE
# 1.41 16-Nov-2015 deraadt

Observe that FIOASYNC clearing for stdin is only done in the case where
getty receives the fd from init, so hoist it upwards. Since revoke(2)
is now allowed by pledge "rpath tty", the pledges can be hoisted much
higher.
ok millert semarie tedu guenther


# 1.40 06-Nov-2015 tedu

further PPP reduction, hint from sthen


# 1.39 06-Nov-2015 tedu

remove ppplogin support. ok sthen


# 1.38 16-Oct-2015 deraadt

Hoist clearing of FIOASYNC to much earlier, then getty can use
pledge "stdio rpath fattr proc exec tty".


Revision tags: OPENBSD_5_8_BASE
# 1.37 16-Jul-2015 tedu

remove ancient support for edited hostnames. ok deraadt (long ago)


# 1.36 14-Apr-2015 millert

Log a more useful error message if ttyname() fails. OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.35 16-Jan-2015 deraadt

adjust to HOST_NAME_MAX+1 & LOGIN_NAME_MAX


# 1.34 19-Nov-2014 krw

Nuke yet more obvious #include duplications.

ok deraadt@


# 1.33 18-Nov-2014 krw

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.32 27-Nov-2013 deraadt

unsigned char for ctype
ok okan kettenis


Revision tags: OPENBSD_5_4_BASE
# 1.31 04-Jun-2013 benno

do not go into upper to lower case translation mode when a all-caps
username has been entered.
ok deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.30 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


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.29 09-Feb-2008 mbalmer

Remove an old workaround that was needed in SCCS times (%M% expanding to the
filename).

ok mikeb, millert


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.28 29-Jul-2003 deraadt

spaces


# 1.27 05-Jul-2003 deraadt

protos


# 1.26 25-Jun-2003 deraadt

protos


# 1.25 02-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.24 03-Jul-2002 deraadt

KNF


# 1.23 22-May-2002 deraadt

a bunch more strcpy -> strlcpy and sprintf -> snprintf


Revision tags: OPENBSD_3_1_BASE
# 1.22 29-Mar-2002 deraadt

-Wall


# 1.21 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.20 19-Nov-2001 deraadt

remove the signal handler races and longjmps, and then do a bit of KNF


Revision tags: OPENBSD_3_0_BASE
# 1.19 08-Jul-2001 deraadt

-Wall


Revision tags: OPENBSD_2_9_BASE
# 1.18 31-Jan-2001 deraadt

more fat utmp; ianm@cit.uws.edu.au


# 1.17 28-Jan-2001 niklas

$OpenBSD$


# 1.16 19-Jan-2001 deraadt

mark remaining signal races


Revision tags: OPENBSD_2_8_BASE
# 1.15 07-Sep-2000 deraadt

off by one overflow


Revision tags: OPENBSD_2_7_BASE
# 1.14 09-Dec-1999 deraadt

oops


# 1.13 07-Dec-1999 deraadt

do not crash if stdin is not a tty


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.12 10-Jul-1998 deraadt

do not syslog() with "\n"; skipped smtpd/named/ipmon; 12 minutes of dabbling


Revision tags: OPENBSD_2_3_BASE
# 1.11 20-Nov-1997 deraadt

puts -> xputs


Revision tags: OPENBSD_2_2_BASE
# 1.10 05-Aug-1997 angelos

Remove duplicate inclusion of signal.h


# 1.9 23-Jul-1997 kstailey

tabify


# 1.8 02-Jun-1997 deraadt

if getty to# parameter is used, pp option has timeout problem; kfurge@worldnet.att.net, freebsd pr#3733


Revision tags: OPENBSD_2_1_BASE
# 1.7 06-Apr-1997 deraadt

clean -Wall


# 1.6 17-Dec-1996 tholo

Add traditional handling of all upper-case input


# 1.5 10-Dec-1996 deraadt

PPP autologin code from freebsd; do not use until pppd has been checked for security...


Revision tags: OPENBSD_2_0_BASE
# 1.4 22-May-1996 deraadt

libutil


# 1.3 22-Feb-1996 niklas

From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.


# 1.2 13-Nov-1995 deraadt

repair indentation


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision