sudo-rs
sudo-rs copied to clipboard
Allow '@' signs in user names
trafficstars
Closing #1064
I think we should be a bit more conform to what adduser (see man adduser.conf) allows here:
VALID NAMES
Historically, adduser(8) and addgroup(8) enforced conformity to IEEE Std 1003.1-2001, which allows only the following characters to ap‐
pear in group- and usernames: letters, digits, underscores, periods, at signs (@) and dashes. The name may not start with a dash or @.
The "$" sign is allowed at the end of usernames to allow typical Samba machine accounts.
The default settings for NAME_REGEX and SYS_NAME_REGEX allow usernames to contain lowercase letters and numbers, plus dash (-) and un‐
derscore (_); the name must begin with a letter (or an underscore for system users).
The least restrictive policy, available by using the --allow-all-names option, simply makes the same checks as useradd(8): cannot start
with a dash, plus sign, or tilde; and cannot contain a colon, comma, slash, or whitespace.
This option can be used to create confusing or misleading names; use it with caution.
Please note that regardless of the regular expressions used to evaluate the username, it may be a maximum of 32 bytes; this may be less
than 32 visual characters when using Unicode glyphs in the username.
Todo: add unit tests, add comment about $ being last.