Commit Graph

60 Commits

Author SHA1 Message Date
Karel Zak f686b9980a lslogins: remove duplicate [make checkincludes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-29 12:57:22 +02:00
Karel Zak a6bf40ee77 lslogins: merge read_utmp() code
The code is used only in lslogins, so it does not make sense to
maintain it in libcommon.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-16 11:26:14 +02:00
Sami Kerola 7ee26cbf02 maint: fix shadow declaration
This change fixes all shadow declarations.  The worth while to mention
fix is with libfdisk sun geometry.  It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.

libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]

That could have caused earlier some unexpected results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:08:21 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
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>
2015-01-06 11:27:38 +01:00
Sami Kerola 4ecc6dbb53 lslogins: use hardcoded paths from pathnames.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:03 +00:00
Sami Kerola 77006d95db lslogins: add space to systemd journal header and message
This commit changes journal messages in individual user printout the
following way.

Dec 13 16:02:05 systemd[324]:Time has been changed	(old)
Dec 13 16:02:05 systemd[324]: Time has been changed	(new)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Sami Kerola cdf3896a05 lslogins: reject unknown time format arguments
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Sami Kerola dfd4359bb0 lslogins: fix short options
Usage is promising -e is an option alias of --export, so make it work.
And get rid of -x that was accepted, but not in use.

Long only enum member OPT_VER was probably a development time idea, that
never got to be used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Sami Kerola 1025d21efe lslogins: tell why command failed
Printing usage() without hint what is wrong does not help an user.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Sami Kerola f838efeb67 lslogins: make journald last logs time stamps to honor --time-format
This makes by default the last logs to have year in output when necessary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Sami Kerola aa45b344d3 lslogins: allow changing password changed and expiration time formats
The password change and expiry has are marked with resolution of a day,
so add a new short iso-8601 format.  With this system admins can easily
find users has not updated their password lately

$ lslogins --time-format=iso --user --output=pwd-change,user | sort -n

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-19 09:11:02 +00:00
Karel Zak 0d75c73d4f lslogins: fix -l -g logic
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-12 15:17:19 +01:00
Sami Kerola 228bb39a5e lslogins: align usage() and manual with struct option longopts
Short option -G goes together with long option --supp-groups, while
neither of -m or --groups-info has worked in a release so remove them
from usage() and manual.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-09 09:19:41 +01:00
Sami Kerola 123f0f5bf0 lslogins: fix assertion failure for none existing logins
This cange makes the following to retun none-zero value instead of a core
dump.

