+ if (chdir(pwd->pw_dir) < 0) {
+ printf("No directory %s!\n", pwd->pw_dir);
+ if (chdir("/"))
+ exit(0);
+ pwd->pw_dir = "/";
+ printf("Logging in with home = \"/\".\n");
+ }
+
+#define TWOWEEKS (14*24*60*60)
+ if (pwd->pw_change || pwd->pw_expire)
+ (void)gettimeofday(&tp, (struct timezone *)NULL);
+ if (pwd->pw_change)
+ if (tp.tv_sec >= pwd->pw_change) {
+ printf("Sorry -- your password has expired.\n");
+ sleepexit(1);
+ }
+ else if (tp.tv_sec - pwd->pw_change < TWOWEEKS) {
+ ttp = localtime(&pwd->pw_change);
+ printf("Warning: your password expires on %s %d, 19%d\n",
+ months[ttp->tm_mon], ttp->tm_mday, ttp->tm_year);
+ }
+ if (pwd->pw_expire)
+ if (tp.tv_sec >= pwd->pw_expire) {
+ printf("Sorry -- your account has expired.\n");
+ sleepexit(1);
+ }
+ else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS) {
+ ttp = localtime(&pwd->pw_expire);
+ printf("Warning: your account expires on %s %d, 19%d\n",
+ months[ttp->tm_mon], ttp->tm_mday, ttp->tm_year);
+ }
+
+#define TWOWEEKS (14*24*60*60)
+ if (pwd->pw_change || pwd->pw_expire)
+ (void)gettimeofday(&tp, (struct timezone *)NULL);
+ if (pwd->pw_change)
+ if (tp.tv_sec >= pwd->pw_change) {
+ printf("Sorry -- your password has expired.\n");
+ sleepexit(1);
+ }
+ else if (tp.tv_sec - pwd->pw_change < TWOWEEKS) {
+ ttp = localtime(&pwd->pw_change);
+ printf("Warning: your password expires on %s %d, 19%d\n",
+ months[ttp->tm_mon], ttp->tm_mday, ttp->tm_year);
+ }
+ if (pwd->pw_expire)
+ if (tp.tv_sec >= pwd->pw_expire) {
+ printf("Sorry -- your account has expired.\n");
+ sleepexit(1);
+ }
+ else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS) {
+ ttp = localtime(&pwd->pw_expire);
+ printf("Warning: your account expires on %s %d, 19%d\n",
+ months[ttp->tm_mon], ttp->tm_mday, ttp->tm_year);
+ }
+
+ /* nothing else left to fail -- really log in */