Commit Graph

599 Commits

Author SHA1 Message Date
Karel Zak e781a04fec last: add link to util-linux to last.1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 10:26:28 +02:00
Karel Zak 77079432d7 last: coding style clean up
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 10:22:50 +02:00
Karel Zak a9f789e518 last: use xalloc.h, err.h, nls.h and EXIT_ macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 14:10:42 +02:00
Karel Zak 4c7dfea7a4 last: consolidate btmp/wtmp file paths
.. so share the paths with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 13:42:25 +02:00
Karel Zak 293e0c90e4 last: add long options, improve usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 13:39:11 +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
Karel Zak 4d1d1233f4 last: clean up the begin of the file
.. and improve last(1) stuff in configure script.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:26:03 +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 8bd6450375 sulogin: fix compiler warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-09 14:32:05 +02:00
Sami Kerola 21c4058d92 sulogin: fix memory leak [clang-analyzer]
And make code a little bit more robust.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:13 +02:00
Sami Kerola 467ca0b214 chfn: assigned value is never read [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:11 +02:00
Sami Kerola ad20f0d883 utmpdump: assigned values are never read [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:07 +02:00
Benno Schulenberg 97b820bffd textual: improve clarity of some error messages
Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 12:29:44 +02:00
Ondrej Oprala 8960f3ae5f su: fix exit status if terminated by signal
[kzak@redhat.com: - add comment]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-07 12:00:01 +02:00
Benno Schulenberg 80591bf61e docs: improve grammar and consistency of comments in login.c
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 11:31:43 +02:00
Benno Schulenberg 1b435f38ef textual: tiny alphabetical and grammatical tweak
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 11:31:40 +02:00
Benno Schulenberg bb3e58088a textual: standardize the spelling of "superuser"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 11:31:37 +02:00
Benno Schulenberg 63578526a1 textual: standardize synopsis for login, and improve an error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 11:31:33 +02:00
Karel Zak 9ba27b269e runuser: update man page, add note about -l vs. -p
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-07 11:26:46 +02:00
Karel Zak c5bb244ea3 login: use TCSANOW to remove HUPCL
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>
2013-06-05 14:43:21 +02:00
Karel Zak 3e5c0a2db2 su: ignore --preserve-environment, it's mutually exclusive to --login
Addresses: http://bugs.gnu.org/10317
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-29 11:32:58 +02:00
Karel Zak 4b3624ca21 sulogin: clean up error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-14 23:29:09 +02:00
Karel Zak 507341f832 lib/tty: don't hardcode terminal fd in get_terminal_name()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-13 15:40:57 +02:00
Benno Schulenberg 0bd341508e su: consistent angular brackets and lowercase in help text of 'su'
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-05-06 17:42:08 +02:00
Sami Kerola 930954d87a utmpdump: add option to write to a file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:25:58 +02:00
Karel Zak a303e047bb sulogin: fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-17 17:23:26 +02:00
Karel Zak 49932ad8db su: remove '+' from getopt_long()
# /bin/su - -c 'echo test'
 su: user -c does not exist

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=950495
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-10 14:24:54 +02:00
Sami Kerola cc8e993401 vipw: add usage() function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:56:14 +02:00
Sami Kerola 5fb01f4331 newgrp: use xstrdup to check allocation succeeded
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:55:50 +02:00
Karel Zak ad85c7bad9 sulogin: don't run if not found passww entry [coverity scan]
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>
2013-03-27 14:50:52 +01:00
Karel Zak 82455ad52a su: make code more robust [coverity scan]
... and more readable for static analyzers

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:36:06 +01:00
Karel Zak 7488d4c068 login: check returns [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:13:00 +01:00
Samuel Thibault e4544ec1e4 sulogin: couple of obvious fixes for non-linux systems
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-26 10:54:10 +01:00
Karel Zak 5ad0923904 remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20 14:40:19 +01:00
Benno Schulenberg 9c91fc03ae docs: make the section AVAILABILITY always come last in man pages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-03-20 14:09:24 +01:00
Sami Kerola 747168d444 login: remove file descriptor leak [cppcheck]
[login-utils/login.c:510]: (error) Resource leak: fd

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-03-04 12:28:34 +01:00
William Pitcock 51924a4ef0 add missing rpmatch.h everywhere it needs to be
Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-20 13:04:02 +01: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 8c24b6aa2c chfn: Add libuser support
Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
2013-02-13 09:39:12 +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
Sami Kerola 07ff972eb6 translation: unify exec error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:17 +01:00
Benno Schulenberg 123ddced43 textual: fix two misencodings in comments
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:05 +01:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Karel Zak 19a1ca6c0d newgrp: more robust crypt() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-01 18:00:52 +01:00
Benno Schulenberg 0429455ab6 textual: gettextize an overlooked string
* login-utils/islocal.c: Gettexttize the usage message.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-30 16:06:23 +01:00
Sami Kerola 09f5902e1e su-common: make usage() translator friendly
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25 16:40:04 +01:00
Werner Fink f5664477cb include/ttyutils: add default chardata
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>
2013-01-08 15:42:12 +01:00
Karel Zak 91984e938e agetty: replace perms 660 to 620
... the default is root:tty 620

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-02 08:27:32 +01:00