Merge branch 'master' of git+ssh://github.com/shadow-maint/shadow

This commit is contained in:
Serge Hallyn 2019-10-04 18:28:34 -05:00
commit 332709da65
5 changed files with 37 additions and 8 deletions

View File

@ -31,6 +31,15 @@ LOG_OK_LOGINS no
#
LASTLOG_ENAB yes
#
# Limit the highest user ID number for which the lastlog entries should
# be updated.
#
# No LASTLOG_UID_MAX means that there is no user ID limit for writing
# lastlog entries.
#
#LASTLOG_UID_MAX
#
# Enable checking and display of mailbox status upon login.
#
@ -332,8 +341,8 @@ CHFN_RESTRICT rwh
# If only one of the MIN or MAX values is set, then this value will be used.
# If MIN > MAX, the highest value will be used.
#
# SHA_CRYPT_MIN_ROUNDS 5000
# SHA_CRYPT_MAX_ROUNDS 5000
#SHA_CRYPT_MIN_ROUNDS 5000
#SHA_CRYPT_MAX_ROUNDS 5000
#
# List of groups to add to the user's supplementary group set

View File

@ -131,6 +131,12 @@
<para>Display help message and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-i</option>, <option>--iso8601</option></term>
<listitem>
<para>When printing dates, use YYYY-MM-DD format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-I</option>, <option>--inactive</option>&nbsp;<replaceable>INACTIVE</replaceable>

View File

@ -70,6 +70,7 @@ const char *Prog;
static bool
dflg = false, /* set last password change date */
Eflg = false, /* set account expiration date */
iflg = false, /* set iso8601 date formatting */
Iflg = false, /* set password inactive after expiration */
lflg = false, /* show account aging information */
mflg = false, /* set minimum number of days before password change */
@ -149,6 +150,7 @@ static /*@noreturn@*/void usage (int status)
(void) fputs (_(" -d, --lastday LAST_DAY set date of last password change to LAST_DAY\n"), usageout);
(void) fputs (_(" -E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"), usageout);
(void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
(void) fputs (_(" -i, --iso8601 use YYYY-MM-DD when printing dates\n"), usageout);
(void) fputs (_(" -I, --inactive INACTIVE set password inactive after expiration\n"
" to INACTIVE\n"), usageout);
(void) fputs (_(" -l, --list show account aging information\n"), usageout);
@ -262,12 +264,20 @@ static void print_date (time_t date)
#ifdef HAVE_STRFTIME
struct tm *tp;
char buf[80];
char format[80];
if( iflg ) {
(void) snprintf (format, 80, "%%Y-%%m-%%d");
}
else {
(void) snprintf (format, 80, "%%b %%d, %%Y");
}
tp = gmtime (&date);
if (NULL == tp) {
(void) printf ("time_t: %lu\n", (unsigned long)date);
} else {
(void) strftime (buf, sizeof buf, "%b %d, %Y", tp);
(void) strftime (buf, sizeof buf, format, tp);
(void) puts (buf);
}
#else
@ -395,10 +405,11 @@ static void process_flags (int argc, char **argv)
{"maxdays", required_argument, NULL, 'M'},
{"root", required_argument, NULL, 'R'},
{"warndays", required_argument, NULL, 'W'},
{"iso8601", no_argument, NULL, 'i'},
{NULL, 0, NULL, '\0'}
};
while ((c = getopt_long (argc, argv, "d:E:hI:lm:M:R:W:",
while ((c = getopt_long (argc, argv, "d:E:hiI:lm:M:R:W:",
long_options, NULL)) != -1) {
switch (c) {
case 'd':
@ -424,6 +435,9 @@ static void process_flags (int argc, char **argv)
case 'h':
usage (E_SUCCESS);
/*@notreached@*/break;
case 'i':
iflg = true;
break;
case 'I':
Iflg = true;
if ( (getlong (optarg, &inactdays) == 0)

View File

@ -2449,9 +2449,9 @@ int main (int argc, char **argv)
(uid_t)-1, user_id, (gid_t)-1, user_gid);
} else {
fprintf (stderr,
_("%s: warning: the home directory already exists.\n"
"Not copying any file from skel directory into it.\n"),
Prog);
_("%s: warning: the home directory %s already exists.\n"
"%s: Not copying any file from skel directory into it.\n"),
Prog, user_home, Prog);
}
}

View File

@ -1879,7 +1879,7 @@ static void update_lastlog (void)
return;
}
max_uid = (uid_t) getdef_ulong ("LASTLOG_MAX_UID", 0xFFFFFFFFUL);
max_uid = (uid_t) getdef_ulong ("LASTLOG_UID_MAX", 0xFFFFFFFFUL);
if (user_newid > max_uid) {
/* do not touch lastlog for large uids */
return;