tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pwd_mkdb(8) is still broken to me

> What changed by changing compiler option is value of stack garbage.
> Those garbage supposed to be filled by pw_scan() but actually it
> failed to fill them.

This saves me from reading scary x86 disasm... :)

> Since the # of bytes written to database is controlled not by
> sizeof(time_t) but by sizeof(pwd.pw_change), getversion() also should
> return 0 or 1 depending on sizeof(pwd.pw_change).

Or, write database depending on the size of time_t, like:

        time_t tmp = pwd.pw_change;

        memmove(p, &tmp, sizeof(tmp));
        p += sizeof(tmp);

Other problems I'm seeing:

- pw_scan.c:gettime() built as libnbcomat.a passes wrong sized pointer
when host time_t is 32-bit.
  - tools/compat should be built with stricter compiler checks (-Wall
-Werror) IMO.
- Current nbpwd_mkdb generates a broken *pwd.db where VERSION == 0 but
pw_change & pw_expire are 64-bit.


Home | Main Index | Thread Index | Old Index