Now the build will fail on many non-Linux systems because
utmpx.h is available everywhere but we still use non-POSIX
features. We'll fix this next commit.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This include was removed in a365953a but we will need it again
when we move from utmp.h to utmpx.h.
On Linux (glibc, musl) the struct lastlog is defined in utmp.h
and lastlog.h just includes utmp.h.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Conflicts:
login-utils/login.c
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
_HAVE_UT_TV is glibc only. Moreover we want to move to utmpx where
timeval is standard.
Now utmp/subsecond (1173d0a6) should work on all supported systems.
CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Try all standard terminal input/output file descriptors when finding tty
name in get_germinal_name(). This should make all invocations of the
function as robust as they can get.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
The file is no portable (#ifdef HAVE_SYS_SYSMACROS_H is necessary),
but needed on many places. It seems better to keep it in c.h.
Signed-off-by: Karel Zak <kzak@redhat.com>
sysconf(_SC_GETPW_R_SIZE_MAX) returns initial suggested size for pwd
buffer (see getpwnam_r man page or POSIX). This is not large enough in
some cases.
Yes, this sysconf option is misnamed (should be _SC_GETPW_R_SIZE_MIN).
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
Wrap around the variable declaration for `tv' with ifdef so the compilers
don't warn about unused variables if we're compiling without UT_TV. This
happens with the musl libc, since it doesn't define _HAVE_UT_TV, even
though it _does_ have the ut_tv field in the utmp struct.
Signed-off-by: Will Johansson <will.johansson@gmail.com>
OpenPAM is compatible with util-linux, with a few changes, namely
using OpenPAM's conversation function, openpam_ttyconv.
We check for Linux-PAM by querying for security/pam_misc.h, and OpenPAM
by querying for security/openpam.h.
Signed-off-by: Will Johansson <will.johansson@gmail.com>
the lastlog file is huge and on systems with large UIDs, it's so huge that
it generates SIGXFSZ when the FSIZE limit is too small.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1165702
Signed-off-by: Karel Zak <kzak@redhat.com>
Fedora 19, kernel 3.9, systemd 204, telnetd with socket activation.
login(1) code:
ttt.c_cflag &= ~HUPCL;
tcsetattr(0, TCSAFLUSH, &ttt);
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */
vhangup();
signal(SIGHUP, SIG_DFL);
strace :
ioctl(0, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF, {B9600 opost isig icanon echo ...}) = 0
close(0) = 0
close(1) = 0
close(2) = 0
--- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} ---
+++ killed by SIGTERM +++
It seems we get SIGHUP (and SIGTERM from systemd) before vhangup().
The problem occur sometimes.
I guess it's because TCSAFLUSH is not applied immediately, so it would
be probably better to use TCSANOW to make the code more robust.
References: https://bugzilla.redhat.com/show_bug.cgi?id=962145
Signed-off-by: Karel Zak <kzak@redhat.com>
It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.
Signed-off-by: Karel Zak <kzak@redhat.com>
Assuming someone is using a TTYGROUP name beginnign by a digit the
login was misbehaving with 'contains invalid numerical value: %s'
message(s) in syslog. Please notice that group names that consist
only digits as characters are valid (but likely to cause confusion,
and chaos).
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Where ever getlogindefs_num() is called return value is always
expected to be unsigned, such as sleep() input, gid_t or mode_t.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
getdtablesize() is the number of descriptors and since decriptors start
at 0, its value isnt the largest descriptors possible. One should use
getdtablesize() - 1 instead.
Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:
$ git ls-files | grep -v ^po/ | misspellings -f -
* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Add this value from the passwd struct to the environment, as it is
expected by shells, and generally useful to users.
This also clarifies a poorly worded sentence in the vicinity of the
manpage change.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
standard syntax for FOO=data:
ENV_FOO data
additional syntax:
ENV_FOO FOO=data
Reported-by: Colin Guthrie colin@mageia.org
Signed-off-by: Karel Zak <kzak@redhat.com>