GNOME Bugzilla – Bug 766401
User account creation fails with cryptic error if suggested username is too long
Last modified: 2018-01-31 20:19:16 UTC
Created attachment 327832 [details] Screenshot User account creation fails with cryptic error if username is too long.
Turns out that we do validate the length of the username when the user types it, so we do not need to limit the number of characters typed into the entry. We just need to make sure that we never populate the entry with bogus usernames. Also there is a really inconvenient issue in that MAXNAMELEN is broken. :(
Created attachment 327841 [details] [review] user-accounts: Do not suggest usernames that are too long We assume that we only generate valid usernames, so make sure they're short enough to be used, else we'll display a dialog with a meaningless error message when useradd fails.
Created attachment 327844 [details] [review] user-accounts: Do not suggest usernames that are too long We assume that we only generate valid usernames, so make sure they're short enough to be used, else we'll display a dialog with a meaningless error message when useradd fails.
Review of attachment 327841 [details] [review]: ::: panels/user-accounts/um-utils.c @@ +470,1 @@ #else Why is this ifdef here in the first place ? Seems wrong to me. Also, we should have a bug filed against shadow-utils.
I filed https://github.com/shadow-maint/shadow/issues/20
Comment on attachment 327844 [details] [review] user-accounts: Do not suggest usernames that are too long (Marking this obsolete so it doesn't accidentally get committed. If we're going to hardcode 32, we should probably not be checking LOGIN_NAME_MAX or sysconf at all.)
OK, let's split this patch into two parts: (a) truncate the username properly, this bug (b) fix the definition of MAXNAMELEN, bug #724193
Created attachment 328031 [details] [review] user-accounts: Do not suggest usernames that are too long We assume that we only generate valid usernames, so make sure they're short enough to be used, else we'll display a dialog with a meaningless error message when useradd fails. Note that this commit doesn't completely fix the bug, as our definition of MAXNAMELEN isn't different from useradd's.
Note that we're shipping this in Endless.
Review of attachment 328031 [details] [review]: Thanks, looks ok though doesn't make much sense without Bug 724193.
Attachment 328031 [details] pushed as 0344f66 - user-accounts: Do not suggest usernames that are too long