]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bus-proxy: discard invalid environment updates 858/head
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 4 Aug 2015 11:36:03 +0000 (13:36 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 4 Aug 2015 11:38:40 +0000 (13:38 +0200)
If the caller provides invalid assignments via
UpdateActivationEnvironment=, we now drop it and warn loudly about it. We
need this to be compatible to dbus1, but we also clearly want to tell the
caller that they better ought to follow POSIX recommendations and use
valid labels only.

Fixes #826.

src/bus-proxyd/driver.c

index 951f5158087906f6efe6ada3406ded656d4b3d5c..fa4aee691a53b5d8fafa1ebb40b42ee14e17cfb7 100644 (file)
@@ -35,6 +35,7 @@
 #include "driver.h"
 #include "proxy.h"
 #include "synthesize.h"
+#include "env-util.h"
 
 static int get_creds_by_name(sd_bus *bus, const char *name, uint64_t mask, sd_bus_creds **_creds, sd_bus_error *error) {
         _cleanup_bus_creds_unref_ sd_bus_creds *c = NULL;
@@ -694,9 +695,13 @@ int bus_proxy_process_driver(Proxy *p, sd_bus *a, sd_bus *b, sd_bus_message *m,
                         if (!s)
                                 return synthetic_reply_method_errno(m, -ENOMEM, NULL);
 
-                        r  = strv_extend(&args, s);
-                        if (r < 0)
-                                return synthetic_reply_method_errno(m, r, NULL);
+                        if (!env_assignment_is_valid(s)) {
+                                log_warning("UpdateActivationEnvironment() called with invalid assignment, discarding: %s", s);
+                        } else {
+                                r = strv_extend(&args, s);
+                                if (r < 0)
+                                        return synthetic_reply_method_errno(m, r, NULL);
+                        }
 
                         r = sd_bus_message_exit_container(m);
                         if (r < 0)