Possible bug in NFSv4 with krb5p security?

Elias Mårtenson lokedhs at gmail.com
Tue Feb 19 09:35:51 UTC 2013

On 19 February 2013 17:31, Andrey Simonenko <simon at comsys.ntu-kpi.kiev.ua>wrote:

It can require bigger buffer, since root can get the pw_password field
> in the struct passwd{}.
> Since sysconf(_SC_GETPW_R_SIZE_MAX) does not work on FreeBSD, the buffer
> for getpwnam_r() call should have at least (2 * MAXLOGNAME + 2 *
> _PASSWORD_LEN + 1) bytes (it is unclear how much is required for pw_gecos).
> This buffer can be dynamically reallocated until getpwnam_r() is not
> return ERANGE error (the following code has not been compiled and
> verified):

Is this really a better solution than to aim high right away? A series of
malloc() calls should certainly have much higher overhead than the previous
stack-allocated solution.

A better compromise would be to do the lookup in a separate function, that
allocates the buffer using alloca() instead, yes?


More information about the freebsd-current mailing list