[Pkg-shadow-commits] r2145 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Fri Jun 13 20:12:04 UTC 2008
Author: nekral-guest
Date: 2008-06-13 20:12:03 +0000 (Fri, 13 Jun 2008)
New Revision: 2145
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/isexpired.c
Log:
* libmisc/isexpired.c: Cast number of days to a long integer.
* libmisc/isexpired.c: Add brackets and parenthesis.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-06-13 20:10:53 UTC (rev 2144)
+++ upstream/trunk/ChangeLog 2008-06-13 20:12:03 UTC (rev 2145)
@@ -1,5 +1,10 @@
2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/isexpired.c: Cast number of days to a long integer.
+ * libmisc/isexpired.c: Add brackets and parenthesis.
+
+2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/copydir.c: Do not specify a size of arrays in the
prototypes.
* libmisc/copydir.c: Use a size_t for the length of strings.
Modified: upstream/trunk/libmisc/isexpired.c
===================================================================
--- upstream/trunk/libmisc/isexpired.c 2008-06-13 20:10:53 UTC (rev 2144)
+++ upstream/trunk/libmisc/isexpired.c 2008-06-13 20:12:03 UTC (rev 2145)
@@ -56,7 +56,7 @@
{
long now;
- now = time ((time_t *) 0) / SCALE;
+ now = (long) time ((time_t *) 0) / SCALE;
if (NULL == sp) {
sp = pwd_to_spwd (pw);
@@ -68,8 +68,9 @@
* one first since it is worse.
*/
- if (sp->sp_expire > 0 && now >= sp->sp_expire)
+ if ((sp->sp_expire > 0) && (now >= sp->sp_expire)) {
return 3;
+ }
/*
* Last changed date 1970-01-01 (not very likely) means that
@@ -79,14 +80,17 @@
* 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) == 0)) {
+ if ( (0 == sp->sp_lstchg)
+ && (strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING) == 0)) {
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))
+ if ( (sp->sp_lstchg > 0)
+ && (sp->sp_max >= 0)
+ && (sp->sp_inact >= 0)
+ && (now >= (sp->sp_lstchg + sp->sp_max + sp->sp_inact))) {
return 2;
+ }
/*
* The last and max fields must be present for an account
@@ -94,9 +98,11 @@
* is considered to be infinite.
*/
- if (sp->sp_lstchg == -1 ||
- sp->sp_max == -1 || sp->sp_max >= (10000L * DAY / SCALE))
+ if ( (-1 == sp->sp_lstchg)
+ || (-1 == sp->sp_max)
+ || (sp->sp_max >= (10000L * DAY / SCALE))) {
return 0;
+ }
/*
* Calculate today's day and the day on which the password
@@ -104,8 +110,9 @@
* the password has expired.
*/
- if (now >= (sp->sp_lstchg + sp->sp_max))
+ if (now >= (sp->sp_lstchg + sp->sp_max)) {
return 1;
+ }
return 0;
}
More information about the Pkg-shadow-commits
mailing list