summaryrefslogtreecommitdiffstats
path: root/login-utils/sulogin.c
Commit message (Collapse)AuthorAgeFilesLines
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: remove some inconsistent periods from error messagesBenno Schulenberg2014-08-111-2/+2
| | | | | | While doing so, also improve translatability and some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sulogin: don't use uninitialized struct sigaction [coverity scan]Karel Zak2014-07-171-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: check result of the open() [coverity scan]Karel Zak2014-07-171-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fixes for non-Linux systemsSamuel Thibault2014-06-191-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: beside virtual consoles support xvc and hvc device lines as wellWerner Fink2014-05-131-5/+12
| | | | | | | | For this approach do not use the ioctl TIOCMGET anymore as this is for real serial lines only. But switch over to use the ioctl KDGKBMODE as this is unique to the virtual console lines only. Signed-off-by: Werner Fink <werner@suse.de>
* agetty: better support of the special system consoles on S390Werner Fink2014-05-131-1/+7
| | | | | | | | | | | | | | | | | That is that there are several consoles, the /dev/ttyS0 which is type of ibm3215 and a dumb terminal, then there is the device /dev/3270/tty1 which can handle ANSI color escape sequences and is a ibm327x terminal, and the /dev/ttyS1 which is a vt220 terminal. The macro is_speed() in agetty.c allows to distinguish between the terminal line (/dev)3270/tty1 and the speed options on the command line used in /run/systemd/generator/getty.target.wants/serial-getty@3270-tty1.service which is a symbolic link to /usr/lib/systemd/system/serial-getty@.service Signed-off-by: Werner Fink <werner@suse.de>
* agetty: avoid that agetty nor sulogin are fooled by a running plymouthWerner Fink2014-05-131-1/+50
| | | | | | | | The nowadays used plymouth locks the devices used for the system console which causes that agetty as well as sulogin can not modify the termios settings of e.g. the serial devices of the systenm console. Signed-off-by: Werner Fink <werner@suse.de>
* include/c.h: prefer nanosleep() over usleep()Karel Zak2014-01-241-2/+2
| | | | | | | | | | | | | | Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: standardize some "cannot read" and "seek failed" error messagesBenno Schulenberg2013-10-091-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-3/+3
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sulogin: clean up error messagesKarel Zak2013-05-141-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: don't run if not found passww entry [coverity scan]Karel Zak2013-03-271-0/+1
| | | | | | | | sulogin(8) should not run if there is no /etc/{passwd,shadow} entry and --force command line option is no specified otherwise NULL pointer dereference is possible. Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: couple of obvious fixes for non-linux systemsSamuel Thibault2013-03-261-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify exec error messagesSami Kerola2013-02-061-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/ttyutils: add default chardataWerner Fink2013-01-081-4/+0Star
| | | | | | | | | | | | this one moves the init_chardata to include/ttyutils.h as well as to lib/include/ttyutils.c. Also the macros CTL/CTRL are fixed in agetty.c and sulogin.c to use the XOR variant CTL. [kzak@redhat.com: use macro rather than global variable for default chardata] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: don't use {de,con}structor attributesKarel Zak2012-12-231-0/+4
| | | | | | | We're not Russian roulette players, so don't use such ugly things at all.. Reported-by: Dave Reisner <d@falconindy.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: remove consoles.c from libcommonKarel Zak2012-12-231-1/+1
| | | | | | | | - move struct chardata to include/ttyutils.h - move console.{h,c} to login-utils/sulogin-* (it's sulogin specific) - fix sulogin and agetty includes Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: map NL to CR-NL on output in initial termios settingsKarel Zak2012-12-191-1/+3
| | | | | | (See also 9c62a2326e6e39a5e759830b0b9d91696166fb45 agetty patch). Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: minor coding style changesKarel Zak2012-12-181-13/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: add multi console feature from SysVinit suloginWerner Fink2012-12-181-149/+516
| | | | | | | | | | | | | Now after adding Conflicts=rescue.service to getty@.service and serial-getty@.service and Conflicts=getty.target to rescue.target all works with `systemctl rescue'. Even adding init=/sbin/sulogin to the kernels command line by using the `e' key in grub2 boot menu works flawless. This version is without the emergency code as I've this moved to lib/console.c where it belongs to. Signed-off-by: Werner Fink <werner@suse.de>
* sulogin: use alarm function to indicate if a timeout occursWerner Fink2012-12-181-3/+17
| | | | | | A small change to use the alarm handler to indicate if a timeout occurs. Signed-off-by: Werner Fink <werner@suse.de>
* sulogin: cleanup file descriptors usageKarel Zak2012-09-071-13/+16
| | | | | | | - use _FILENO macros rather than magic numbers - check for dup() result Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: fix shadow declarationSami Kerola2012-07-261-10/+10
| | | | | | | login-utils/sulogin.c:337:8: warning: declaration of 'sushell' shadows a global declaration [-Wshadow] login-utils/sulogin.c:332:13: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify file open error messagesSami Kerola2012-07-161-4/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sulogin: cleanup strtoxx_or_err()Karel Zak2012-05-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sulogin: share vc initialization with agettyKarel Zak2012-03-121-0/+33
| | | | | | | | | | The virtual console initialization has been removed by Dave's commit 5ec4a799c2a8d25c4c8260772363392f805b0a54. We already use this tty initialization for agetty, so reuse the same code. Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: add note about port to util-linux to the man pageKarel Zak2012-03-121-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: fix selinux buildKarel Zak2012-03-121-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: parse timeout more carefullyKarel Zak2012-03-121-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: initialize nls stuffKarel Zak2012-03-121-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: check chdir and getcwd return values [-Wunused-result]Karel Zak2012-03-121-5/+13
| | | | | | | | | | sulogin.c: In function ‘sushell’: sulogin.c:338:7: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result] sulogin.c:359:8: warning: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: add long optionsKarel Zak2012-03-121-13/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: use EXIT_*Karel Zak2012-03-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: use err.h stuffKarel Zak2012-03-121-13/+9Star
| | | | | | and print "Login incorrect" to stderr like login(1). Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: replace perror() with warx()Karel Zak2012-03-121-9/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: cleanup commentsKarel Zak2012-03-121-51/+44Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: add i18n stringsDave Reisner2012-03-121-12/+14
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: use a more standard usage outputDave Reisner2012-03-121-4/+20
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: header/include cleanupDave Reisner2012-03-121-2/+1Star
| | | | | | | | - use our own crypt.h compile time check - remove ttydefaults.h include -- get this via termios.h, the same as agetty Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: use pathnames.h for file locationsDave Reisner2012-03-121-14/+12Star
| | | | | | | | This covers /etc/shadow and /etc/passwd. We don't have a define for /bin/sh -- just replace the macro with the hardcoded string as done elsewhere. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: get rid of calls to /bin/sashDave Reisner2012-03-121-7/+0Star
| | | | | | | This probably doesn't exist on most systems, and if the root's shell and /bin/sh fail to execute, it seems unlikely that /bin/sash will save us. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: use size_t for iterator to avoid castDave Reisner2012-03-121-2/+2
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: remove USE_ONELINE and SANE_TIO definesDave Reisner2012-03-121-84/+1Star
| | | | | | | This was only ever compiled in for a single distro, with no clear indication of why. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: remove CHECK_{DES,MD5} definesDave Reisner2012-03-121-7/+0Star
| | | | | | Remove these always-true defines along with their #ifdef statements. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: replace older signal() with sigaction()Dave Reisner2012-03-121-20/+35
| | | | | | | | | This provides a more reliable means of saving and restoring signal handlers and avoids ugly (invalid) function pointer assignments. This also removes the #ifdef blocking usage of a GCC attribute, which is widely used in the rest of the codebase. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: whitespace fixesDave Reisner2012-03-121-53/+71
| | | | | | Use a code style more inline with the rest of the project. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* sulogin: initial import from sysvinitDave Reisner2012-03-121-0/+605
Import the source and manpage of sulogin. Only the selinux #ifdef is changed to match our autotool setup. Signed-off-by: Dave Reisner <dreisner@archlinux.org>