From 2ff431ab1b46a25088fe40baf1faf35ea9fac722 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 23 Dec 2024 18:41:06 +0100 Subject: [PATCH] lib/chkname.c: is_valid_name(): Use ispfchar() to simplify 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 --- lib/chkname.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/chkname.c b/lib/chkname.c index 9e01e62dc..5ed72789d 100644 --- a/lib/chkname.c +++ b/lib/chkname.c @@ -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; } @@ -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; }