]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
heck for account and password expiration
authorAlan T. DeKok <aland@freeradius.org>
Tue, 7 Feb 2012 19:58:52 +0000 (20:58 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 7 Feb 2012 20:00:38 +0000 (21:00 +0100)
src/modules/rlm_unix/rlm_unix.c

index 5c0fe0fc327178fd6c767b78812140e56fbe33da..abec68c9d9d0318164a7d5c175f359f25f3c6685 100644 (file)
@@ -272,9 +272,17 @@ static int unix_getpw(UNUSED void *instance, REQUEST *request,
        /*
         *      Check if password has expired.
         */
+       if (spwd && spwd->sp_lstchg > 0 && spwd->sp_max >= 0 &&
+           (request->timestamp / 86400) > (spwd->sp_lstchg + spwd->sp_max)) {
+               radlog_request(L_AUTH, 0, request, "[%s]: password has expired", name);
+               return RLM_MODULE_REJECT;
+       }
+       /*
+        *      Check if account has expired.
+        */
        if (spwd && spwd->sp_expire > 0 &&
            (request->timestamp / 86400) > spwd->sp_expire) {
-               radlog_request(L_AUTH, 0, request, "[%s]: password has expired", name);
+               radlog_request(L_AUTH, 0, request, "[%s]: account has expired", name);
                return RLM_MODULE_REJECT;
        }
 #endif