aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1994-09-07 01:42:29 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1994-09-07 01:42:29 +0000
commit83274713b2184ba28d2dd144b93b91c007f41bcc (patch)
treea7ad6c3b3a897f7fe38ad75aedbb2b31fd0000a3
parentf0068c4a701b5465bf29ebd9913a457d3bc5f2a1 (diff)
Notes
-rw-r--r--usr.bin/login/login.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 324c742318a67..e27870f544d7a 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -75,6 +75,7 @@ void checknologin __P((void));
void dolastlog __P((int));
void getloginname __P((void));
void motd __P((void));
+void change_passwd __P((void));
int rootterm __P((char *));
void sigint __P((int));
void sleepexit __P((int));
@@ -317,10 +318,11 @@ main(argc, argv)
if (pwd->pw_change || pwd->pw_expire)
(void)gettimeofday(&tp, (struct timezone *)NULL);
+
if (pwd->pw_change)
if (tp.tv_sec >= pwd->pw_change) {
(void)printf("Sorry -- your password has expired.\n");
- sleepexit(1);
+ change_passwd();
} else if (pwd->pw_change - tp.tv_sec <
2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
(void)printf("Warning: your password expires on %s",
@@ -600,3 +602,27 @@ sleepexit(eval)
(void)sleep(5);
exit(eval);
}
+
+void
+change_passwd()
+{
+ int pid, status, w;
+ register void (*istat)(), (*qstat)();
+
+ if (( pid=fork() ) == 0)
+ {
+ execl( "/usr/bin/passwd", "passwd", NULL );
+ fprintf( stderr, "ERROR: Can't execute passwd!\n" );
+ sleepexit( 1 );
+ }
+
+ istat = signal( SIGINT, SIG_IGN );
+ qstat = signal( SIGQUIT, SIG_IGN );
+
+ while ((w = wait( &status )) != pid && w != -1)
+ ;
+
+ signal( SIGINT, istat );
+ signal( SIGQUIT, qstat );
+}
+