summaryrefslogtreecommitdiff
path: root/auth-shadow.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-02-22 09:43:15 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-02-22 09:43:15 +1100
commit15ee748f2835f301499f8c31b6b4e56f5deca7de (patch)
tree513b99b8e7fcbaf90a7444bfb6ab47b86d90025d /auth-shadow.c
parent2e45cb0fb4a1250792e27ce14c556661719e5861 (diff)
downloadopenssh-git-15ee748f2835f301499f8c31b6b4e56f5deca7de.tar.gz
- (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.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/auth-shadow.c b/auth-shadow.c
index 76c0d9f5..7d699bc4 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
*/