Skip to content

Commit

Permalink
lib/chkname.c: is_valid_name(): Use ispfchar() to simplify
Browse files Browse the repository at this point in the history
In the first case, we can do the transformation because a few lines
above, we explicitly reject a name starting with a '-'.

In the second case, we're obviously using ispfchar() instead of its
pattern.

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Dec 23, 2024
1 parent e75e6c4 commit 2ff431a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/chkname.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ is_valid_name(const char *name)
* sake of Samba 3.x "add machine script"
*/

if (!(isalnum(*name) ||
*name == '_' ||
*name == '.'))
{
if (!ispfchar(*name)) {
errno = EILSEQ;
return false;
}
Expand All @@ -96,12 +93,7 @@ is_valid_name(const char *name)
if (streq(name, "$")) // Samba
return true;

if (!(isalnum(*name) ||
*name == '_' ||
*name == '.' ||
*name == '-'
))
{
if (!ispfchar(*name)) {
errno = EILSEQ;
return false;
}
Expand Down

0 comments on commit 2ff431a

Please sign in to comment.