History log of /freebsd-current/libexec/getty/main.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 43581d7b 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

libexec: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# eb4d86d5 04-Nov-2022 Dag-Erling Smørgrav <des@FreeBSD.org>

getty: Avoid NULL deref if stdin is not a tty.

Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions
Differential Revision: https://reviews.freebsd.org/D37265


# f285f414 04-Nov-2022 Dag-Erling Smørgrav <des@FreeBSD.org>

getty: code cleanup, part 2

* Clean up whitespace
* Reindent

Sponsored by: Klara, Inc.


# 8ad7a14a 04-Nov-2022 Dag-Erling Smørgrav <des@FreeBSD.org>

getty: code cleanup, part 1

* Avoid unnecessary use of `unsigned char *`
* Use explicit casts when assigning `unsigned char *` to `char *` or vice versa
* Drop unused global variables (and fix memory leak in `gettable()`)
* Use `snprintf()` instead of `strcpy()` + `strcat()`
* Drop spurious braces in switch

Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions (in part)
Differential Revision: https://reviews.freebsd.org/D37263


# 5927c1bb 08-May-2021 Xin LI <delphij@FreeBSD.org>

getty: const'ify search pointer.

No functional change.

MFC after: 2 weeks


# 76b71718 01-Dec-2019 Xin LI <delphij@FreeBSD.org>

Simplify code with strlcpy/strlcat.

MFC after: 2 weeks


# 170430d5 25-Feb-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Prevent getty(8) from looping indefinitely if the device node doesn't
exist. This behaviour makes no sense for eg USB serial adapters, or
USB device-side serial templates.

This mostly reverts to pre-r135941 behaviour.

Reviewed by: imp@
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14198


# 18587b84 21-Feb-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Build getty(8) with WARNS=6.

Reviewed by: imp@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14197


# 9c33cc93 04-Feb-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Sprinkle static; avoid nested externs.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 9a9a988e 04-Feb-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Rename getty's getline() to get_line(), to avoid clash with getline(3).

Obtained from: DragonFlyBSD
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# ff48be37 06-Sep-2017 David Bright <dab@FreeBSD.org>

Add a new getty/gettytab capability to generate an initial message dynamically.

This modification adds a new gettytab(5) option (iM) to specify a
program to run that will generate the initial (banner) message that is
displayed before the login prompt. Such a capability is useful when
dynamic information is needed in the banner message that cannot be
supplied by the set of % substitution sequences available in the "im"
option.

Reviewed by: vangyzen, wblock, manpages
Approved by: vangyzen (mentor)
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D12108


# 06224a94 17-Aug-2014 Neel Natu <neel@FreeBSD.org>

Remove LOG_ODELAY because it does nothing.

Reviewed by: jilles
CR: https://reviews.freebsd.org/D611


# 5efaea4c 17-Feb-2014 Christian Brueffer <brueffer@FreeBSD.org>

Remove the 3rd clause ("advertising clause") of the BSD license as
permitted by the University of Berkeley on July 22, 1999.

Reviewed by: imp
MFC after: 1 week


# 9f8c3129 20-Dec-2010 Philippe Charnier <charnier@FreeBSD.org>

Add __unused. Ansi prototypes.


# 736fc286 02-Nov-2010 Ed Schouten <ed@FreeBSD.org>

Add a new libc function: cfmakesane(3).

