Skip to content

Commit

Permalink
lib/chkname.c: Update regex for valid names
Browse files Browse the repository at this point in the history
The maximum length of 32 wasn't being enforced in the code, and POSIX
doesn't specify that maximum length either, so it seems it was an
arbitrary limit of the past that doesn't exist any more.  Use a regex
that has no length limit.

Closes: <#836>
Link: <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html>
Cc: Iker Pedrosa <[email protected]>
Cc: Mike Frysinger <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Nov 26, 2023
1 parent fe62fc4 commit a5cddf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/chkname.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static bool is_valid_name (const char *name)
}

/*
* User/group names must match gnu e-regex:
* [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
* User/group names must match BRE regex:
* [a-zA-Z0-9_.][a-zA-Z0-9_.-]*$\?
*
* as a non-POSIX, extension, allow "$" as the last char for
* sake of Samba 3.x "add machine script"
Expand Down

0 comments on commit a5cddf2

Please sign in to comment.