diff options
Diffstat (limited to 'shadow')
-rw-r--r-- | shadow/lckpwdf.c | 2 | ||||
-rw-r--r-- | shadow/putspent.c | 25 | ||||
-rw-r--r-- | shadow/sgetspent_r.c | 35 | ||||
-rw-r--r-- | shadow/shadow.h | 14 |
4 files changed, 40 insertions, 36 deletions
diff --git a/shadow/lckpwdf.c b/shadow/lckpwdf.c index 60cf2eecf7..707c00965d 100644 --- a/shadow/lckpwdf.c +++ b/shadow/lckpwdf.c @@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */ /* Name of the lock file. */ -#define PWD_LOCKFILE "/var/lock/lock.pwd" +#define PWD_LOCKFILE "/etc/lock.pwd" /* How long to wait for getting the lock before returning with an error. */ diff --git a/shadow/putspent.c b/shadow/putspent.c index b638057bae..8c8bd2a9a9 100644 --- a/shadow/putspent.c +++ b/shadow/putspent.c @@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <errno.h> #include <stdio.h> #include <shadow.h> @@ -31,39 +30,39 @@ putspent (const struct spwd *p, FILE *stream) if (fprintf (stream, "%s:%s:", p->sp_namp, p->sp_pwdp) < 0) ++errors; - if ((p->sp_lstchg != (time_t) -1 + if ((p->sp_lstchg != (long int) -1 && fprintf (stream, "%ld:", p->sp_lstchg) < 0) - || (p->sp_lstchg == (time_t) -1 + || (p->sp_lstchg == (long int) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_min != (time_t) -1 + if ((p->sp_min != (long int) -1 && fprintf (stream, "%ld:", p->sp_min) < 0) - || (p->sp_min == (time_t) -1 + || (p->sp_min == (long int) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_max != (time_t) -1 + if ((p->sp_max != (long int) -1 && fprintf (stream, "%ld:", p->sp_max) < 0) - || (p->sp_max == (time_t) -1 + || (p->sp_max == (long int) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_warn != (time_t) -1 + if ((p->sp_warn != (long int) -1 && fprintf (stream, "%ld:", p->sp_warn) < 0) - || (p->sp_warn == (time_t) -1 + || (p->sp_warn == (long int) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_inact != (time_t) -1 + if ((p->sp_inact != (long int) -1 && fprintf (stream, "%ld:", p->sp_inact) < 0) - || (p->sp_inact == (time_t) -1 + || (p->sp_inact == (long int) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_expire != (time_t) -1 + if ((p->sp_expire != (long int) -1 && fprintf (stream, "%ld:", p->sp_expire) < 0) - || (p->sp_expire == (time_t) -1 + || (p->sp_expire == (long int) -1 && putc (':', stream) == EOF)) ++errors; diff --git a/shadow/sgetspent_r.c b/shadow/sgetspent_r.c index 03c96b581b..407886ede4 100644 --- a/shadow/sgetspent_r.c +++ b/shadow/sgetspent_r.c @@ -28,34 +28,41 @@ Cambridge, MA 02139, USA. */ #define ENTNAME spent struct spent_data {}; +/* Predicate which always returns false, needed below. */ +#define FALSE(arg) 0 + + #include "../nss/nss_files/files-parse.c" LINE_PARSER (, STRING_FIELD (result->sp_namp, ISCOLON, 0); STRING_FIELD (result->sp_pwdp, ISCOLON, 0); - INT_FIELD (result->sp_lstchg, ISCOLON, 0, 10, (time_t)); - INT_FIELD (result->sp_min, ISCOLON, 0, 10, (time_t)); - INT_FIELD (result->sp_max, ISCOLON, 0, 10, (time_t)); + INT_FIELD (result->sp_lstchg, ISCOLON, 0, 10, (long int)); + INT_FIELD (result->sp_min, ISCOLON, 0, 10, (long int)); + INT_FIELD (result->sp_max, ISCOLON, 0, 10, (long int)); while (isspace (*line)) ++line; if (*line == '\0') { /* The old form. */ - result->sp_warn = (time_t) -1; - result->sp_inact = (time_t) -1; - result->sp_expire = (time_t) -1; + result->sp_warn = (long int) -1; + result->sp_inact = (long int) -1; + result->sp_expire = (long int) -1; result->sp_flag = ~0ul; } else { - INT_FIELD_MAYBE_NULL (result->sp_warn, ISCOLON, 0, 10, (time_t), - (time_t) -1); - INT_FIELD_MAYBE_NULL (result->sp_inact, ISCOLON, 0, 10, (time_t), - (time_t) -1); - INT_FIELD_MAYBE_NULL (result->sp_expire, ISCOLON, 0, 10, (time_t), - (time_t) -1); - INT_FIELD_MAYBE_NULL (result->sp_flag, ISCOLON, 0, 10, - (unsigned long int), ~0ul); + INT_FIELD_MAYBE_NULL (result->sp_warn, ISCOLON, 0, 10, (long int), + (long int) -1); + INT_FIELD_MAYBE_NULL (result->sp_inact, ISCOLON, 0, 10, (long int), + (long int) -1); + INT_FIELD_MAYBE_NULL (result->sp_expire, ISCOLON, 0, 10, (long int), + (long int) -1); + if (*line != '\0') + INT_FIELD_MAYBE_NULL (result->sp_flag, FALSE, 0, 10, + (unsigned long int), ~0ul) + else + result->sp_flag = ~0ul; } ) diff --git a/shadow/shadow.h b/shadow/shadow.h index b1a4c82b4e..133cfd6009 100644 --- a/shadow/shadow.h +++ b/shadow/shadow.h @@ -25,8 +25,6 @@ Boston, MA 02111-1307, USA. */ #define __need_FILE #include <stdio.h> -#define __need_time_t -#include <time.h> /* Paths to the userd files. */ #define SHADOW "/etc/shadow" @@ -39,14 +37,14 @@ struct spwd { char *sp_namp; /* Login name. */ char *sp_pwdp; /* Encrypted password. */ - __time_t sp_lstchg; /* Date of last change. */ - __time_t sp_min; /* Minimum number of days between changes. */ - __time_t sp_max; /* Maximum number of days between changes. */ - __time_t sp_warn; /* Number of days to warn user to change + long int sp_lstchg; /* Date of last change. */ + long int sp_min; /* Minimum number of days between changes. */ + long int sp_max; /* Maximum number of days between changes. */ + long int sp_warn; /* Number of days to warn user to change the password. */ - __time_t sp_inact; /* Number of days the account may be + long int sp_inact; /* Number of days the account may be inactive. */ - __time_t sp_expire; /* Number of days since 1970-01-01 until + long int sp_expire; /* Number of days since 1970-01-01 until account expires. */ unsigned long int sp_flag; /* Reserved. */ }; |