[svn-upgrade] Integrating new upstream version, shadow (4.0.4)

This commit is contained in:
nekral-guest
2007-10-07 11:45:23 +00:00
parent 4903ce068e
commit effd479bff
431 changed files with 56747 additions and 47326 deletions

View File

@@ -41,7 +41,7 @@
#include <time.h>
#include "rcsid.h"
RCSID("$Id: isexpired.c,v 1.9 2002/01/06 14:02:39 kloczek Exp $")
RCSID ("$Id: isexpired.c,v 1.11 2003/05/03 16:14:33 kloczek Exp $")
/*
* isexpired - determine if account is expired yet
@@ -49,18 +49,16 @@ RCSID("$Id: isexpired.c,v 1.9 2002/01/06 14:02:39 kloczek Exp $")
* isexpired calculates the expiration date based on the
* password expiration criteria.
*/
/*ARGSUSED*/
/*ARGSUSED*/
#ifdef SHADOWPWD
int
isexpired(const struct passwd *pw, const struct spwd *sp)
int isexpired (const struct passwd *pw, const struct spwd *sp)
{
long now;
long now;
now = time ((time_t *) 0) / SCALE;
if (!sp)
sp = pwd_to_spwd(pw);
sp = pwd_to_spwd (pw);
/*
* Quick and easy - there is an expired account field
@@ -79,11 +77,12 @@ isexpired(const struct passwd *pw, const struct spwd *sp)
* if /etc/shadow doesn't exist, getspnam() still succeeds and
* returns sp_lstchg==0 (must change password) instead of -1!
*/
if (sp->sp_lstchg == 0 && !strcmp(pw->pw_passwd, SHADOW_PASSWD_STRING))
if (sp->sp_lstchg == 0
&& !strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING))
return 1;
if (sp->sp_lstchg > 0 && sp->sp_max >= 0 && sp->sp_inact >= 0 &&
now >= sp->sp_lstchg + sp->sp_max + sp->sp_inact)
now >= sp->sp_lstchg + sp->sp_max + sp->sp_inact)
return 2;
/*
@@ -93,12 +92,8 @@ isexpired(const struct passwd *pw, const struct spwd *sp)
*/
if (sp->sp_lstchg == -1 ||
sp->sp_max == -1 || sp->sp_max >= (10000L*DAY/SCALE))
sp->sp_max == -1 || sp->sp_max >= (10000L * DAY / SCALE))
return 0;
#ifdef ATT_AGE
if (pw->pw_age[0] == '\0' || pw->pw_age[0] == '/')
return 0;
#endif
/*
* Calculate today's day and the day on which the password
@@ -108,10 +103,6 @@ isexpired(const struct passwd *pw, const struct spwd *sp)
if (now >= sp->sp_lstchg + sp->sp_max)
return 1;
#ifdef ATT_AGE
if (a64l (pw->pw_age + 2) + c64i (pw->pw_age[1]) < now / 7)
return 1;
#endif
return 0;
}
#endif /* SHADOWPWD */
#endif /* SHADOWPWD */