$ lslogins qwertyuiopasdfghjklzxcvbnm1234567
lslogins: libsmartcols/src/line.c:362: scols_line_get_cell: Assertion `ln' failed.
Aborted (core dumped)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-12-09 09:19:39 +01:00
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Karel Zak 30ea015b87 lslogins: cleanup after error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-26 11:23:32 +02:00
Benno Schulenberg 1d23119072 textual: remove some inconsistent periods from error messages
While doing so, also improve translatability and some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-11 14:51:54 +02:00
Benno Schulenberg 09af3db48e textual: fix some typos and inconsistencies in various messages
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-23 08:56:00 +02:00
Karel Zak ccef45168b Merge branch 'master' of https://github.com/yurchor/util-linux
* 'master' of https://github.com/yurchor/util-linux:
  Fix typos in user visible messages
2014-07-22 12:01:50 +02:00
Karel Zak 87a144a502 lslogins: more robust usage of columns[]
For more details see commit dcc8dbdc8137cb3da5100158639b565565b89875.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:51:01 +02:00
Karel Zak bdba3fd9b5 lslogins: make --notruncate more robust
- keep coldescs[] read-only
 - don't expect that only COL_GECOS uses truncate flag

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-16 11:25:03 +02:00
Karel Zak 4b6ae07123 lslogins: add --noheadings
That's fatal mistake that this option which is required for script
is missing.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-16 11:19:20 +02:00
Karel Zak 37019cbc27 lslogins: use bit-array, cleanup SELinux code
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-16 11:09:42 +02:00
Yuri Chornoivan b5af3ee835 Fix typos in user visible messages 2014-07-03 09:33:15 +03:00
Benno Schulenberg b8ec0ab712 lslogins: improve the columns information
Some fixes for typos, whitespace and wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-06-30 10:21:43 +02:00
Karel Zak 710ed55dcd libsmartcols: add debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-06 13:47:06 +02:00
Karel Zak 27e6e446b9 lslogins: fix pretty-print columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 15:08:26 +02:00
Karel Zak b3f4f05632 lslogins: cleanup some command line options
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 15:05:10 +02:00
Karel Zak 8b13a4d89d lslogins: cleanup default outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 14:48:45 +02:00
Karel Zak ed374569ae lslogins: cleanup -a output
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 14:17:41 +02:00
Karel Zak d4aa0ff138 lslogins: improve COL_PWD_WARN and COL_NPROCS desc
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 13:37:58 +02:00
Karel Zak 74fddd8623 lslogins: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 13:32:03 +02:00
Karel Zak f7aea533f4 lslogins: fix nologins check
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 13:24:35 +02:00
Karel Zak ea24eacc6b lslogins: cleanup time formats
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 13:21:57 +02:00
Karel Zak f47c6d3a59 lslogins: clean up password hash check
* rename to PWD-* column names
 * add PWD-DENY for accounts where is no possible to login by password
 * PWD-LOCK (was LOCKED) checks for valid but locked pawwords
 * LOGIN renamed to USER

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 12:48:40 +02:00
Karel Zak d8b2ddb7bb lslogins: remove --sort-by-name
If we really need a sort functionality hardcoded into lslogins(1) then we need
a generic sort options (like for lsblk,--sort <column>).

Note that it seems that "lslogins | sort --key <col>" is good enough for now as
lslogins(1) does not convert any data to human readable non-precise format (like
for example lsblk SIZE column etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 11:46:56 +02:00
Karel Zak 1624245ffe lslogins: improve nologins and shadow usage
* fix coding style
 * don't require shadow entries
 * check for /var/run/nologin

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 11:30:26 +02: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 d3a93df80d lslogins: count per-user processes
[kzak@redhat.com: - rename column, align to right]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-27 17:01:05 +02:00
Karel Zak 56c8f8af4c lslogins: add FAILED-LOGIN to pretty output
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 14:14:02 +02:00
Karel Zak 512abd5694 lslogins: sync man page and usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 14:04:54 +02:00
Karel Zak 10c74524e5 lslogins: improve pretty output
* use Yes/No
 * print all available information (columns)
 * cleanup code

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 12:35:46 +02:00
Karel Zak 3e5cba73f1 lslogins: NLS for all messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 11:41:18 +02:00
Karel Zak 8b5e227978 lslogins: conding style changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 11:31:00 +02:00
Karel Zak 68657ea2e7 lslogins: improve supplementary groups code, add SUPP-GIDS
* don't build list, but directly create a string
 * don't mix IDs and group names on output
 * add SUPP-GIDS to print only IDs

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-16 11:14:32 +02:00
Karel Zak 07a4046f95 lslogins: align to right 0|1 columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-15 14:10:50 +02:00
Karel Zak a94baf36dc lslogins: cleanup status[] usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-15 14:01:51 +02:00
Karel Zak 5424d2a225 lslogins: cleanup fill_table()
* check xasprintf() return code is unnecessary
 * just check all scols_line_set_data() return codes on one place

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-15 13:56:00 +02:00
Ondrej Oprala 3a016a536b lslogins: mention --time-format in usage
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-05-15 13:56:00 +02:00
Ondrej Oprala 32badc3466 lslogins: fix option exclusivity
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-05-15 13:56:00 +02:00