enforce maxlength in usernames (was: [PATCH] enforce maxlenght in usernames)
Lauri Kasanen
curaga at operamail.com
Thu Jul 28 05:33:10 UTC 2011
> Hi,
> Could this be more acceptable. Could be improved by removing
> the double strlen also the error message could be better.
> Just to see if I overlooked something obvious.
>
> Ciao,
> Tito
>
> void FAST_FUNC die_if_bad_username(const char *name)
> {
> /* Enforce length limits on usernames.
> * LOGIN_NAME_MAX: Maximum length of a login name,
> * including the terminating null byte.
> * Must not be less than _POSIX_LOGIN_NAME_MAX (9).
> */
> if (!name
> || strlen(name) + 1 > sysconf(_SC_LOGIN_NAME_MAX)
> || strlen(name) + 1 < _POSIX_LOGIN_NAME_MAX
That is no minimum, it's a minimum of the maximum. Consider names like
"root", "lp".
- Lauri
--
http://www.fastmail.fm - Does exactly what it says on the tin
More information about the busybox
mailing list