After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766401 - User account creation fails with cryptic error if suggested username is too long
User account creation fails with cryptic error if suggested username is too long
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
3.20.x
Other Linux
: Normal minor
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-13 21:42 UTC by Michael Catanzaro
Modified: 2018-01-31 20:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot (10.17 KB, image/png)
2016-05-13 21:42 UTC, Michael Catanzaro
  Details
user-accounts: Do not suggest usernames that are too long (1.82 KB, patch)
2016-05-14 00:57 UTC, Michael Catanzaro
reviewed Details | Review
user-accounts: Do not suggest usernames that are too long (2.04 KB, patch)
2016-05-14 01:18 UTC, Michael Catanzaro
none Details | Review
user-accounts: Do not suggest usernames that are too long (1.47 KB, patch)
2016-05-17 01:35 UTC, Michael Catanzaro
committed Details | Review

Description Michael Catanzaro 2016-05-13 21:42:49 UTC
Created attachment 327832 [details]
Screenshot

User account creation fails with cryptic error if username is too long.
Comment 1 Michael Catanzaro 2016-05-14 00:54:49 UTC
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. :(
Comment 2 Michael Catanzaro 2016-05-14 00:57:13 UTC
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.
Comment 3 Michael Catanzaro 2016-05-14 01:18:12 UTC
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.
Comment 4 Matthias Clasen 2016-05-16 12:02:01 UTC
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.
Comment 5 Michael Catanzaro 2016-05-16 15:08:20 UTC
I filed https://github.com/shadow-maint/shadow/issues/20
Comment 6 Michael Catanzaro 2016-05-16 21:05:01 UTC
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.)
Comment 7 Michael Catanzaro 2016-05-17 01:09:38 UTC
OK, let's split this patch into two parts:

 (a) truncate the username properly, this bug
 (b) fix the definition of MAXNAMELEN, bug #724193
Comment 8 Michael Catanzaro 2016-05-17 01:35:40 UTC
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.
Comment 9 Michael Catanzaro 2016-12-29 18:15:10 UTC
Note that we're shipping this in Endless.
Comment 10 Ondrej Holy 2018-01-31 11:54:13 UTC
Review of attachment 328031 [details] [review]:

Thanks, looks ok though doesn't make much sense without Bug 724193.
Comment 11 Michael Catanzaro 2018-01-31 20:19:07 UTC
Attachment 328031 [details] pushed as 0344f66 - user-accounts: Do not suggest usernames that are too long