summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-22 18:45:38 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-22 18:51:49 +0100
commit2578d51ebd40ae0a8c6343164334358384dd55f7 (patch)
tree9a1b8fa0f02d392cd0ec47b76d860fc9cfc854f8 /src/libsystemd/sd-bus
parent5a72317435a39f23520b42731e53bd13d20f489e (diff)
bus: unescape connection name when reading it from credentials
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c10
-rw-r--r--src/libsystemd/sd-bus/bus-creds.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 85509e8819..677e94b3ba 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -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;
}
diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h
index df33d34b65..81b852a596 100644
--- a/src/libsystemd/sd-bus/bus-creds.h
+++ b/src/libsystemd/sd-bus/bus-creds.h
@@ -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);