]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
load-fragment: use UNESCAPE_RELAX flag to parse exec directives
authorDaniel Mack <daniel@zonque.org>
Mon, 1 Jun 2015 15:49:04 +0000 (17:49 +0200)
committerDaniel Mack <daniel@zonque.org>
Mon, 1 Jun 2015 16:08:44 +0000 (18:08 +0200)
The cunescape() helper function used to handle unknown escaping sequences
gracefully by copying them over verbatim.

Commit 527b7a42 ("util: rework cunescape(), improve error handling") added
a flag to make that behavior optional, and changed to default to error out
with -EINVAL otherwise.

However, config_parse_exec(), which is used to parse the
Exec{Start,Stop}{Post,Pre,} directives of unit files, was not changed along
with that commit, which means that directives with improperly escaped
command line strings are no longer parsed.

Relevant bugreports include:

  https://bugs.freedesktop.org/show_bug.cgi?id=90794
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787256

Fix this by passing UNESCAPE_RELAX to config_parse_exec() in order to
restore the original behavior.

src/core/load-fragment.c

index c95c11014c729b7dc309d3a3f8dbc04f4db3808f..df5fe6fb326367082add9dda2c7beee7ee2e9442 100644 (file)
@@ -610,7 +610,7 @@ int config_parse_exec(
                         else
                                 skip = strneq(word, "\\;", MAX(l, 1U));
 
-                        r = cunescape_length(word + skip, l - skip, 0, &c);
+                        r = cunescape_length(word + skip, l - skip, UNESCAPE_RELAX, &c);
                         if (r < 0) {
                                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to unescape command line, ignoring: %s", rvalue);
                                 r = 0;