Configurable buffer size for getpwnam() and getgrnam()

Ricard Wanderlof ricard.wanderlof at axis.com
Tue Dec 19 07:55:49 UTC 2006


On Fri, 8 Dec 2006, Bernhard Fischer wrote:

> Without having looked at the code's requirements, i'd use range 32 65535
> for a start. Would have to check if a lower bound of 6 or 8 would be
> appropriate.

The buffers are character buffers, so there aren't really any technical 
limitations. I tried a few random buffer sizes from 1 to 123456 which all 
work, however, really small buffer sizes (< 90) result in limitations in 
the length of user and group names, and things like the the login 
directory path name. E.g., setting the buffer size to 1 results in the 
inability to log in. However, on a system where you don't need users or 
groups, this is perfectly acceptable. (Although I'd be the first to admit 
that if you want to remove this functionality it'd be better to remove the 
corresponding code entirely).

Large sizes don't really add anything unless you've got extremely 
user/group and/or path names.

My suggestion would be to not add any hard limits - after all, those who 
change this parameter will probably know what they're doing, and setting 
odd sizes doesn't cause segfaultingr or other abnormal behavior. However 
perhaps something in the help text describing useful buffer sizes would be 
helpful.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the uClibc mailing list