r20136: Fix #4290. Properly compute time to password expiration in message from
authorJim McDonough <jmcd@samba.org>
Tue, 12 Dec 2006 22:05:48 +0000 (22:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:27 +0000 (12:16 -0500)
pam_winbind.  Thanks to Andrew Benham <andrew.benham@thus.net>
(This used to be commit 0d03f5137936546253a8b3334995f536f3621d57)

source3/nsswitch/pam_winbind.c

index a61dceedce18972fdca8399807ca21285828d54c..24e27cb8c69e00fc43bbc8aa35e92c30daf8a3f0 100644 (file)
@@ -536,7 +536,8 @@ static int winbind_auth_request(pam_handle_t * pamh,
            (response.data.auth.policy.expire) && 
            (response.data.auth.info3.pass_last_set_time + response.data.auth.policy.expire > time(NULL) ) ) {
 
-               int days = response.data.auth.policy.expire / SECONDS_PER_DAY;
+               int days = (response.data.auth.info3.pass_last_set_time + response.data.auth.policy.expire -
+                           time(NULL))/ SECONDS_PER_DAY;
                if (days <= DAYS_TO_WARN_BEFORE_PWD_EXPIRES) {
                        _make_remark_format(pamh, PAM_TEXT_INFO, "Your password will expire in %d days", days);
                }