sms@wlv.imsd.contel.com (Steven M. Schultz) (07/23/90)
In the verson of login.c which implements the password aging there is a bug in the notification of a soon to expire password or account. The test for an account or password expiring in less than two weeks is reversed, causing the reminder that the password or account will expire in the future to always be given rather than waiting until the expiration is within two weeks or less. The test for the current time being greater than or equal to the expiration time having already been done, the order of subtraction should be reversed in the test which follows. *** login.c.old Tue Sep 19 17:58:41 1989 --- login.c Sun Jul 22 18:23:46 1990 *************** *** 344,350 **** (void)printf("Sorry -- your password has expired.\n"); sleepexit(1); } ! else if (tp.tv_sec - pwd->pw_change < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_change); (void)printf("Warning: your password expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year); --- 344,350 ---- (void)printf("Sorry -- your password has expired.\n"); sleepexit(1); } ! else if (pwd->pw_change - tp.tv_sec < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_change); (void)printf("Warning: your password expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year); *************** *** 354,360 **** (void)printf("Sorry -- your account has expired.\n"); sleepexit(1); } ! else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_expire); (void)printf("Warning: your account expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year); --- 354,360 ---- (void)printf("Sorry -- your account has expired.\n"); sleepexit(1); } ! else if (pwd->pw_expire - tp.tv_sec < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_expire); (void)printf("Warning: your account expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year);