src/basic/capsule-util.c
raw| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | |
| 3 | #include "alloc-util.h" |
| 4 | #include "capsule-util.h" |
| 5 | #include "path-util.h" |
| 6 | #include "string-util.h" |
| 7 | #include "user-util.h" |
| 8 | |
| 9 | int capsule_name_is_valid(const char *name) { |
| 10 | |
| 11 | if (!filename_is_valid(name)) |
| 12 | return false; |
| 13 | |
| 14 | _cleanup_free_ char *prefixed = strjoin("c-", name); |
| 15 | if (!prefixed) |
| 16 | return -ENOMEM; |
| 17 | |
| 18 | return valid_user_group_name(prefixed, /* flags= */ 0); |
| 19 | } |