Yeah, I see what you are trying to do, and I applaud
your efforts but it is pretty trivial to break this.
If you have plaintext passwords in /etc/passwd and
only know scripting languages but have a full DB like
BDB or better yet for this: metakit, than it is possible
to write something in tcl/perl/awk that could do the
job.
OTOH: C would be perfect for this, but I don't
know the Tru64 C specifics.
FWIW here is my idea:
1) Create a master database containing
field1=user,field2=passwd,field3=startdate,field4=restrictdate,
field5=flag.
2) Write a parser for utmp/wtmp or just use who to get
a list of users on system. Either integrate this in
your script by setting up an event loop or decide to call the script through cron.
3) Foreach user currently on system get current epoch time
and add the difference to the startdate, if the startdate
is greater than restrictdate - critical period(say a week)
and the new and old passwd's are the same then send the
user a warning and set the flag. If the user is breaking the rules lock them out. If the user has changed their password update the database, renew the start and end
dates.
Personally I would arrange for this procedure to start
during init sometime, and then daemonize, waking up every
half-hour or so to run a check, then sleep again.