server session FEATURE handle expired accounts
Fixes #267
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 4f0c321..a93a080 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -700,6 +700,9 @@
if (!spwd) {
VRB("Failed to retrieve the shadow entry for \"%s\".", username);
return NULL;
+ } else if ((spwd->sp_expire > -1) && (spwd->sp_expire <= (time(NULL) / (60 * 60 * 24)))) {
+ WRN("User \"%s\" account has expired.", username);
+ return NULL;
}
pass_hash = spwd->sp_pwdp;