Issue 69 - Year mishandling in libraries/libldap/templout.c
Summary: Year mishandling in libraries/libldap/templout.c
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1999-02-05 23:35 UTC by cuccia@tcsi.com
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description cuccia@tcsi.com 1999-02-05 23:35:01 UTC
Full_Name: Nick Cuccia
Version: 1.1.2
OS: SunOS 4.1.4
URL: ftp://ftp.openldap.org/incoming/cuccia-990205.tmplout-y2k-patch
Submission from: (NULL) (137.134.47.2)


The macro YEAR(y) in libraries is used to convert the contents of the
tm_year field of a struct tm to a four-digit year.  While it succeeds
when tm_year < 100, it incorrectly handles values >= 100.

Note that in the year 2000 and beyond, the value contained in the tm_year
field of SunOS (and most, if not all, other Unix and Unix-like systems)
will be 100 or more.  Given the current implementation of YEAR(y), the
gtime() function (which calculates a time_t based when given a struct tm)
will generate incorrect return values after 1/1/2000.

I've placed a patch which fixes this in the URL included below.

--Nick
Comment 1 Kurt Zeilenga 1999-02-08 19:22:02 UTC
moved from Incoming to Software Bugs
Comment 2 Kurt Zeilenga 1999-02-09 05:29:52 UTC
Nick,

I think the bug is slightly larger...  that is, text2time
doesn't handle 4 digit years at all.

Please review this patch:

http://www.openldap.org/devel/cvsweb.cgi/libraries/libldap/tmplout.c.diff?r1=1.14&r2=1.15
Comment 3 cuccia@tcsi.com 1999-02-11 19:55:53 UTC
Kurt, thanks for working on this.  I haven't had a chance yet to go over the
change, but a thought occured to me:

The only place that YEAR() was invoked was in gtime().  Unless I'm missing
something (and I understand that this code derives from the original UMich
code), gtime() appears to be a re-implementation of the ANSI/ISO C and POSIX
function:

	time_t mktime(struct tm *timeptr)

(specifed in ANSI/ISO C, POSIX.1-1988, and the OpenUnix specifications; Cf.
<http://www.opengroup.org/onlinepubs/7908799/xsh/mktime.html>).

--Nick
Comment 4 Kurt Zeilenga 1999-02-11 23:13:44 UTC
changed notes
changed state Open to Closed
Comment 5 OpenLDAP project 2014-08-01 21:06:51 UTC
Patched in 1.2.0