summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-22 23:27:38 -0300
committerLennart Poettering <lennart@poettering.net>2013-04-22 23:27:38 -0300
commitbc7f3beb3090716d12406e2bfdba1df0e9d4b333 (patch)
tree06accfbfe7925dcea65cd2e85809b24fd38fc5c3 /src/libsystemd-bus/bus-message.c
parentae018d9bc900d6355dea4af05119b49c67945184 (diff)
bus: parse owner uid from cgroup path, too
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 8134d77f36..f0de7a32fb 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -861,6 +861,17 @@ int sd_bus_message_get_session(sd_bus_message *m, const char **ret) {
return 0;
}
+int sd_bus_message_get_owner_uid(sd_bus_message *m, uid_t *uid) {
+ if (!m)
+ return -EINVAL;
+ if (!uid)
+ return -EINVAL;
+ if (!m->cgroup)
+ return -ESRCH;
+
+ return cg_path_get_owner_uid(m->cgroup, uid);
+}
+
int sd_bus_message_get_cmdline(sd_bus_message *m, char ***cmdline) {
size_t n, i;
const char *p;
@@ -3073,6 +3084,7 @@ int bus_message_dump(sd_bus_message *m) {
char **cmdline = NULL;
unsigned level = 1;
int r;
+ uid_t owner;
assert(m);
@@ -3149,6 +3161,8 @@ int bus_message_dump(sd_bus_message *m) {
sd_bus_message_get_session(m, &s);
if (s)
printf("\tsession=[%s]\n", s);
+ if (sd_bus_message_get_owner_uid(m, &owner) >= 0)
+ printf("\towner_uid=%lu\n", (unsigned long) owner);
if (sd_bus_message_get_cmdline(m, &cmdline) >= 0) {
char **c;