summaryrefslogtreecommitdiffstats
path: root/auth.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-07-02 18:44:54 +1000
committerDamien Miller <djm@mindrot.org>2000-07-02 18:44:54 +1000
commitc708843e6a209b1c1f1a6d3e60b29be56d1d8894 (patch)
tree6d8407aace7606688295d10d9feebce06859465b /auth.c
parent9b6d4ab8f9af7bd503ef304b7ffa9d8d77bb21f1 (diff)
- (djm) Stop shadow expiry checking from preventing logins with NIS. Based
on fix from HARUYAMA Seigo <haruyama@nt.phys.s.u-tokyo.ac.jp>
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 bf5306be..5aeeec6d 100644
--- a/auth.c
+++ b/auth.c
@@ -65,17 +65,18 @@ allowed_user(struct passwd * pw)
return 0;
spw = getspnam(pw->pw_name);
- if (spw == NULL)
- return 0;
-
- /* Check account expiry */
- if ((spw->sp_expire > 0) && ((time(NULL) / 86400) > spw->sp_expire))
- return 0;
+ if (spw != NULL) {
+ int days = time(NULL) / 86400;
- /* Check password expiry */
- if ((spw->sp_lstchg > 0) && (spw->sp_inact > 0) &&
- ((time(NULL) / 86400) > (spw->sp_lstchg + spw->sp_inact)))
- return 0;
+ /* Check account expiry */
+ if ((spw->sp_expire > 0) && (days > spw->sp_expire))
+ return 0;
+
+ /* Check password expiry */
+ if ((spw->sp_lstchg > 0) && (spw->sp_inact > 0) &&
+ (days > (spw->sp_lstchg + spw->sp_inact)))
+ return 0;
+ }
#else
/* Shouldn't be called if pw is NULL, but better safe than sorry... */
if (!pw)