summaryrefslogtreecommitdiff
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
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>
-rw-r--r--ChangeLog2
-rw-r--r--auth.c21
2 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d9dc9856..118416f6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
120000702 120000702
2 - (djm) Fix brace mismatch from Corinna Vinschen <vinschen@cygnus.com> 2 - (djm) Fix brace mismatch from Corinna Vinschen <vinschen@cygnus.com>
3 - (djm) Stop shadow expiry checking from preventing logins with NIS. Based
4 on fix from HARUYAMA Seigo <haruyama@nt.phys.s.u-tokyo.ac.jp>
3 5
420000701 620000701
5 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu> 7 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu>
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)