I've noticed various terminal emulators that need to obtain a sane
default termios structure use very complex `hacks'. Even though POSIX
doesn't provide any functionality for this, extend our termios API with
cfmakesane(3), which is similar to the commonly supported cfmakeraw(3),
except that it fills the termios structure with sane defaults.

Change all code in our base system to use this function, instead of
depending on <sys/ttydefaults.h> to provide TTYDEF_*.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 410f13a5 06-Apr-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Include gettytab.h before extern.h so that the declarations of struct
gettyflags, gettynums and gettystrs are available.


# 780afd18 29-Sep-2004 Warner Losh <imp@FreeBSD.org>

Report once that the device isn't there, but keep trying. Don't
filter the errno values. They don't make as much sense as they used
to given how we do devices in /dev.


# 0183b0b8 18-Jul-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

Prototype defttymode() instead of just declaring it.


# b19ab1ce 18-Jun-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

- Use the initial terminal mode instead of the current mode
as the source of defaults for terminal device parameters.

- Do duplucate code reduction and simplification enabled by
the above.

Reviewed by: green
MFC after: 1 month


# 7ce06101 14-Jun-2003 Brian Feldman <green@FreeBSD.org>

In the last clean-up of this code, the fact that the default tty mode
information could only be gleaned from the the tty descriptor itself
was neglected, so never did the tty's default settings get copied from
the kernel. Specifically, this caused all manner of ctrl-keys to not
work. Fix this by calling dogettytab() in all the proper places, and
retrieving the terminfo temporarily in dogettytab().


# 3cd7e229 10-Jun-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

Read gettytab(5) soon enough to fill in all necessary values.
Re-read gettytab(5) only if needed.

This fixes bugs introduced as long ago as in getty/main.c rev.1.15.

PR: bin/18181
MFC after: 1 month


# 5f596fa5 10-Jun-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

Spot one more place where boolean variables were incremented
instead of just being assigned a truth value.


# 8b52276d 10-Jun-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

Coding style fix: Use "foo = 1" instead of "foo++" to assign
the truth value to a boolean variable, especially when inside
a loop. The variable can overflow otherwise, at least in theory.


# f648dfd9 06-Jun-2003 Yaroslav Tykhiy <ytykhiy@gmail.com>

Fix some minor bugs, namely:

- Initialize "rval", which would be used uninitialized
if al or pl options were set.

- Don't pass an empty string to login(1) as a user name
(this could be triggered by entering a name and then killing it
with backspace or ^U.)

- Don't loop endlessly if the al option specifies a bogus (i.e.,
not alphanumeric) auto-login name.

- Don't pass a bogus user name to login(1) if a good name were
entered and then killed with ^U.

- Exit with status 0, not 1, on receiving an EOF character,
since it's not a error condition.

MFC after: 1 week


# 0fd65278 20-Jan-2003 Maxim Sobolev <sobomax@FreeBSD.org>

Fix a typo (missed &&).

Submitted by: marcus


# 9b766048 19-Jan-2003 Maxim Sobolev <sobomax@FreeBSD.org>

Add a new gettytab(5) option - `pl', which if set tells getty that the line
in question is PPP-only line, i.e. no PPP-sequence detection is necessary and
PPP login program referenced by `pp' should be started automatically instead of
login(1)

Feature suggested and sponsored by: United Networks of Ukraine
No reply from: re
MFC after: 2 weeks


# e395985f 24-Feb-2002 Bruce Evans <bde@FreeBSD.org>

#include <sys/time.h> instead of depending on namespace pollution in
<sys/stat.h> for its prerequisite <sys/time.h>.

Removed a duplicated include. Sorted includes.


# 0b3356e1 06-Feb-2002 Warner Losh <imp@FreeBSD.org>

Remove some unused variables, mark unused parameters as unused and change
names of variables that shadow globally declared variables. This should
help people doing later WARNS= fixes.


# 95289b27 06-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P removal
o remove register
o use strict prototypes


# db563f31 07-Jun-2001 Yaroslav Tykhiy <ytykhiy@gmail.com>

Add 'df' string to gettytab - the strftime(3) format for %d
in the banner messages (of course, defaults to "%+").

Submitted by: Gleb Smirnoff <glebius@tak.estra.ru>


# 46ee2856 18-Nov-2000 John W. De Boskey <jwd@FreeBSD.org>

Check return code from login_tty. Allow getty to try and become
a daemon and session leader (thus allowing getty to be run from
a shell command line or script).

Partially Reviewed by: bde


# eb2fc780 09-Oct-2000 Garrett Wollman <wollman@FreeBSD.org>

Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).


# 3d4a189e 31-Jul-2000 Nick Sayer <nsayer@FreeBSD.org>

Add 'nc' flag to gettytab -- no carrier. Forces non-blocking open and
setting of CLOCAL. Necessary for 3 wire RS-232 setups with dumb
terminals.

PR: 5959


# 21bac31e 28-Jan-2000 Bruce Evans <bde@FreeBSD.org>

Changed setflags() to set_flags(). This fixes world breakage due to
recently incremented namespace pollution in <unistd.h>.


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 9e9a43bd 07-Apr-1999 Brian Somers <brian@FreeBSD.org>

Ensure that things returned by gethostname() and
friends are terminated and allow for a maximum
host name length of MAXHOSTNAMELEN - 1.
Put parenthesis around sizeof args.
Make some variables static.
Fix telnetd -u (broken by my last commit)

Prompted by: bde


# 610b0299 03-Apr-1999 Peter Wemm <peter@FreeBSD.org>

Add an 'al' (autologin username) capability to getty/gettytab. This is a
damn useful thing for using with serial consoles in clusters etc or secure
console locations. Using a custom gettytab entry for console with
an entry like 'al=root' means that there is *always* a root login ready on
the console. This should replace hacks like those which go with conserver
etc. (This is a loaded gun, watch out for those feet!)

Submitted by: "Andrew J. Korty" <ajk@purdue.edu>


# 23bc0584 09-Mar-1999 Brian Somers <brian@FreeBSD.org>

Set the CPU resource limit back to infinity before exec()ing PP.
PR: 10399


# 3a2d9231 08-Oct-1998 Jordan K. Hubbard <jkh@FreeBSD.org>

This thing has its own puts function, so use it.
Submitted by: Matthew Jacob <mjacob@nas.nasa.gov>


# d748864d 21-Nov-1997 Philippe Charnier <charnier@FreeBSD.org>

Correct incompletes .Xrs. Remove duplicate #includes and unused variables.


# 33a0249f 02-Aug-1997 Bruce Evans <bde@FreeBSD.org>

Import Lite2's src/libexec, except for makekey (which was spammed
by a repository copy from 1.1.5 and patched back to Lite1) and
rbootd/bootdir/SYSHPBSD (which is binary). All changed files have
already left the vendor branch.


# b84136c8 27-Jun-1997 Alexander Langer <alex@FreeBSD.org>

Removed unused variables.


# 85f5c850 02-Jun-1997 David Nugent <davidn@FreeBSD.org>

Reset alarm before invoking ppplogin.
PR: 3733
Reviewed by:
Submitted by: kfurge@worldnet.att.net
Obtained from:


# 9e522f7a 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 26015440 09-Feb-1997 David Nugent <davidn@FreeBSD.org>

Tidy-up modem-chat handling: ensure tty modes are restored to
'sane' standard (not raw) settings before abort/exiting; move
responsibility of setting raw mode for chat-handling out of
chat.c to avoid doing redundant tc{s,g}etattr()s; move DE
pause prior setting standard mode before issue/login prompt to
avoid echoing modem connect strings. Fixed up comment styles
in a couple of places.


# c2efe923 07-Feb-1997 David Nugent <davidn@FreeBSD.org>

Increased username size to allow passing username:auth_method to
login.


# 635b1c49 02-Feb-1997 David Nugent <davidn@FreeBSD.org>

Make username size dependant on MAXLOGNAME in sys/param.h. Was
previously hard-coded at 16 characters (and possibly overflowing
the field when NUL terminating a username of exactly 16 characters
in length).


# fe552114 02-Feb-1997 David Nugent <davidn@FreeBSD.org>

Added:
ic=expect/send script modem init script
ac=expect/send script modem answer script
ct#val chat script timeout (seconds)
rt#val recycle timeout (seconds) if 'ac' set
dc#val debug bitmask for debugging chat scripts
hw (boolean) enable crtscts handshaking
if=path 'issue' file sent prior login prompt

chat.c is a simplistic expect/send chat module.


# e91c4f7c 02-Feb-1997 David Nugent <davidn@FreeBSD.org>

Fix bug in %s, %m, %r and %v macros not displaying data.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# b2a1dd44 30-Dec-1996 Mike Smith <msmith@FreeBSD.org>

Add a new 'de' capability, specifying a number of seconds to sleep before
emitting the initial prompt.

This is useful in a number of circumstances :
- you have (a) stupid modem(s) that assert(s) DCD too soon.
- you have dialin users with stupid diallers and poorly
written chatscripts. (esp. some Winsock diallers)

BSD/OS also has this capability.

Submitted by: damian@cablenet.net (Damian Hamill)


# ee936a69 12-Nov-1996 Paul Traina <pst@FreeBSD.org>

Add the >optional< ability to sense PPP link bringups and call an authentication program


# 65fe4a53 07-May-1996 Andrey A. Chernov <ache@FreeBSD.org>

Replace non-POSIX speed setting by POSIX one


# cae66988 05-May-1996 Joerg Wunsch <joerg@FreeBSD.org>

Finally commit the changes that make getty(8) no longer depend on the
COMPAT_43 cruft. This is supposedly the last core utility that has
been using it! (So now, one should be able to remove this option from
the config files. Be aware that the last officially released xterm
however still requires it.)

The getty has been running now for several weeks on my modem line, so
i feel safe about it.

Obtained from: mostly from the NetBSD vendor-branch


# 712c581c 13-Apr-1996 Joerg Wunsch <joerg@FreeBSD.org>

Import NetBSD's termios'ed getty into a vendor branch.

Obtained from: NetBSD 1.1R


# 6186bd5d 02-Aug-1995 Jordan K. Hubbard <jkh@FreeBSD.org>

Back this change out. It's just not worth arguing over and any further emails
I get on this topic will go straight to /dev/null. This is absolutely the
last word on this topic you'll see from me. Too much time has already been
wasted.


# 4d7ccc95 01-Aug-1995 Jordan K. Hubbard <jkh@FreeBSD.org>

A useful aid.. Add support for:

%r: current release
%m: machine architecture type (i386 for now)
%s: OS name (FreeBSD)

from uname() in banner string.


# 6c06b4e2 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 80226580 17-Sep-1994 David Greenman <dg@FreeBSD.org>

Fix from John Kohl:

/usr/libexec/getty doesn't properly interpret the '%d' escape. It tries
to use %P to get AM or PM, but instead all it gets is "P".

Submitted by: John Kohl


# dd3065a5 29-Aug-1994 Andrey A. Chernov <ache@FreeBSD.org>

Ignore SIGQUITs, cause getty dumps core on garbadge from modem line


# fef0aded 25-Aug-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

Replace this with the 1.1.5.1 getty. David says that the 4.4 version is too
broken to live.
Submitted by: jkh


# 23136731 22-Aug-1994 Guido van Rooij <guido@FreeBSD.org>

Implement fbtab ala SunSO.
Could not compile it (on thud) because ttychar.h was still broken.
Reviewed by:
Submitted by: guido


# ea022d16 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Libexec Sources