diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-09-30 18:11:22 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-09-30 18:11:22 +0000 |
commit | cab563c7d244549db189c70e1c9231c20c7fea8a (patch) | |
tree | e0daaa333a3bf0a03dae764546a45b5dfe755819 /src | |
parent | a312ef9c0b720cafc45f54e64e91967db3c99cbe (diff) | |
download | nsss-cab563c7d244549db189c70e1c9231c20c7fea8a.tar.gz nsss-cab563c7d244549db189c70e1c9231c20c7fea8a.tar.xz nsss-cab563c7d244549db189c70e1c9231c20c7fea8a.zip |
Fix (hopefully) nsss_unix_shadow_get()
Diffstat (limited to 'src')
-rw-r--r-- | src/libnsss/nsss_unix_shadow_get.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/libnsss/nsss_unix_shadow_get.c b/src/libnsss/nsss_unix_shadow_get.c index 0d87088..1245834 100644 --- a/src/libnsss/nsss_unix_shadow_get.c +++ b/src/libnsss/nsss_unix_shadow_get.c @@ -7,6 +7,13 @@ #include <nsss/nsss-unix.h> #include "nsss-unix-internal.h" +static int lscan (char const *s, long *l) +{ + if (*s) return !!ulong0_scan(s, (unsigned long *)l) ; + *l = -1 ; + return 1 ; +} + static inline int shadow_parseline (struct spwd *sp, char *s, size_t max) { struct spwd sp2 ; @@ -15,19 +22,19 @@ static inline int shadow_parseline (struct spwd *sp, char *s, size_t max) if (!nsss_unix_field(&sp2.sp_namp, &s)) return 0 ; if (!nsss_unix_field(&sp2.sp_pwdp, &s)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_lstchg)) return 0 ; + if (!lscan(p, &sp2.sp_lstchg)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_min)) return 0 ; + if (!lscan(p, &sp2.sp_min)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_max)) return 0 ; + if (!lscan(p, &sp2.sp_max)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_warn)) return 0 ; + if (!lscan(p, &sp2.sp_warn)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_inact)) return 0 ; + if (!lscan(p, &sp2.sp_inact)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, (unsigned long *)&sp2.sp_expire)) return 0 ; + if (!lscan(p, &sp2.sp_expire)) return 0 ; if (!nsss_unix_field(&p, &s)) return 0 ; - if (!ulong0_scan(p, &sp2.sp_flag)) return 0 ; + if (!lscan(p, (long *)&sp2.sp_flag)) return 0 ; *sp = sp2 ; return 1 ; } |