| Summary: | chpass Y2K problem | ||
|---|---|---|---|
| Product: | Base System | Reporter: | kondo <kondo> |
| Component: | misc | Assignee: | Crist J. Clark <cjc> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
kondo
1999-10-25 08:50:00 UTC
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 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 Can this be closed, now that it has become a Y3K problem? :-) State Changed From-To: feedback->analyzed Fixed in -CURRENT. Responsible Changed From-To: freebsd-bugs->cjc I've been working in chpass(8). Looking at fixing some old PRs. Will handle MFC to -STABLE. State Changed From-To: analyzed->closed MFC'ed to -STABLE. |