diff options
Diffstat (limited to '')
-rw-r--r-- | lib/isexpired.c (renamed from libmisc/isexpired.c) | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libmisc/isexpired.c b/lib/isexpired.c index ff20396..c275691 100644 --- a/libmisc/isexpired.c +++ b/lib/isexpired.c @@ -15,11 +15,13 @@ #include <config.h> #include <sys/types.h> -#include "prototypes.h" -#include "defines.h" #include <pwd.h> #include <time.h> +#include "adds.h" +#include "defines.h" +#include "prototypes.h" + #ident "$Id$" @@ -38,9 +40,9 @@ */ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp) { - long now; + long now; - now = (long) time ((time_t *) 0) / SCALE; + now = time(NULL) / DAY; if (NULL == sp) { return 0; @@ -72,7 +74,8 @@ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp) if ( (sp->sp_lstchg > 0) && (sp->sp_max >= 0) && (sp->sp_inact >= 0) - && (now >= (sp->sp_lstchg + sp->sp_max + sp->sp_inact))) { + && (now >= addsl(sp->sp_lstchg, sp->sp_max, sp->sp_inact))) + { return 2; } @@ -84,7 +87,7 @@ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp) if ( (-1 == sp->sp_lstchg) || (-1 == sp->sp_max) - || (sp->sp_max >= ((10000L * DAY) / SCALE))) { + || (sp->sp_max >= 10000)) { return 0; } @@ -94,9 +97,9 @@ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp) * the password has expired. */ - if (now >= (sp->sp_lstchg + sp->sp_max)) { + if (now >= addsl(sp->sp_lstchg, sp->sp_max)) return 1; - } + return 0; } |