Commit Graph

42 Commits

Author SHA1 Message Date
Sami Kerola 204aa7714d runuser: fix linking
Add conditional -lutil to runuser when needed to avoid linking error.

login-utils/su-common.o: In function `pty_create':
login-utils/su-common.c:269: undefined reference to `openpty'
login-utils/su-common.c:273: undefined reference to `openpty'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-09-18 11:49:11 +02:00
Karel Zak eb7d0ad0fe su: add PTY support
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-18 11:49:11 +02:00
Karel Zak a65041b5ae build-sys: make chown usage more robust
* add --disable-makeinstall-chown to travis non-root mode

* use "if MAKEINSTALL_DO_SETUID" for chown root:root

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 11:12:04 +02:00
Karel Zak 8c1979948c build-sys: chown before chmod for SUIDs
Make sure SUIDs are really owned by root.

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-20 13:12:43 +02:00
Sami Kerola e41ae45093
chfn, chsh: use readline(3) to receive user input
The readline offers editing capabilities while the user is entering the
line, unlike fgets(3) and getline(3) that were used earlier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-05-02 23:22:05 +01:00
Karel Zak 23f7509326 Revert "su,runuser: add libseccomp based workaround for TIOCSTI ioctl"
This reverts commit 8e49250168.

Stupid hack...
2016-10-03 16:56:56 +02:00
Karel Zak 8e49250168 su,runuser: add libseccomp based workaround for TIOCSTI ioctl
This patch add libseccomp based syscalls filter to disable TIOCSTI
ioctl in su/runuser children.

IMHO it is not elegant solution due to dependence on libseccomp
(--without-seccomp if hate it)... but there is nothing better for now.

Addresses: CVE-2016-2779
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-29 16:32:33 +02:00
Sami Kerola 1173d0a6bf
utmpdump: use iso-8601 timestamp format with subsecond accuracy
Newer 'struct utmp' is using 'struct timeval' to represent login and logout
times, so include the maximum accuracy to textual utmp format.  Notice that
this change does not remove support of converting earlier textual formats
back to binary.  But conversions from binary to former format will no longer
be available.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-06-26 21:58:18 +01:00
Ruediger Meier b0b54cc582 build-sys: always add AM_CFLAGS
We were missing our nice compliler warnings for many programs
and libs. See next commits how many trivial and non-trival
warnings have to be fixed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:17:29 +01:00
Ruediger Meier b201f1d86c build-sys: always use global LDADD
This was a major showstopper when building on a system where
LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test
programs which wouldn't need LDADD ... never mind.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:16:58 +01:00
Sami Kerola 0688911ad4 last-deprecated: remove from source tree
The last/lastb(1) from sysvinit has been around for about two years,
and the better implementation is already part of releases 2.24 to 2.26.
It should be safe to remove the unused last code from the source tree.

Reference: ce60272039
Signed-off-by: Sami Kerola <sami.kerola@lastminute.com>
2015-06-29 12:05:39 +02:00
Karel Zak 254743e4a6 build-sys: cleanup realtime lib usage
* check for timer_create()
* define dependence on timer_create() for flock
* rename CLOCKGETTIME_LIBS to REALTIME_LIBS

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-03-06 14:20:19 +01:00
Sami Kerola 144ae70ef3 chfn, chsh: share illegal_passwd_chars() function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:50 +00:00
Sami Kerola e88f005949 chfn: make command to obey login.defs CHFN_RESTRICT instructions
Reference: http://man7.org/linux/man-pages/man5/login.defs.5.html
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=138519
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:04 +00:00
Will Johansson fe2c9909cd login-utils: Enable building util-linux against OpenPAM
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>
2014-12-15 10:16:03 +01:00
Karel Zak cd2876d252 build-sys: move all around clock_gettime() to monotonic.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-19 11:54:47 +01:00
Karel Zak 8fc4a88630 build-sys: properly check for -lrt
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-27 11:05:14 +01:00
Karel Zak f37b357b47 lslogins: print systemd journal logs
Co-Author: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-27 17:34:15 +02:00
Ondrej Oprala 29cc2a5568 lslogins: add functionality
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-05-15 13:55:59 +02:00
Ondrej Oprala 914e20a00a lslogins: move to login-utils
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-05-15 13:55:59 +02:00
Karel Zak 08ca3e26a8 lib/timeutils: remove get_boot_time from libcommon
clock_gettime() needs -lrt, so let's keep this stuff
outside libcommon.la

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 13:16:05 +02:00
Karel Zak 88407b9321 nologin: add new command
Currently it's maintained as distro specific (or people use impolite
/bin/false way).

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-30 13:36:26 +02:00
Karel Zak bccc956df3 build-sys: fix lastb symlink
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-27 14:02:58 +02:00
Sami Kerola 3a4ae395a4 last: parse easy to use time formats
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:08 +01:00
Sami Kerola 1bd68aab3b last: check expected numeric user input is number
This commit also changes the line count to use unsigned integers, as
negative numbers in this context does not make sense.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-23 10:58:55 +02:00
Karel Zak ec01e9d048 build-sys: fix last stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:59:52 +02:00
Ondrej Oprala ce60272039 last: merge sysvinit last/lastb
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:07:52 +02:00
Karel Zak d86918b6eb chsh-chfn: fix bugs, improve compilation
* rename --disable-require-password to --disable-chsh-chfn-password

 * is_local() is really unnecessary when linked with libuser

 * fix set_value_libuser() returns codes

 * fix chfn.c, there is no 'pw', but oldf.pw

 * don't link with PAM when--disable-chsh-chfn-password

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-13 13:44:34 +01:00
Cody Maloney 6adb1ef279 chsh: Add libuser support
This is based directly on lchsh which is a part of libuser. libuser.{c,h}
exist because exactly the same code is needed for both chsh and chfn.

[kzak@redhat.com: cleanup err() usage]

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-13 09:37:15 +01:00
Cody Maloney d91ad6ab3c chsh-chfn: Move pam auth to its own function, factoring out common code
This makes it easier to add support for libuser, which needs the same PAM
authentication. Also removes duplicate code between chsh and chfn.

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
2013-02-13 09:28:33 +01:00
Cody Maloney 7e4714f22b build-sys: Add flag for enabling/disabling libuser support.
Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
2013-02-13 09:17:34 +01:00
Karel Zak a73f59fa03 sulogin: remove consoles.c from libcommon
- 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>
2012-12-23 22:14:21 +01:00
Karel Zak bbc5a5eac4 su: use get_terminal_name() for compatibility with login(1)
login(1) uses tty name (!= path) in the syslog messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-22 14:45:49 +01:00
Karel Zak 5b68dea9d5 build-sys: move runuser(1) to sbin dir
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-01 12:01:52 +01:00
Dave Reisner 6edbca18bb build-sys: install su.1 if building su
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-05 10:45:46 +02:00
Karel Zak 7ec6adb1cc runuser: new command (derived from su(1))
This command is based on su(1), the differences:

 - based on Fedora runuser su(1) patch
 - not installed with suid rights
 - allowed for root users only
 - don't ask for password
 - uses PAM session, for example:

$ cat /etc/pam.d/runuser
auth		sufficient	pam_rootok.so
session		optional	pam_keyinit.so revoke
session		required	pam_limits.so
session		required	pam_unix.so

$ cat /etc/pam.d/runuser-l
auth		include		runuser
session		optional	pam_keyinit.so force revoke
session		include		runuser

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-04 17:00:31 +02:00
Karel Zak cf1a99dacc su: move generic su code to su-common.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-04 17:00:30 +02:00
Karel Zak 922e6775e0 build-sys: move tests to check_PROGRAMS
Thanks to Mike Frysinger.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-30 17:59:16 +02:00
Karel Zak dcdb349be7 build-sys: always use default $(LDADD)
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-09 16:23:51 +02:00
Karel Zak 78d5ceacb1 utmpdump: new command, merge from sysvinit
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:34:46 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak ffeb280566 build-sys: convert login-utils/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:46:17 +02:00