2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/src/chage.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/src/chage.c
|
|
|
|
+++ shadow-4.5/src/chage.c
|
2016-06-14 09:34:10 +00:00
|
|
|
@@ -168,6 +168,10 @@ static void date_to_str (char *buf, size
|
|
|
|
struct tm *tp;
|
|
|
|
|
|
|
|
tp = gmtime (&date);
|
|
|
|
+ if (tp == NULL) {
|
|
|
|
+ (void) snprintf (buf, maxsize, "(unknown)");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
#ifdef HAVE_STRFTIME
|
|
|
|
(void) strftime (buf, maxsize, "%Y-%m-%d", tp);
|
|
|
|
#else
|
2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/src/lastlog.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/src/lastlog.c
|
|
|
|
+++ shadow-4.5/src/lastlog.c
|
2016-06-14 09:34:10 +00:00
|
|
|
@@ -158,13 +158,17 @@ static void print_one (/*@null@*/const s
|
|
|
|
|
|
|
|
ll_time = ll.ll_time;
|
|
|
|
tm = localtime (&ll_time);
|
|
|
|
+ if (tm == NULL) {
|
|
|
|
+ cp = "(unknown)";
|
|
|
|
+ } else {
|
|
|
|
#ifdef HAVE_STRFTIME
|
|
|
|
- strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
|
|
|
|
- cp = ptime;
|
|
|
|
+ strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
|
|
|
|
+ cp = ptime;
|
|
|
|
#else
|
|
|
|
- cp = asctime (tm);
|
|
|
|
- cp[24] = '\0';
|
|
|
|
+ cp = asctime (tm);
|
|
|
|
+ cp[24] = '\0';
|
|
|
|
#endif
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (ll.ll_time == (time_t) 0) {
|
|
|
|
cp = _("**Never logged in**\0");
|
2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/src/passwd.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/src/passwd.c
|
|
|
|
+++ shadow-4.5/src/passwd.c
|
2016-06-14 09:34:10 +00:00
|
|
|
@@ -455,6 +455,9 @@ static /*@observer@*/const char *date_to
|
|
|
|
struct tm *tm;
|
|
|
|
|
|
|
|
tm = gmtime (&t);
|
|
|
|
+ if (tm == NULL) {
|
|
|
|
+ return "(unknown)";
|
|
|
|
+ }
|
|
|
|
#ifdef HAVE_STRFTIME
|
|
|
|
(void) strftime (buf, sizeof buf, "%m/%d/%Y", tm);
|
|
|
|
#else /* !HAVE_STRFTIME */
|
2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/src/usermod.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/src/usermod.c
|
|
|
|
+++ shadow-4.5/src/usermod.c
|
2016-06-14 09:34:10 +00:00
|
|
|
@@ -210,6 +210,10 @@ static void date_to_str (/*@unique@*//*@
|
|
|
|
} else {
|
|
|
|
time_t t = (time_t) date;
|
|
|
|
tp = gmtime (&t);
|
|
|
|
+ if (tp == NULL) {
|
|
|
|
+ strncpy (buf, "unknown", maxsize);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
#ifdef HAVE_STRFTIME
|
|
|
|
strftime (buf, maxsize, "%Y-%m-%d", tp);
|
|
|
|
#else
|