summaryrefslogtreecommitdiff
path: root/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/auth.c b/auth.c
index bf5306be4..5aeeec6de 100644
--- a/auth.c
+++ b/auth.c
@@ -65,17 +65,18 @@ allowed_user(struct passwd * pw)
65 return 0; 65 return 0;
66 66
67 spw = getspnam(pw->pw_name); 67 spw = getspnam(pw->pw_name);
68 if (spw == NULL) 68 if (spw != NULL) {
69 return 0; 69 int days = time(NULL) / 86400;
70
71 /* Check account expiry */
72 if ((spw->sp_expire > 0) && ((time(NULL) / 86400) > spw->sp_expire))
73 return 0;
74 70
75 /* Check password expiry */ 71 /* Check account expiry */
76 if ((spw->sp_lstchg > 0) && (spw->sp_inact > 0) && 72 if ((spw->sp_expire > 0) && (days > spw->sp_expire))
77 ((time(NULL) / 86400) > (spw->sp_lstchg + spw->sp_inact))) 73 return 0;
78 return 0; 74
75 /* Check password expiry */
76 if ((spw->sp_lstchg > 0) && (spw->sp_inact > 0) &&
77 (days > (spw->sp_lstchg + spw->sp_inact)))
78 return 0;
79 }
79#else 80#else
80 /* Shouldn't be called if pw is NULL, but better safe than sorry... */ 81 /* Shouldn't be called if pw is NULL, but better safe than sorry... */
81 if (!pw) 82 if (!pw)