core: restrict ImportCredential= globbing

Let's restrict how we apply credential globbing in ImportCredential=, so
that we have some flexibility in automatically extending the glob
expression with per-instance data eventually without getting into
conflict with the globbing parts.

In our current uses we only allow globbing at the end of the expression,
and this is a new, unreleased feature hence let's be restrictive on this
initially. We can still relax this later if we feel the need to after
all.

Fixes: #28022
This commit is contained in:
Lennart Poettering
2023-06-22 16:07:09 +02:00
parent 54c0ba3409
commit 947c4d3952
6 changed files with 96 additions and 4 deletions
+2 -2
View File
@@ -2355,8 +2355,8 @@ int bus_exec_context_set_transient_property(
if (r == 0)
break;
if (!filename_is_valid(s))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential name is invalid: %s", s);
if (!credential_glob_valid(s))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential name or glob is invalid: %s", s);
isempty = false;