aboutsummaryrefslogtreecommitdiff
path: root/libexec/getty/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | 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
* libexec: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | 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
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* getty: Avoid NULL deref if stdin is not a tty.Dag-Erling Smørgrav2022-11-041-3/+8
| | | | | | Sponsored by: Klara, Inc. Obtained from: Apple OSS Distributions Differential Revision: https://reviews.freebsd.org/D37265
* getty: code cleanup, part 2Dag-Erling Smørgrav2022-11-041-62/+62
| | | | | | | * Clean up whitespace * Reindent Sponsored by: Klara, Inc.
* getty: code cleanup, part 1Dag-Erling Smørgrav2022-11-041-11/+7
| | | | | | | | | | | | * 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
* getty: const'ify search pointer.Xin LI2021-05-091-1/+2
| | | | | | No functional change. MFC after: 2 weeks
* Simplify code with strlcpy/strlcat.Xin LI2019-12-011-3/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=355260
* Prevent getty(8) from looping indefinitely if the device node doesn'tEdward Tomasz Napierala2018-02-251-2/+4
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=329992
* Build getty(8) with WARNS=6.Edward Tomasz Napierala2018-02-211-5/+6
| | | | | | | | | | Reviewed by: imp@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14197 Notes: svn path=/head/; revision=329724
* Sprinkle static; avoid nested externs.Edward Tomasz Napierala2018-02-041-15/+13
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328858
* Rename getty's getline() to get_line(), to avoid clash with getline(3).Edward Tomasz Napierala2018-02-041-3/+3
| | | | | | | | | Obtained from: DragonFlyBSD MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328856
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* Add a new getty/gettytab capability to generate an initial message dynamically.David Bright2017-09-071-0/+2
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=323252
* Remove LOG_ODELAY because it does nothing.Neel Natu2014-08-171-1/+1
| | | | | | | | Reviewed by: jilles CR: https://reviews.freebsd.org/D611 Notes: svn path=/head/; revision=270111
* Remove the 3rd clause ("advertising clause") of the BSD license asChristian Brueffer2014-02-171-5/+1
| | | | | | | | | | permitted by the University of Berkeley on July 22, 1999. Reviewed by: imp MFC after: 1 week Notes: svn path=/head/; revision=262136
* Add __unused. Ansi prototypes.Philippe Charnier2010-12-201-3/+3
| | | | Notes: svn path=/head/; revision=216582
* Add a new libc function: cfmakesane(3).Ed Schouten2010-11-021-5/+7
| | | | | | | | | | | | | | 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_*. Notes: svn path=/head/; revision=214680
* Include gettytab.h before extern.h so that the declarations of structStefan Farfeleder2005-04-061-1/+1
| | | | | | | gettyflags, gettynums and gettystrs are available. Notes: svn path=/head/; revision=144716
* Report once that the device isn't there, but keep trying. Don'tWarner Losh2004-09-291-21/+14
| | | | | | | | filter the errno values. They don't make as much sense as they used to given how we do devices in /dev. Notes: svn path=/head/; revision=135941
* Prototype defttymode() instead of just declaring it.Yaroslav Tykhiy2003-07-181-1/+1
| | | | Notes: svn path=/head/; revision=117738
* - Use the initial terminal mode instead of the current modeYaroslav Tykhiy2003-06-181-59/+50
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=116533
* In the last clean-up of this code, the fact that the default tty modeBrian Feldman2003-06-141-6/+20
| | | | | | | | | | | 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(). Notes: svn path=/head/; revision=116329
* Read gettytab(5) soon enough to fill in all necessary values.Yaroslav Tykhiy2003-06-101-16/+39
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=116164
* Spot one more place where boolean variables were incrementedYaroslav Tykhiy2003-06-101-1/+1
| | | | | | | instead of just being assigned a truth value. Notes: svn path=/head/; revision=116155
* Coding style fix: Use "foo = 1" instead of "foo++" to assignYaroslav Tykhiy2003-06-101-2/+2
| | | | | | | | the truth value to a boolean variable, especially when inside a loop. The variable can overflow otherwise, at least in theory. Notes: svn path=/head/; revision=116154
* Fix some minor bugs, namely:Yaroslav Tykhiy2003-06-061-3/+14
| | | | | | | | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=115900
* Fix a typo (missed &&).Maxim Sobolev2003-01-201-1/+1
| | | | | | | Submitted by: marcus Notes: svn path=/head/; revision=109555
* Add a new gettytab(5) option - `pl', which if set tells getty that the lineMaxim Sobolev2003-01-191-3/+3
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=109540
* #include <sys/time.h> instead of depending on namespace pollution inBruce Evans2002-02-251-3/+3
| | | | | | | | | <sys/stat.h> for its prerequisite <sys/time.h>. Removed a duplicated include. Sorted includes. Notes: svn path=/head/; revision=91216
* Remove some unused variables, mark unused parameters as unused and changeWarner Losh2002-02-061-13/+12
| | | | | | | | names of variables that shadow globally declared variables. This should help people doing later WARNS= fixes. Notes: svn path=/head/; revision=90302
* o __P removalWarner Losh2002-02-061-47/+32
| | | | | | | | o remove register o use strict prototypes Notes: svn path=/head/; revision=90301
* Add 'df' string to gettytab - the strftime(3) format for %dYaroslav Tykhiy2001-06-071-1/+1
| | | | | | | | | in the banner messages (of course, defaults to "%+"). Submitted by: Gleb Smirnoff <glebius@tak.estra.ru> Notes: svn path=/head/; revision=77874
* Check return code from login_tty. Allow getty to try and becomeJohn W. De Boskey2000-11-191-1/+12
| | | | | | | | | | a daemon and session leader (thus allowing getty to be run from a shell command line or script). Partially Reviewed by: bde Notes: svn path=/head/; revision=68888
* Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and therebyGarrett Wollman2000-10-101-0/+1
| | | | | | | <time.h>). Notes: svn path=/head/; revision=66907
* Add 'nc' flag to gettytab -- no carrier. Forces non-blocking open andNick Sayer2000-07-311-2/+3
| | | | | | | | | | setting of CLOCAL. Necessary for 3 wire RS-232 setups with dumb terminals. PR: 5959 Notes: svn path=/head/; revision=64076
* Changed setflags() to set_flags(). This fixes world breakage due toBruce Evans2000-01-281-3/+3
| | | | | | | recently incremented namespace pollution in <unistd.h>. Notes: svn path=/head/; revision=56725
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Ensure that things returned by gethostname() andBrian Somers1999-04-071-2/+3
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=45422
* Add an 'al' (autologin username) capability to getty/gettytab. This is aPeter Wemm1999-04-041-4/+21
| | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=45291
* Set the CPU resource limit back to infinity before exec()ing PP.Brian Somers1999-03-091-1/+4
| | | | | | | PR: 10399 Notes: svn path=/head/; revision=44615
* This thing has its own puts function, so use it.Jordan K. Hubbard1998-10-081-1/+3
| | | | | | | Submitted by: Matthew Jacob <mjacob@nas.nasa.gov> Notes: svn path=/head/; revision=40083
* Correct incompletes .Xrs. Remove duplicate #includes and unused variables.Philippe Charnier1997-11-211-9/+10
| | | | Notes: svn path=/head/; revision=31331
* Removed unused variables.Alexander Langer1997-06-271-4/+1
| | | | Notes: svn path=/head/; revision=26999
* Reset alarm before invoking ppplogin.David Nugent1997-06-031-1/+3
| | | | | | | | | | PR: 3733 Reviewed by: Submitted by: kfurge@worldnet.att.net Obtained from: Notes: svn path=/head/; revision=26415
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22989
* Tidy-up modem-chat handling: ensure tty modes are restored toDavid Nugent1997-02-091-10/+17
| | | | | | | | | | | | '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. Notes: svn path=/head/; revision=22491
* Increased username size to allow passing username:auth_method toDavid Nugent1997-02-071-1/+1
| | | | | | | login. Notes: svn path=/head/; revision=22400
* Make username size dependant on MAXLOGNAME in sys/param.h. WasDavid Nugent1997-02-021-2/+2
| | | | | | | | | previously hard-coded at 16 characters (and possibly overflowing the field when NUL terminating a username of exactly 16 characters in length). Notes: svn path=/head/; revision=22211
* Added:David Nugent1997-02-021-50/+183
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=22208