Skip site navigation (1)Skip section navigation (2)

misc/14511: chpass Y2K problem

From:kondo@ysyslab.co.jp
Date:Mon, 25 Oct 1999 00:41:11 -0700 (PDT)
Subject:chapss Y2K problem
Send-pr version:www-1.0

Number:14511
Category:misc
Synopsis:chpass Y2K problem
Severity:non-critical
Priority:low
Responsible:cjc@FreeBSD.org
State:closed
Class:sw-bug
Arrival-Date:Mon Oct 25 00:50:00 PDT 1999
Closed-Date:Thu Mar 21 02:33:37 PST 2002
Last-Modified:Thu Mar 21 02:33:37 PST 2002
Originator:kondo hiroshi
Release:FreeBSD 3.3

Organization:
Yokohama System Laboratory
 
Environment:
FreeBSD mike.ysyslab.co.jp 3.3-RELEASE FreeBSD 3.3-RELEASE #6: Wed Oct 13 15:44:57 JST 1999 root@mike.ysyslab.co.jp:/usr/src/sys/compile/SB16 i386
 
Description:
chpass expire date (year ploblem)
"-e Dec 6 99" is OK.
"-e Dec 6 00" is error.
"-e Dec 6 01" is OK.
How-To-Repeat:
# chpass "-e Dec 6 00" username
chpass: illegal date for expire field
chpass: /etc/master.passwd: unchanged
 
Fix:
chpass "-e Dec 6 2000" username
chpass: updating the database...
chpass: done
Release-Note:
 
Audit-Trail:
Reply via E-mail
From:Mike Pritchard <mpp@mpp.pro-ns.net>
Date:Mon, 25 Oct 1999 05:12:06 -0500
On Mon, Oct 25, 1999 at 12:41:11AM -0700, kondo@ysyslab.co.jp wrote:
> >Synopsis: chapss Y2K problem
> chpass expire date (year ploblem)
> "-e Dec 6 99" is OK.
> "-e Dec 6 00" is error.
> "-e Dec 6 01" is OK.

The following patch fixes the problem, but I noticed that the commit
that broke this advertises that it supports single digit years in the
range 69 - 68, meaning 1968 - 2068. This doesn't work. chpass
fails if you try to set a date beyond Jan 18, 2038. I think the call
to mktime() fails for dates beyond that, because that is the last
date that can be stored in one of our time_t variables (someone
correct me if I'm wrong).

I also noticed that the "-e" flag isn't documented in the man page.
If no one else steps up and commits a fix, I'll do it next time I
have some spare time. I only took a look at this because
I fixed/rewrote some of the routine that handles password
change/expiration dates several years ago, and I was curious to see
if it was my change that messed it up.

It might be possible for chpass to incorrectly set the expiration
year to 2000 if atoi returns zero due to the input string being
garbled. The atot routine in chpass should probably be changed
to call strtol() directly and test the return values to see if
it was given a valid string of all digits. That was what the
previous !year check was for, but the two digit year change messed
that up.

-Mike

Download patch-1.diff
Index: util.c
===================================================================
RCS file: /shared/ncvs/src/usr.bin/chpass/util.c,v
retrieving revision 1.8
diff -u -r1.8 util.c
--- util.c       1999/08/28 00:59:39     1.8
+++ util.c       1999/10/25 09:48:54
@@ -113,7 +113,7 @@
         if (!(t = strtok((char *)NULL, " \t,")) || !isdigit(*t))
                 goto bad;
         year = atoi(t);
-        if (day < 1 || day > 31 || month < 1 || month > 12 || !year)
+        if (day < 1 || day > 31 || month < 1 || month > 12)
                 goto bad;
         /* Allow two digit years 1969-2068 */
         if (year < 69)
-- 

Mike Pritchard
mpp@FreeBSD.org or mpp@mpp.pro-ns.net



State Changed
From-To:open->feedback
By:iedowse
When:Mon Jan 21 13:26:52 PST 2002
Why:Can this be closed, now that it has become a Y3K problem? :-)

State Changed
From-To:feedback->analyzed
By:cjc
When:Mon Mar 18 01:49:37 PST 2002
Why:Fixed in -CURRENT.

Responsible Changed
From-To:freebsd-bugs->cjc
By:cjc
When:Mon Mar 18 01:49:37 PST 2002
Why:I've been working in chpass(8). Looking at fixing some old PRs. Will
handle MFC to -STABLE.

State Changed
From-To:analyzed->closed
By:cjc
When:Thu Mar 21 02:33:11 PST 2002
Why:MFC'ed to -STABLE.

Unformatted:
 
Submit Followup | Raw PR | Find another PR