mirror of
https://github.com/systemd/systemd.git
synced 2026-08-05 07:30:30 +00:00
core: rework unit name validation and manipulation logic
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
This commit is contained in:
@@ -41,9 +41,9 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
|
||||
else {
|
||||
char *n;
|
||||
|
||||
n = unit_name_mangle(value, MANGLE_NOGLOB);
|
||||
if (!n)
|
||||
return log_oom();
|
||||
r = unit_name_mangle(value, UNIT_NAME_NOGLOB, &n);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to glob unit name: %m");
|
||||
|
||||
r = strv_consume(&arg_mask, n);
|
||||
if (r < 0)
|
||||
@@ -57,9 +57,9 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
|
||||
else {
|
||||
char *n;
|
||||
|
||||
n = unit_name_mangle(value, MANGLE_NOGLOB);
|
||||
if (!n)
|
||||
return log_oom();
|
||||
r = unit_name_mangle(value, UNIT_NAME_NOGLOB, &n);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to glob unit name: %m");
|
||||
|
||||
r = strv_consume(&arg_wants, n);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user