hush/loginutils
Denys Vlasenko 550bf5b4a4 remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds
function                                             old     new   delta
xfunc_has_died                                         -      21     +21
sleep_much                                             -      12     +12
sleep10                                                -       9      +9
die_func                                               -       4      +4
fflush_stdout_and_exit                                35      36      +1
builtin_type                                         121     119      -2
die_sleep                                              4       -      -4
xfunc_die                                             60      24     -36
hush_main                                           1128    1011    -117
die_jmp                                              156       -    -156
------------------------------------------------------------------------------
(add/remove: 4/2 grow/shrink: 1/3 up/down: 47/-315)          Total: -268 bytes
   text	   data	    bss	    dec	    hex	filename
 939992	    992	  17652	 958636	  ea0ac	busybox_old
 939880	    992	  17496	 958368	  e9fa0	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 16:42:57 +02:00
..
Config.src Kbuild: move CONFIG_PAM to general configuration 2014-02-19 18:53:25 +01:00
Kbuild.src *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
README getty: fix a minor problem of Ctrl-D not printing '\n' 2011-10-23 23:58:59 +02:00
add-remove-shell.c build system: -fno-builtin-printf 2015-10-07 22:42:45 +02:00
addgroup.c addgroup: mention -S in the help text 2014-08-15 14:29:43 +02:00
adduser.c adduser: fix help text 2015-09-21 21:11:12 +02:00
chpasswd.c passwd,cryptpw: make default encryption algorithm configurable 2012-01-08 16:44:37 +01:00
cryptpw.c cryptpw: do not segfault on EOF. Closes 6350 2013-06-30 21:28:55 +02:00
deluser.c deluser: also remove user from /etc/group 2015-03-12 15:30:46 +01:00
getty.c remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds 2015-10-09 16:42:57 +02:00
login.c login: don't print motd if .hushlogin exists in users home 2015-08-24 22:16:48 +02:00
passwd.c libbb: move nuke_str() from passwd into libbb 2013-11-19 13:36:45 +01:00
su.c su: add a delay if the password is incorrect 2014-03-16 11:18:19 +01:00
sulogin.c sulogin: use common password-checking routine. 2013-11-19 13:09:06 +01:00
vlock.c sulogin: use common password-checking routine. 2013-11-19 13:09:06 +01:00

README

	Getty

??? Should getty open tty with or without O_NONBLOCK?
For serial lines, it means "should getty wait for Carrier Detect pin?"
I checked other getties:

- agetty always uses O_NONBLOCK
- mgetty uses O_NONBLOCK unless run with -b, or as "getty"

??? If we decided to use O_NONBLOCK (perhaps optionally with -b),
when getty should send -I INITSTR data to tty? After open succeeds?
What if we also want to initialize *modem* with some AT commands?

??? Should we check/create /var/lock/LCK..ttyPFX lockfiles?

??? mgetty opens tty but does NOT lock it, then waits for input via
select/poll, and when input is available, it checks lock file.
If it exists, mgetty exits (it assumes someone else uses the line).
If no, it creates the file (lock the tty). Sounds like a good algorithm
to use if we are called with -w...

Getty should establish a new session and process group, and ensure
that tty is a ctty.

??? Should getty ensure that other processes which might have opened
fds to this tty be dusconnected? agetty has a -R option which makes
agetty call vhangup() after tty is opened. (Then agetty opens it again,
since it probably vhangup'ed its own fd too).

Getty should leave the tty in approximately the same state as "stty sane"
before it execs login program. Minor things we do conditionally are:
	c_iflag |= ICRNL; // if '\r' was used to end username

??? mgetty uses per-tty file to ignore connects, /etc/nologin.ttyxx -
is it useful?

It should be possible to run "getty 0 -" from a shell prompt.
[This currently doesn't work from interactive shell since setsid()
fails in process group leader. The workaround is to run it as a child
of something. sh -c 'getty - 0; true' usually works. Should we fix this?]
It should leave tty in a sane state when it exits (Ctrl-D, -t SEC timeout):
echo should be on, speed, control chars properly set, etc.
(However, it can't restore ctty. The symptom is that "</dev/tty"
fails in the parent shell after getty exits: /dev/tty can't be opened).

Getty should write LOGIN_PROCESS utmp record before it starts waiting
for username to be entered.

	Login

Login should not try to set up tty parameters - apart from switching echo
off while entering password, and switching it back on after.

Login should not leave "echo off" state when it times out reading password
or otherwise terminates (Ctrl-C, Ctrl-D etc).

??? Should login establish a new session and/or process group, and ensure
that tty is a ctty? Without this, running login directly (not via getty)
from e.g. initscript will usually result with a login session without
ctty and without session/pgrp properly created...

It should be possible to run "login [USER]" from a shell prompt,
and it should work (not block/die/error out).
Similarly to getty, it should leave tty in the sane state when it exits.

??? Should login write LOGIN_PROCESS utmp record before it starts waiting
for username/password to be entered?

Login should write USER_PROCESS utmp record just before it is about
to exec user's shell.