[systemd-commits] 3 commits - TODO src/login src/machine

Lennart Poettering lennart at kemper.freedesktop.org
Wed May 21 18:36:26 PDT 2014


 TODO                       |    7 ++---
 src/login/logind-session.c |   54 +++++++++++++++++++++++++++++++++++++--------
 src/machine/machine.c      |   37 +++++++++++++++++++++++++-----
 3 files changed, 79 insertions(+), 19 deletions(-)

New commits:
commit 558c6490b1df7f82a63d0a747fda7412c4d28b0c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu May 22 10:35:28 2014 +0900

    logind: also escape external data when saving to /run
    
    Better be safe than sorry...

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 9a54101..fdeacb1 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -213,7 +213,6 @@ int session_save(Session *s) {
 
         if (s->scope)
                 fprintf(f, "SCOPE=%s\n", s->scope);
-
         if (s->scope_job)
                 fprintf(f, "SCOPE_JOB=%s\n", s->scope_job);
 
@@ -229,17 +228,54 @@ int session_save(Session *s) {
         if (s->display)
                 fprintf(f, "DISPLAY=%s\n", s->display);
 
-        if (s->remote_host)
-                fprintf(f, "REMOTE_HOST=%s\n", s->remote_host);
+        if (s->remote_host) {
+                _cleanup_free_ char *escaped;
+
+                escaped = cescape(s->remote_host);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                fprintf(f, "REMOTE_HOST=%s\n", escaped);
+        }
+
+        if (s->remote_user) {
+                _cleanup_free_ char *escaped;
+
+                escaped = cescape(s->remote_user);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                fprintf(f, "REMOTE_USER=%s\n", escaped);
+        }
+
+        if (s->service) {
+                _cleanup_free_ char *escaped;
 
-        if (s->remote_user)
-                fprintf(f, "REMOTE_USER=%s\n", s->remote_user);
+                escaped = cescape(s->service);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                fprintf(f, "SERVICE=%s\n", escaped);
+        }
 
-        if (s->service)
-                fprintf(f, "SERVICE=%s\n", s->service);
+        if (s->desktop) {
+                _cleanup_free_ char *escaped;
 
-        if (s->desktop)
-                fprintf(f, "DESKTOP=%s\n", s->desktop);
+
+                escaped = cescape(s->desktop);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                fprintf(f, "DESKTOP=%s\n", escaped);
+        }
 
         if (s->seat && seat_has_vts(s->seat))
                 fprintf(f, "VTNR=%u\n", s->vtnr);

commit eaa3b74dfd6395c8abaa8416d90dac5e0dc00e15
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu May 22 10:27:17 2014 +0900

    update TODO

diff --git a/TODO b/TODO
index 2aff98e..7e59b33 100644
--- a/TODO
+++ b/TODO
@@ -30,9 +30,10 @@ External:
 
 Features:
 
+* tmpfiles: figure out relation between Z and m?
+
 * systemd-notify: fake ucred of msg to PID of parent, if that works, with fallback to our own if it doesn't.
 
-* machined: make sure we can restart machined without losing machines
 * machined/machinectl: sort IP addresses we return by scope and protocol
 * machined: write NSS module for looking up IP addresses for machines
 
@@ -55,14 +56,12 @@ Features:
 
 * mount_cgroup_controllers(): symlinks need to get the label applied
 
-* For timer units: add some mechanisms so that timer units that trigger immediately on boot do not have the services they run added to the initial transaction and thus confuse Type=idle. Alternatively, split up the boot-up state into two, and make Type=idle only be affected by jobs for the default target, but ignore any further jobs
+* For timer units: add some mechanisms so that timer units that trigger immediately on boot do not have the services they run added to the initial transaction and thus confuse Type=idle.
 
 * Add RPM macros for registering/unregistering binfmt drop-ins
 
 * Add timeout to early-boot, and shut down the system if it is hit. Solves the laptop-in-bag problem and is useful for embedded cases
 
-* sd-resolve: add callback api
-
 * ImmutableSystem=yes/no or so to mount /usr, /boot read-only/invisible, and leave /var and /etc writable
 
 * InaccessibleHome=yes/no or so to hide /home and /run/user from a service

commit ca5405bb4fb1fabd1fe43e4ee23edf58914bdfae
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu May 22 10:26:23 2014 +0900

    machine: escape fields we store in /run, so that they can be properly unescaped by parse_env_file()

diff --git a/src/machine/machine.c b/src/machine/machine.c
index 1164ce8..a49cf81 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -123,17 +123,42 @@ int machine_save(Machine *m) {
                 "NAME=%s\n",
                 m->name);
 
-        if (m->unit)
-                fprintf(f, "SCOPE=%s\n", m->unit); /* We continue to call this "SCOPE=" because it is internal only, and we want to stay compatible with old files */
+        if (m->unit) {
+                _cleanup_free_ char *escaped;
+
+                escaped = cescape(m->unit);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                fprintf(f, "SCOPE=%s\n", escaped); /* We continue to call this "SCOPE=" because it is internal only, and we want to stay compatible with old files */
+        }
 
         if (m->scope_job)
                 fprintf(f, "SCOPE_JOB=%s\n", m->scope_job);
 
-        if (m->service)
-                fprintf(f, "SERVICE=%s\n", m->service);
+        if (m->service) {
+                _cleanup_free_ char *escaped;
 
-        if (m->root_directory)
-                fprintf(f, "ROOT=%s\n", m->root_directory);
+                escaped = cescape(m->service);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+                fprintf(f, "SERVICE=%s\n", escaped);
+        }
+
+        if (m->root_directory) {
+                _cleanup_free_ char *escaped;
+
+                escaped = cescape(m->root_directory);
+                if (!escaped) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+                fprintf(f, "ROOT=%s\n", escaped);
+        }
 
         if (!sd_id128_equal(m->id, SD_ID128_NULL))
                 fprintf(f, "ID=" SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(m->id));



More information about the systemd-commits mailing list