summaryrefslogtreecommitdiff
path: root/auth-shadow.c
diff options
context:
space:
mode:
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 76c0d9f52..7d699bc40 100644
--- a/auth-shadow.c
+++ b/auth-shadow.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$Id: auth-shadow.c,v 1.3 2004/02/11 07:48:52 dtucker Exp $"); 26RCSID("$Id: auth-shadow.c,v 1.4 2004/02/21 22:43:15 dtucker Exp $");
27 27
28#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) 28#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)
29#include <shadow.h> 29#include <shadow.h>
@@ -37,6 +37,32 @@ RCSID("$Id: auth-shadow.c,v 1.3 2004/02/11 07:48:52 dtucker Exp $");
37extern Buffer loginmsg; 37extern Buffer loginmsg;
38 38
39/* 39/*
40 * For the account and password expiration functions, we assume the expiry
41 * occurs the day after the day specified.
42 */
43
44/*
45 * Check if specified account is expired. Returns 1 if account is expired,
46 * 0 otherwise.
47 */
48int
49auth_shadow_acctexpired(struct spwd *spw)
50{
51 time_t today;
52
53 today = time(NULL) / DAY;
54 debug3("%s: today %d sp_expire %d", __func__, (int)today,
55 (int)spw->sp_expire);
56
57 if (spw->sp_expire != -1 && today > spw->sp_expire) {
58 logit("Account %.100s has expired", spw->sp_namp);
59 return 1;
60 }
61
62 return 0;
63}
64
65/*
40 * Checks password expiry for platforms that use shadow passwd files. 66 * Checks password expiry for platforms that use shadow passwd files.
41 * Returns: 1 = password expired, 0 = password not expired 67 * Returns: 1 = password expired, 0 = password not expired
42 */ 68 */