From fc0ed79e5d700b4a730235fe88e60951717edc6e Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Fri, 26 Jul 2019 21:39:42 +0200 Subject: [PATCH 1/7] usermod.c: Fix invalid variable name Fix invalid LASTLOG_MAX_UID variable name to correct LASTLOG_UID_MAX. Signed-off-by: Stanislav Brabec --- src/usermod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usermod.c b/src/usermod.c index c3718864..0ae50e34 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -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; From 00a5cff2449356d516352a2e2a3bd26693334081 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Fri, 26 Jul 2019 22:34:59 +0200 Subject: [PATCH 2/7] login.defs: Really add LASTLOG_UID_MAX However 46331648 mentions adding of LASTLOG_UID_MAX to login.defs, it did not happen. Signed-off-by: Stanislav Brabec --- etc/login.defs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/login.defs b/etc/login.defs index eba4bde7..e527cdcb 100644 --- a/etc/login.defs +++ b/etc/login.defs @@ -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. # From 3025fefc41bf89c72024dc8d58a04839acc2ff0b Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Fri, 26 Jul 2019 22:47:05 +0200 Subject: [PATCH 3/7] login.defs: Cosmetic space change Fix formatting of login.defs comments. Variables are preceeded by "#" without space, comments are preceeded by "# ". It makes the file machine parseable again. Signed-off-by: Stanislav Brabec --- etc/login.defs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/login.defs b/etc/login.defs index e527cdcb..f235e1b4 100644 --- a/etc/login.defs +++ b/etc/login.defs @@ -341,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 From edf7547ad5aa650be868cf2dac58944773c12d75 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 31 Jul 2019 13:09:36 -0400 Subject: [PATCH 4/7] Fix failing chmod calls on installation for suidubins suidubins should be suidusbins, since these binaries are installed ${prefix}/sbin. This historically hasn't broken the build because chmod of newgidmap/newuidmap succeeds, causing make to think the command succeeded. Configuring shadow with --with-fcaps removes these final two entries and exposes the chmod failure to make. --- src/Makefile.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 34690ced..a8c29c91 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -52,13 +52,14 @@ usbin_PROGRAMS = \ # id and groups are from gnu, sulogin from sysvinit noinst_PROGRAMS = id sulogin +suidusbins = suidbins = su suidubins = chage chfn chsh expiry gpasswd newgrp if !WITH_TCB suidubins += passwd endif if ACCT_TOOLS_SETUID -suidubins += chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod +suidusbins += chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod endif if ENABLE_SUBIDS if !FCAPS @@ -134,6 +135,9 @@ install-am: all-am for i in $(suidubins); do \ chmod $(suidperms) $(DESTDIR)$(ubindir)/$$i; \ done + for i in $(suidusbins); do \ + chmod $(suidperms) $(DESTDIR)$(usbindir)/$$i; \ + done if WITH_TCB for i in $(shadowsgidubins); do \ chown root:shadow $(DESTDIR)$(ubindir)/$$i; \ From e293aa9cfca0619a63616af75532637dab60d49d Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 2 Aug 2019 18:45:19 -0400 Subject: [PATCH 5/7] Honor --sbindir and --bindir for binary installation Some distros don't care about the split between /bin, /sbin, /usr/bin, and /usr/sbin, so let them easily stuff binaries wherever they want. --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a8c29c91..f7f132ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,8 @@ EXTRA_DIST = \ .indent.pro -ubindir = ${prefix}/bin -usbindir = ${prefix}/sbin +ubindir = ${bindir} +usbindir = ${sbindir} suidperms = 4755 sgidperms = 2755 From 5687be5f31f1bf9a8e1445843029556bb5647fc8 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 6 Aug 2019 19:36:42 +0100 Subject: [PATCH 6/7] chage.c: add support for YYYY-MM-DD date printing --- man/chage.1.xml | 6 ++++++ src/chage.c | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/man/chage.1.xml b/man/chage.1.xml index 6ec6e840..1e4cc539 100644 --- a/man/chage.1.xml +++ b/man/chage.1.xml @@ -131,6 +131,12 @@ Display help message and exit. + + , + + When printing dates, use YYYY-MM-DD format. + + ,  INACTIVE diff --git a/src/chage.c b/src/chage.c index 05d2349b..23622e24 100644 --- a/src/chage.c +++ b/src/chage.c @@ -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) From 23262b249cd7920d6ed237d168be22aad36c4fb3 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 7 Aug 2019 19:41:12 +0100 Subject: [PATCH 7/7] src/useradd.c: including directory name in dir existence error. Prefixing output lines with program name. --- src/useradd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/useradd.c b/src/useradd.c index bdd7fe8c..94835e93 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -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); } }