diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-02-21 23:43:15 +0100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-02-21 23:43:15 +0100 |
commit | 15ee748f2835f301499f8c31b6b4e56f5deca7de (patch) | |
tree | 513b99b8e7fcbaf90a7444bfb6ab47b86d90025d /auth-shadow.c | |
parent | - (djm) [openbsd-compat/setproctitle.c] fix comments; from grange@ (diff) | |
download | openssh-15ee748f2835f301499f8c31b6b4e56f5deca7de.tar.xz openssh-15ee748f2835f301499f8c31b6b4e56f5deca7de.zip |
- (dtucker) [auth-shadow.c auth.c auth.h] Move shadow account expiry test
to auth-shadow.c, no functional change. ok djm@
Diffstat (limited to 'auth-shadow.c')
-rw-r--r-- | auth-shadow.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/auth-shadow.c b/auth-shadow.c index 76c0d9f52..7d699bc40 100644 --- a/auth-shadow.c +++ b/auth-shadow.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$Id: auth-shadow.c,v 1.3 2004/02/11 07:48:52 dtucker Exp $"); +RCSID("$Id: auth-shadow.c,v 1.4 2004/02/21 22:43:15 dtucker Exp $"); #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) #include <shadow.h> @@ -37,6 +37,32 @@ RCSID("$Id: auth-shadow.c,v 1.3 2004/02/11 07:48:52 dtucker Exp $"); extern Buffer loginmsg; /* + * For the account and password expiration functions, we assume the expiry + * occurs the day after the day specified. + */ + +/* + * Check if specified account is expired. Returns 1 if account is expired, + * 0 otherwise. + */ +int +auth_shadow_acctexpired(struct spwd *spw) +{ + time_t today; + + today = time(NULL) / DAY; + debug3("%s: today %d sp_expire %d", __func__, (int)today, + (int)spw->sp_expire); + + if (spw->sp_expire != -1 && today > spw->sp_expire) { + logit("Account %.100s has expired", spw->sp_namp); + return 1; + } + + return 0; +} + +/* * Checks password expiry for platforms that use shadow passwd files. * Returns: 1 = password expired, 0 = password not expired */ |