/* We follow bash for the character set. Different shells have different rules. */
#define VALID_BASH_ENV_NAME_CHARS \
- DIGITS LETTERS \
+ ALPHANUMERICAL \
"_"
size_t sc_arg_max(void) {
if (isempty(id))
return false;
- return id[strspn(id, LETTERS DIGITS)] == '\0';
+ return in_charset(id, ALPHANUMERICAL);
}
bool logind_running(void) {
/* Characters valid in a unit name. */
#define VALID_CHARS \
- DIGITS \
- LETTERS \
+ ALPHANUMERICAL \
":-_.\\"
/* The same, but also permits the single @ character that may appear */
#include "varlink-util.h"
#include "virt.h"
-#define VALID_DEPLOYMENT_CHARS (DIGITS LETTERS "-.:")
+#define VALID_DEPLOYMENT_CHARS (ALPHANUMERICAL "-.:")
/* Properties we cache are indexed by an enum, to make invalidation easy and systematic (as we can iterate
* through them all, and they are uniformly strings). */
* [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}
*/
- if (!strchr(LETTERS DIGITS "_", n[0]))
+ if (!strchr(ALPHANUMERICAL "_", n[0]))
return false;
- size_t l = strspn(n + 1, LETTERS DIGITS "._-");
+ size_t l = strspn(n + 1, ALPHANUMERICAL "._-");
if (l > 126)
return false;
if (n[1+l] != 0)
char *p = t;
for (; s && *s; s++) {
- if (strchr(LETTERS DIGITS ".-_", *s))
+ if (strchr(ALPHANUMERICAL ".-_", *s))
*(p++) = *s;
else {
*(p++) = '%';
/* A slightly reduced version of what's permitted in unit names. With ':' and '\' are removed, as well as '_'
* which we use as delimiter for the second part of the image string, which we ignore for now. */
- if (!in_charset(name, DIGITS LETTERS "-."))
+ if (!in_charset(name, ALPHANUMERICAL "-."))
return -EINVAL;
if (!filename_is_valid(name))