|
|
5d0c07 |
diff -up util-linux-2.23.2/include/pathnames.h.kzak util-linux-2.23.2/include/pathnames.h
|
|
|
5d0c07 |
--- util-linux-2.23.2/include/pathnames.h.kzak 2016-03-16 17:17:02.980243390 +0100
|
|
|
5d0c07 |
+++ util-linux-2.23.2/include/pathnames.h 2016-03-16 17:17:37.129015363 +0100
|
|
|
5d0c07 |
@@ -36,6 +36,7 @@
|
|
|
5d0c07 |
#endif
|
|
|
5d0c07 |
#define _PATH_MOTDFILE "/etc/motd"
|
|
|
5d0c07 |
#define _PATH_NOLOGIN "/etc/nologin"
|
|
|
5d0c07 |
+#define _PATH_VAR_NOLOGIN "/var/run/nologin"
|
|
|
5d0c07 |
|
|
|
5d0c07 |
#define _PATH_LOGIN "/bin/login"
|
|
|
5d0c07 |
#define _PATH_INITTAB "/etc/inittab"
|
|
|
5d0c07 |
diff -up util-linux-2.23.2/login-utils/lslogins.1.kzak util-linux-2.23.2/login-utils/lslogins.1
|
|
|
5d0c07 |
--- util-linux-2.23.2/login-utils/lslogins.1.kzak 2016-03-16 17:17:02.970243457 +0100
|
|
|
5d0c07 |
+++ util-linux-2.23.2/login-utils/lslogins.1 2016-03-16 17:17:37.129015363 +0100
|
|
|
5d0c07 |
@@ -5,7 +5,10 @@
|
|
|
5d0c07 |
lslogins \- display information about known users in the system
|
|
|
5d0c07 |
.SH SYNOPSIS
|
|
|
5d0c07 |
.B lslogins
|
|
|
5d0c07 |
-[\fIoptions\fR] [\fB-s\fR|\fB-u\fR[=\fIUID\fR]] [\fB-g \fIgroups\fR] [\fB-l \fIlogins\fR]
|
|
|
5d0c07 |
+[options]
|
|
|
5d0c07 |
+.RB [ \-s | \-u [ =\fIUID ]]
|
|
|
5d0c07 |
+.RB [ \-g " \fIgroups\fR]"
|
|
|
5d0c07 |
+.RB [ \-l " \fIlogins\fR]"
|
|
|
5d0c07 |
.SH DESCRIPTION
|
|
|
5d0c07 |
.PP
|
|
|
5d0c07 |
Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /etc/passwd
|
|
|
5d0c07 |
@@ -17,7 +20,7 @@ Mandatory arguments to long options are
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
\fB\-a\fR, \fB\-\-acc\-expiration\fR
|
|
|
5d0c07 |
Display data about the date of last password change and the account expiration
|
|
|
5d0c07 |
-date (see \fBshadow\fR(5) for more info). (Requires root priviliges.)
|
|
|
5d0c07 |
+date (see \fBshadow\fR(5) for more info). (Requires root privileges.)
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
\fB\-\-btmp\-file \fIpath\fP
|
|
|
5d0c07 |
Alternate path for btmp.
|
|
|
5d0c07 |
@@ -31,7 +34,7 @@ Output data in the format of NAME=VALUE.
|
|
|
5d0c07 |
\fB\-f\fR, \fB\-\-failed\fR
|
|
|
5d0c07 |
Display data about the users' last failed login attempts.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
-\fB\-G\fR, \fB\-\-groups\-info\fR
|
|
|
5d0c07 |
+\fB\-G\fR, \fB\-\-supp\-groups\fR
|
|
|
5d0c07 |
Show information about groups.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
\fB\-g\fR, \fB\-\-groups\fR=\fIgroups\fR
|
|
|
5d0c07 |
@@ -48,9 +51,6 @@ Display data containing information abou
|
|
|
5d0c07 |
Only show data of users with a login specified in \fIlogins\fR (user names or user
|
|
|
5d0c07 |
IDS). More than one login may be specified; the list has to be comma-separated.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
-\fB\-m\fR, \fB\-\-supp\-groups\fR
|
|
|
5d0c07 |
-Show supplementary groups.
|
|
|
5d0c07 |
-.TP
|
|
|
5d0c07 |
\fB\-n\fR, \fB\-\-newline\fR
|
|
|
5d0c07 |
Display each piece of information on a separate line.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
@@ -71,21 +71,21 @@ Display information related to login by
|
|
|
5d0c07 |
\fB\-r\fR, \fB\-\-raw\fR
|
|
|
5d0c07 |
Raw output (no columnation).
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
-\fB\-s\fR, \fB\-\-system\-accs\fR[=\fIthreshold\fR]
|
|
|
5d0c07 |
+\fB\-s\fR, \fB\-\-system\-accs\fR
|
|
|
5d0c07 |
Show system accounts. These are by default all accounts with a UID below 1000
|
|
|
5d0c07 |
-(non-inclusive), with the exception of either nobody or nfsnobody (UID 65534). The UID
|
|
|
5d0c07 |
-threshold can also be specified explicitly (necessary for some distributions that
|
|
|
5d0c07 |
-allocate UIDs starting from 100, 500 - or an entirely different value - rather than 1000).
|
|
|
5d0c07 |
+(non-inclusive), with the exception of either nobody or nfsnobody (UID 65534).
|
|
|
5d0c07 |
+This hardcoded default maybe overwritten by parameters SYS_UID_MIN and SYS_UID_MAX in
|
|
|
5d0c07 |
+the file /etc/login.defs.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
-\fB\-\-time-format\fR \fItype\fP
|
|
|
5d0c07 |
+\fB\-\-time\-format\fR \fItype\fP
|
|
|
5d0c07 |
Display dates in short, full or iso format. The default is short, this time
|
|
|
5d0c07 |
format is designed to be space efficient and human readable.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
-\fB\-u\fR, \fB\-\-user\-accs\fR[=\fIthreshold\fR]
|
|
|
5d0c07 |
+\fB\-u\fR, \fB\-\-user\-accs\fR
|
|
|
5d0c07 |
Show user accounts. These are by default all accounts with UID above 1000
|
|
|
5d0c07 |
-(inclusive), with the exception of either nobody or nfsnobody (UID 65534). The UID
|
|
|
5d0c07 |
-threshold can also be specified explicitly (necessary for some distributions that
|
|
|
5d0c07 |
-allocate UIDs starting from 100, 500 - or an entirely different value - rather than 1000).
|
|
|
5d0c07 |
+(inclusive), with the exception of either nobody or nfsnobody (UID 65534).
|
|
|
5d0c07 |
+This hardcoded default maybe overwritten by parameters UID_MIN and UID_MAX in
|
|
|
5d0c07 |
+the file /etc/login.defs.
|
|
|
5d0c07 |
.TP
|
|
|
5d0c07 |
\fB\-V\fR, \fB\-\-version\fR
|
|
|
5d0c07 |
Display version information and exit.
|
|
|
5d0c07 |
diff -up util-linux-2.23.2/login-utils/lslogins.c.kzak util-linux-2.23.2/login-utils/lslogins.c
|
|
|
5d0c07 |
--- util-linux-2.23.2/login-utils/lslogins.c.kzak 2016-03-16 17:17:02.970243457 +0100
|
|
|
5d0c07 |
+++ util-linux-2.23.2/login-utils/lslogins.c 2016-03-16 17:23:47.191484521 +0100
|
|
|
5d0c07 |
@@ -396,7 +396,7 @@ again:
|
|
|
5d0c07 |
x = snprintf(p, len, "%s,", grp->gr_name);
|
|
|
5d0c07 |
}
|
|
|
5d0c07 |
|
|
|
5d0c07 |
- if (x < 0 || (size_t) x + 1 > len) {
|
|
|
5d0c07 |
+ if (x < 0 || (size_t) x >= len) {
|
|
|
5d0c07 |
size_t cur = p - res;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
maxlen *= 2;
|
|
|
5d0c07 |
@@ -496,21 +496,24 @@ static int parse_btmp(struct lslogins_co
|
|
|
5d0c07 |
static int get_sgroups(gid_t **list, size_t *len, struct passwd *pwd)
|
|
|
5d0c07 |
{
|
|
|
5d0c07 |
size_t n = 0;
|
|
|
5d0c07 |
+ int ngroups = 0;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
*len = 0;
|
|
|
5d0c07 |
*list = NULL;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
/* first let's get a supp. group count */
|
|
|
5d0c07 |
- getgrouplist(pwd->pw_name, pwd->pw_gid, *list, (int *) len);
|
|
|
5d0c07 |
- if (!*len)
|
|
|
5d0c07 |
+ getgrouplist(pwd->pw_name, pwd->pw_gid, *list, &ngroups);
|
|
|
5d0c07 |
+ if (!ngroups)
|
|
|
5d0c07 |
return -1;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
- *list = xcalloc(1, *len * sizeof(gid_t));
|
|
|
5d0c07 |
+ *list = xcalloc(1, ngroups * sizeof(gid_t));
|
|
|
5d0c07 |
|
|
|
5d0c07 |
/* now for the actual list of GIDs */
|
|
|
5d0c07 |
- if (-1 == getgrouplist(pwd->pw_name, pwd->pw_gid, *list, (int *) len))
|
|
|
5d0c07 |
+ if (-1 == getgrouplist(pwd->pw_name, pwd->pw_gid, *list, &ngroups))
|
|
|
5d0c07 |
return -1;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
+ *len = (size_t) ngroups;
|
|
|
5d0c07 |
+
|
|
|
5d0c07 |
/* getgroups also returns the user's primary GID - dispose of it */
|
|
|
5d0c07 |
while (n < *len) {
|
|
|
5d0c07 |
if ((*list)[n] == pwd->pw_gid)
|
|
|
5d0c07 |
@@ -852,7 +855,7 @@ static int get_user(struct lslogins_cont
|
|
|
5d0c07 |
const char *username)
|
|
|
5d0c07 |
{
|
|
|
5d0c07 |
*user = get_user_info(ctl, username);
|
|
|
5d0c07 |
- if (!*user && errno)
|
|
|
5d0c07 |
+ if (!*user)
|
|
|
5d0c07 |
if (IS_REAL_ERRNO(errno))
|
|
|
5d0c07 |
return -1;
|
|
|
5d0c07 |
return 0;
|
|
|
5d0c07 |
@@ -1193,16 +1196,18 @@ static void __attribute__((__noreturn__)
|
|
|
5d0c07 |
fputs(USAGE_HEADER, out);
|
|
|
5d0c07 |
fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
|
|
|
5d0c07 |
|
|
|
5d0c07 |
+ fputs(USAGE_SEPARATOR, out);
|
|
|
5d0c07 |
+ fputs(_("Display information about known users in the system.\n"), out);
|
|
|
5d0c07 |
+
|
|
|
5d0c07 |
fputs(USAGE_OPTIONS, out);
|
|
|
5d0c07 |
fputs(_(" -a, --acc-expiration display info about passwords expiration\n"), out);
|
|
|
5d0c07 |
fputs(_(" -c, --colon-separate display data in a format similar to /etc/passwd\n"), out);
|
|
|
5d0c07 |
fputs(_(" -e, --export display in an export-able output format\n"), out);
|
|
|
5d0c07 |
fputs(_(" -f, --failed display data about the users' last failed logins\n"), out);
|
|
|
5d0c07 |
- fputs(_(" -G, --groups-info display information about groups\n"), out);
|
|
|
5d0c07 |
+ fputs(_(" -G, --supp-groups display information about groups\n"), out);
|
|
|
5d0c07 |
fputs(_(" -g, --groups=<groups> display users belonging to a group in <groups>\n"), out);
|
|
|
5d0c07 |
fputs(_(" -L, --last show info about the users' last login sessions\n"), out);
|
|
|
5d0c07 |
fputs(_(" -l, --logins=<logins> display only users from <logins>\n"), out);
|
|
|
5d0c07 |
- fputs(_(" -m, --supp-groups display supplementary groups as well\n"), out);
|
|
|
5d0c07 |
fputs(_(" -n, --newline display each piece of information on a new line\n"), out);
|
|
|
5d0c07 |
fputs(_(" --noheadings don't print headings\n"), out);
|
|
|
5d0c07 |
fputs(_(" --notruncate don't truncate output\n"), out);
|
|
|
5d0c07 |
@@ -1226,7 +1231,7 @@ static void __attribute__((__noreturn__)
|
|
|
5d0c07 |
fprintf(out, " %14s %s\n", coldescs[i].name,
|
|
|
5d0c07 |
_(coldescs[i].help));
|
|
|
5d0c07 |
|
|
|
5d0c07 |
- fprintf(out, _("\nFor more details see lslogins(1).\n"));
|
|
|
5d0c07 |
+ fprintf(out, USAGE_MAN_TAIL("lslogins(1)"));
|
|
|
5d0c07 |
|
|
|
5d0c07 |
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
|
|
|
5d0c07 |
}
|
|
|
5d0c07 |
@@ -1241,8 +1246,7 @@ int main(int argc, char *argv[])
|
|
|
5d0c07 |
|
|
|
5d0c07 |
/* long only options. */
|
|
|
5d0c07 |
enum {
|
|
|
5d0c07 |
- OPT_VER = CHAR_MAX + 1,
|
|
|
5d0c07 |
- OPT_WTMP,
|
|
|
5d0c07 |
+ OPT_WTMP = CHAR_MAX + 1,
|
|
|
5d0c07 |
OPT_BTMP,
|
|
|
5d0c07 |
OPT_NOTRUNC,
|
|
|
5d0c07 |
OPT_NOHEAD,
|
|
|
5d0c07 |
@@ -1300,7 +1304,7 @@ int main(int argc, char *argv[])
|
|
|
5d0c07 |
add_column(columns, ncolumns++, COL_UID);
|
|
|
5d0c07 |
add_column(columns, ncolumns++, COL_USER);
|
|
|
5d0c07 |
|
|
|
5d0c07 |
- while ((c = getopt_long(argc, argv, "acfGg:hLl:no:prsuVxzZ",
|
|
|
5d0c07 |
+ while ((c = getopt_long(argc, argv, "acefGg:hLl:no:prsuVzZ",
|
|
|
5d0c07 |
longopts, NULL)) != -1) {
|
|
|
5d0c07 |
|
|
|
5d0c07 |
err_exclusive_options(c, longopts, excl, excl_st);
|
|
|
5d0c07 |
@@ -1397,6 +1401,7 @@ int main(int argc, char *argv[])
|
|
|
5d0c07 |
{
|
|
|
5d0c07 |
size_t i;
|
|
|
5d0c07 |
|
|
|
5d0c07 |
+ ctl->time_mode = TIME_INVALID;
|
|
|
5d0c07 |
for (i = 0; i < ARRAY_SIZE(timefmts); i++) {
|
|
|
5d0c07 |
if (strcmp(timefmts[i].name, optarg) == 0) {
|
|
|
5d0c07 |
ctl->time_mode = timefmts[i].val;
|
|
|
5d0c07 |
@@ -1404,7 +1409,7 @@ int main(int argc, char *argv[])
|
|
|
5d0c07 |
}
|
|
|
5d0c07 |
}
|
|
|
5d0c07 |
if (ctl->time_mode == TIME_INVALID)
|
|
|
5d0c07 |
- usage(stderr);
|
|
|
5d0c07 |
+ errx(EXIT_FAILURE, _("unknown time format: %s"), optarg);
|
|
|
5d0c07 |
}
|
|
|
5d0c07 |
break;
|
|
|
5d0c07 |
case 'V':
|
|
|
5d0c07 |
@@ -1433,7 +1438,7 @@ int main(int argc, char *argv[])
|
|
|
5d0c07 |
logins = argv[optind];
|
|
|
5d0c07 |
outmode = OUT_PRETTY;
|
|
|
5d0c07 |
} else if (argc != optind)
|
|
|
5d0c07 |
- usage(stderr);
|
|
|
5d0c07 |
+ errx(EXIT_FAILURE, _("Only one user may be specified. Use -l for multiple users."));
|
|
|
5d0c07 |
|
|
|
5d0c07 |
scols_init_debug(0);
|
|
|
5d0c07 |
|