Kartik Agaram 43b17b1cd0 restore documentation on the build config language %!s(int64=6) %!d(string=hai) anos
..
Config.src 43b17b1cd0 restore documentation on the build config language %!s(int64=6) %!d(string=hai) anos
Kbuild.src 95dee81a46 loginutils/*: convert to new-style "one file" applets %!s(int64=9) %!d(string=hai) anos
README 834aba3b72 comment and readme updates %!s(int64=8) %!d(string=hai) anos
add-remove-shell.c 7b8372b819 add/remove-shell,add/deluser,add/delgroup: make them NOEXEC %!s(int64=7) %!d(string=hai) anos
addgroup.c 82d1c1f84a randomconfig fixes %!s(int64=6) %!d(string=hai) anos
adduser.c 22542eca18 getopt32: remove opt_complementary %!s(int64=7) %!d(string=hai) anos
chpasswd.c 22542eca18 getopt32: remove opt_complementary %!s(int64=7) %!d(string=hai) anos
cryptpw.c 17058a06c4 libbb: switch bb_ask_noecho() to "mallocing" string return API %!s(int64=6) %!d(string=hai) anos
deluser.c 036585a911 getopt32: remove applet_long_options %!s(int64=7) %!d(string=hai) anos
getty.c 22542eca18 getopt32: remove opt_complementary %!s(int64=7) %!d(string=hai) anos
login.c 7bcde5f00d libbb.h: always include sys/resource.h %!s(int64=6) %!d(string=hai) anos
passwd.c 7bcde5f00d libbb.h: always include sys/resource.h %!s(int64=6) %!d(string=hai) anos
su.c 72089cf6b4 config: deindent all help texts %!s(int64=7) %!d(string=hai) anos
sulogin.c 5c527dc57e make 17 state-changing execing applets (ex: "nice PROG ARGS") noexec %!s(int64=7) %!d(string=hai) anos
vlock.c 22542eca18 getopt32: remove opt_complementary %!s(int64=7) %!d(string=hai) anos

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 disconnected? 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 "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.