chiark / gitweb /
bus: unescape connection name when reading it from credentials
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 17:45:38 +0000 (18:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 17:51:49 +0000 (18:51 +0100)
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-creds.h

index 85509e8..677e94b 100644 (file)
@@ -48,6 +48,7 @@ void bus_creds_done(sd_bus_creds *c) {
         free(c->unit);
         free(c->user_unit);
         free(c->slice);
+        free(c->unescaped_conn_name);
 
         strv_free(c->cmdline_array);
         strv_free(c->well_known_names);
@@ -471,7 +472,14 @@ _public_ int sd_bus_creds_get_connection_name(sd_bus_creds *c, const char **ret)
                 return -ENODATA;
 
         assert(c->conn_name);
-        *ret = c->conn_name;
+
+        if (!c->unescaped_conn_name) {
+                c->unescaped_conn_name = sd_bus_label_unescape(c->conn_name);
+                if (!c->unescaped_conn_name)
+                        return -ENOMEM;
+        }
+
+        *ret = c->unescaped_conn_name;
         return 0;
 }
 
index df33d34..81b852a 100644 (file)
@@ -65,7 +65,7 @@ struct sd_bus_creds {
 
         char *cgroup_root;
 
-        char *conn_name;
+        char *conn_name, *unescaped_conn_name;
 };
 
 sd_bus_creds* bus_creds_new(void);