mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
udev: replace unsafe characters on assigning ENV{key}="val" when OPTIONS="string_escape=replace" is set
Strictly speaking, this breaks backward compatibility, as previously `ENV{key}="val"` ignored `string_escape=` option. But, introducing a new option such as `string_escape=hoge` sounds overkill for me. The default escape mode is `ESCAPE_UNSET`, so I hope this merely break existing rules.
This commit is contained in:
parent
51c2f543d1
commit
ea0f4578a7
@ -2024,6 +2024,12 @@ static int udev_rule_apply_token_to_event(
|
||||
l = strpcpyl(&p, l, val, " ", NULL);
|
||||
|
||||
(void) udev_event_apply_format(event, token->value, p, l, false);
|
||||
if (event->esc == ESCAPE_REPLACE) {
|
||||
count = udev_replace_chars(buf, NULL);
|
||||
if (count > 0)
|
||||
log_rule_debug(dev, rules, "Replaced %zu slash(es) from result of ENV{%s}%s=\"%s\"",
|
||||
count, name, token->op == OP_ADD ? "+" : "", token->value);
|
||||
}
|
||||
|
||||
r = device_add_property(dev, name, value_new);
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user