Hi, the useradd documentation says that a user name has a 32 character limit. We should enforce this as well. In useradd, this seems to apply to the UTF-8 representation of the user name, that is, aaääääääääääääääää (two unaccented and 16 accented characters) is too long while aaäääääääääääääää (two unaccented and 15 accented characters) is not. So putting this restriction inside our regular expressions is not going to help. Maybe it's just ok to let useradd enforce this? Currently this seems to work ok, but it looks like a train wreck: root@salida-unstable-buildd-amd64-ydvv:/srv# adduser --system abcdefghijabcdefghijabcdefghijabc Adding system user `abcdefghijabcdefghijabcdefghijabc' (UID 101) ... Adding new user `abcdefghijabcdefghijabcdefghijabc' (UID 101) with group `nogroup' ... useradd: invalid user name 'abcdefghijabcdefghijabcdefghijabc': use --badname to ignore adduser: `/usr/sbin/useradd -r -K SYS_UID_MIN=100 -K SYS_UID_MAX=999 -d /home/abcdefghijabcdefghijabcdefghijabc -g nogroup -s /usr/sbin/nologin -u 101 abcdefghijabcdefghijabcdefghijabc' returned error code 3. Exiting. root@salida-unstable-buildd-amd64-ydvv:/srv# adduser --system abcdefghijabcdefghijabcdefghijab Adding system user `abcdefghijabcdefghijabcdefghijab' (UID 101) ... Adding new user `abcdefghijabcdefghijabcdefghijab' (UID 101) with group `nogroup' ... Creating home directory `/home/abcdefghijabcdefghijabcdefghijab' ... Greetings Marc
Hi, Matt, would you want to take a quick plunge at this as well? You're still deeply acquained with the entire name checking stuff anyway. Greetings Marc
Sure. There actually is a test for this, and it passes (ie. fails in every instance, for a 33 character name) - I think because useradd fails? We might as well check it though, I'll take a look. mb
If we are ok with erroring out with a useradd error message, and the output is not offensively ugly, I'm fine with that, and we can just close this bug as fixed in 3.122. I am not emotional about this. Greetings Marc
Does it also fail reasonably prettily for a < 32 character UTF-8 name that is > 32 bytes when encoded? Greetings Marc
(new patch)
/h/d/adduser $ sudo adduser фффффффффффффффффффффффф
adduser: Usernames must be no more than 32 bytes in length;
note that if you are using Unicode characters, the
character
limit will be less than 32.
In the 3.121, the IEEE check will squash it.
In 3.22:
~/h/d/adduser $ sudo adduser фффффффффффффффффффффффф --allow-all-names
Allowing use of questionable username.
Adding user `фффффффффффффффффффффффф' ...
Adding new group `фффффффффффффффффффффффф' (1023) ...
groupadd: 'фффффффффффффффффффффффф' is not a valid group name
adduser: `/sbin/groupadd -g 1023 фффффффффффффффффффффффф' returned
error code 3. Exiting.
so, not ideal, but it does error.
I would apply that patch at some point; it isn't urgent, but it is cleaner.
Version: 3.122 Agreed. Closing this bug with 3.122. Greetings Marc, waiting for the last cat to come home before going to bed
We believe that the bug you reported is fixed in the latest version of
adduser, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1014450@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Marc Haber <mh+debian-packages@zugschlus.de> (supplier of updated adduser package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 21 Jul 2022 08:10:13 +0200
Source: adduser
Architecture: source
Version: 3.123
Distribution: unstable
Urgency: medium
Maintainer: Debian Adduser Developers <adduser@packages.debian.org>
Changed-By: Marc Haber <mh+debian-packages@zugschlus.de>
Closes: 1014450 1014901
Changes:
adduser (3.123) unstable; urgency=medium
.
[ Marc Haber ]
* flip default for DIR_MODE to 0700 again.
Thanks to Josh Triplett (Closes: #1014901)
* add debian.NEWS entry to document the DIR_MODE change
* remove superficial examples/adduser.local.conf.examples/adduser.conf
.
[ Matt Barry ]
* Check explicitly for <= 32 byte names. (Closes: #1014450)
Checksums-Sha1:
b47cbb933182d7efa366aa512ddbf7a52fad8b8a 1683 adduser_3.123.dsc
97ec8e8a5a57d830bb9feffa7bfdfb80e68d87a8 231624 adduser_3.123.tar.xz
f7f15bf52927702d31e40012a723ca5ea7744e60 5697 adduser_3.123_source.buildinfo
Checksums-Sha256:
cf3508f50a329b1a892d5d1fb1bb87c4a66ab8b4958b81d34723d6cb45a188d5 1683 adduser_3.123.dsc
e1befb7845dcfb240946e1016ca44c82f80fa9672ed44f2f22ab97dd4a0f5af4 231624 adduser_3.123.tar.xz
c5f6dc4deccafed81db379b35a83536670d3f0116a670038d4f04fc0faaff27e 5697 adduser_3.123_source.buildinfo
Files:
c2ac6c6ea1f9fde1ebf6994a81023b8b 1683 admin important adduser_3.123.dsc
4f19886b30edbb2b97b6f7558a6bd742 231624 admin important adduser_3.123.tar.xz
65796ea828a6f9cf5d0d7bced4b8fbdc 5697 admin important adduser_3.123_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE6QL5UJ/L0pcuNEbjj3cgEwEyBEIFAmLY7roACgkQj3cgEwEy
BEJiFhAAp/bivlRUgL02T1fhl9tdG2+ZszOGvITkIZzC+7Gm0qs2vAPUiLGVwCXl
xsgZ0yGI6QouPG8vkcfSaXxnmB4Y5FJNdyiPzOhC107SUUxOQ/olqwi5Z2CzrJ/P
nWQtoPA3Rcum4UhNRrtu1dE0M5CFLn8vgaYKzLPYfxP/auKHui3JOAidSB/5opv2
d3hpYl+VePsdkCGJTMEJ5Znf5TJGXXjNIpVk4Nokv9KSejVacIrknCrj/hTdVYAe
7/c3qn0fNPmDSVGfqK5BNi0nHYZ611Cj7LqBHJWVmpJIFv60B8W+n+tP2bW7LgSc
Nh013nyUF16h7mXOlUPW7GYFRtBDbhSG0N4u2Dsojj3oq5dnj7swA+o9vPlQGy7m
SquZ2eWkD6DkWqnHYC/JXjbXvF+MtvyzouTS+hg1nefCTFgLSe4+FjlVsHH17bfM
e0gAnCpVc6HFG6Oei/wRhicdDpQs/9qU/KjPVPjvIxqeCvsKp3XR3BmWUr7EgSp0
hTcYT2pFUXnzF2LTlF39Xn2eVmsrQiEINBxwmE8C4Sqz6pYY4tnxhfevj09xmy5b
20RM7ji6LfD4T22jOvvE4SSU7Wntu9XWoRvc0DDUm2WuUHPR8+hK/ReIDX1TAQwz
Zbr1S8Spk20gJTHelnEdpG7TrFll84wxirN98XMeczVFVAaqPjs=
=Tsmt
-----END PGP SIGNATURE-----