1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-20 02:38:43 +00:00
Accounts that have "pw_change" set, are supposed to change their passwords
by the date specified in "pw_change".  If they have not changed their passwords
by that date, currently they get "LOCKED OUT" of the system.  This is not the
correct behavior, the user should be prompt (forced?) to change their password
at this time.  If the behavior of "pw_change" was meant to be a LOCKOUT,
then you should use "pw_expire".

Solution:
     Instead of locking out the user, prompt them to change their password.

Reviewed by:	jkh
Submitted by:	rls
This commit is contained in:
Jordan K. Hubbard 1994-09-07 01:42:29 +00:00
parent f0068c4a70
commit 83274713b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2532

View File

@ -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 );
}