Commit graph

64 commits

Author SHA1 Message Date
Warner Losh 0b8224d1cc 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
2023-11-26 22:23:58 -07:00
Warner Losh 43581d7b66 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
2023-11-26 22:23:28 -07:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Dag-Erling Smørgrav eb4d86d529 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
2022-11-04 15:54:01 +01:00
Dag-Erling Smørgrav f285f41498 getty: code cleanup, part 2
* Clean up whitespace
* Reindent

Sponsored by:	Klara, Inc.
2022-11-04 15:22:04 +01:00
Dag-Erling Smørgrav 8ad7a14ab4 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
2022-11-04 15:19:27 +01:00
Xin LI 5927c1bb31 getty: const'ify search pointer.
No functional change.

MFC after:	2 weeks
2021-05-08 21:53:29 -07:00
Xin LI 76b71718fe Simplify code with strlcpy/strlcat.
MFC after:	2 weeks
2019-12-01 08:04:22 +00:00
Edward Tomasz Napierala 170430d505 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
2018-02-25 20:15:06 +00:00
Edward Tomasz Napierala 18587b84c5 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
2018-02-21 15:57:24 +00:00
Edward Tomasz Napierala 9c33cc93cd Sprinkle static; avoid nested externs.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-02-04 19:05:13 +00:00
Edward Tomasz Napierala 9a9a988e26 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
2018-02-04 18:39:58 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

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

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
David Bright ff48be37b5 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
2017-09-07 00:20:17 +00:00
Neel Natu 06224a9492 Remove LOG_ODELAY because it does nothing.
Reviewed by:	jilles
CR:		https://reviews.freebsd.org/D611
2014-08-17 19:06:26 +00:00
Christian Brueffer 5efaea4cc6 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
2014-02-17 22:27:32 +00:00
Philippe Charnier 9f8c312911 Add __unused. Ansi prototypes. 2010-12-20 08:29:54 +00:00
Ed Schouten 736fc28680 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_*.
2010-11-02 17:00:56 +00:00
Stefan Farfeleder 410f13a58d Include gettytab.h before extern.h so that the declarations of struct
gettyflags, gettynums and gettystrs are available.
2005-04-06 17:42:24 +00:00
Warner Losh 780afd18cd 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.
2004-09-29 20:55:14 +00:00
Yaroslav Tykhiy 0183b0b8b8 Prototype defttymode() instead of just declaring it. 2003-07-18 16:25:55 +00:00
Yaroslav Tykhiy b19ab1ce69 - 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
2003-06-18 13:22:44 +00:00
Brian Feldman 7ce06101b8 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().
2003-06-14 08:26:47 +00:00
Yaroslav Tykhiy 3cd7e22936 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
2003-06-10 18:30:41 +00:00
Yaroslav Tykhiy 5f596fa5d0 Spot one more place where boolean variables were incremented
instead of just being assigned a truth value.
2003-06-10 16:34:03 +00:00
Yaroslav Tykhiy 8b52276d10 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.
2003-06-10 15:38:35 +00:00
Yaroslav Tykhiy f648dfd929 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
2003-06-06 14:36:41 +00:00
Maxim Sobolev 0fd652782b Fix a typo (missed &&).
Submitted by:	marcus
2003-01-20 10:33:35 +00:00
Maxim Sobolev 9b76604885 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
2003-01-19 20:59:52 +00:00
Bruce Evans e395985f1d #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.
2002-02-25 02:30:04 +00:00
Warner Losh 0b3356e19e 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.
2002-02-06 16:47:06 +00:00
Warner Losh 95289b278a o __P removal
o remove register
o use strict prototypes
2002-02-06 16:38:40 +00:00
Yaroslav Tykhiy db563f3175 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>
2001-06-07 13:53:23 +00:00
John W. De Boskey 46ee285632 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
2000-11-19 02:10:25 +00:00
Garrett Wollman eb2fc78027 Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).
2000-10-10 01:50:26 +00:00
Nick Sayer 3d4a189e9f 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
2000-07-31 23:47:57 +00:00
Bruce Evans 21bac31e55 Changed setflags() to set_flags(). This fixes world breakage due to
recently incremented namespace pollution in <unistd.h>.
2000-01-28 07:12:03 +00:00
Peter Wemm 7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Brian Somers 9e9a43bdec 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
1999-04-07 08:27:45 +00:00
Peter Wemm 610b0299af 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>
1999-04-04 04:36:50 +00:00
Brian Somers 23bc058463 Set the CPU resource limit back to infinity before exec()ing PP.
PR:	10399
1999-03-09 22:04:44 +00:00
Jordan K. Hubbard 3a2d923136 This thing has its own puts function, so use it.
Submitted by:	Matthew Jacob <mjacob@nas.nasa.gov>
1998-10-08 23:14:02 +00:00
Philippe Charnier d748864d2c Correct incompletes .Xrs. Remove duplicate #includes and unused variables. 1997-11-21 07:43:53 +00:00
Alexander Langer b84136c8f6 Removed unused variables. 1997-06-27 21:51:59 +00:00
David Nugent 85f5c8500d Reset alarm before invoking ppplogin.
PR: 3733
Reviewed by:
Submitted by: kfurge@worldnet.att.net
Obtained from:
1997-06-03 12:56:47 +00:00
Peter Wemm 9e522f7a18 Revert $FreeBSD$ to $Id$ 1997-02-22 14:22:49 +00:00
David Nugent 26015440b9 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.
1997-02-09 16:12:08 +00:00
David Nugent c2efe923b5 Increased username size to allow passing username:auth_method to
login.
1997-02-07 11:45:10 +00:00
David Nugent 635b1c4908 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).
1997-02-02 14:43:32 +00:00
David Nugent fe552114a3 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.
1997-02-02 14:24:57 +00:00