mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user