mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
fix arguable off-by-one in password expiry check
Old behaviour was to allow upto and including the expiry day, but this changes it to allow upto but _not_ including which apparently matches some other tools and libraries (e.g. Linux-PAM pam_unix.so). Anthropic ANT-2026-V1VNLWUV
This commit is contained in:
1 file changed
+4
-3
+4
-3
@@ -44,8 +44,9 @@
|
||||
extern struct sshbuf *loginmsg;
|
||||
|
||||
/*
|
||||
* For the account and password expiration functions, we assume the expiry
|
||||
* occurs the day after the day specified.
|
||||
* For the password expiration function, we assume the expiry occurs the
|
||||
* day after the day specified. An account is expired from the day given
|
||||
* by sp_expire onward, matching chage(1), login(1) and pam_unix(8).
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -66,7 +67,7 @@ auth_shadow_acctexpired(struct spwd *spw)
|
||||
|
||||
if (spw->sp_expire == -1) {
|
||||
debug3("account expiration disabled");
|
||||
} else if (daysleft < 0) {
|
||||
} else if (daysleft <= 0) {
|
||||
logit("Account %.100s has expired", spw->sp_namp);
|
||||
return 1;
|
||||
} else if (daysleft <= spw->sp_warn) {
|
||||
|
||||
Reference in new issue
Block a user