Subject: pkg/36625: nss-ldap miscalculates pw_change
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 07/10/2007 16:40:00
>Number:         36625
>Category:       pkg
>Synopsis:       nss-ldap miscalculates pw_change
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 10 16:40:00 +0000 2007
>Originator:     Edgar Fuß
>Release:        2006Q2
	Mathematisches Institut der Universität Bonn, Computerabteilung
	PADL Software's nss_ldap 240 miscalculates the pw_change field.
	While converting the LDAP shadowMax field from days-since-epoch 
	to seconds-since-epoch, it does not convert the LDAP shadowLastChange
	field it then adds. So it adds days to seconds.
	I've filed this as a bug with PADL Software, but maybe pkgsrc
	could patch it until they resolve the bug.
	pkg_add nss_ldap
	exercise getpwnam() for an LDAP user
--- ldap-pwd.c.orig	2005-08-31 04:42:50.000000000 +0200
+++ ldap-pwd.c	2007-07-10 14:41:17.000000000 +0200
@@ -185,7 +185,7 @@
         _nss_ldap_assign_attrval (e, AT (shadowLastChange), &tmp, &buffer,
       if (stat == NSS_SUCCESS)
-        pw->pw_change += atol(tmp);
+        pw->pw_change += atol(tmp) * (24*60*60);
 	pw->pw_change = 0;