diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-12 01:45:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-12 01:45:18 +0200 |
commit | f9be01f3b4784affa269694a4f5cdcb87f06f2f7 (patch) | |
tree | 7518d4e42dba9dba5bb6663a3a4bb7a1c17cd824 /src/libsystemd-bus/bus-kernel.c | |
parent | e9a967f9a0e9b2bf705a776c34635e6d1df73f1b (diff) |
bus: parse uid/gid/pid/tid meta data from kdbus messages
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index 712b697b0a..83379d1430 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -224,6 +224,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess _cleanup_free_ int *fds = NULL; struct bus_header *h = NULL; size_t total, n_bytes = 0, idx = 0; + struct kdbus_creds *creds = NULL; int r; assert(bus); @@ -262,7 +263,9 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess fds = f; memcpy(fds + n_fds, d->fds, j); n_fds += j; - } + + } else if (d->type == KDBUS_MSG_SRC_CREDS) + creds = &d->creds; } if (!h) @@ -301,6 +304,14 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess idx += l; } + if (creds) { + m->uid = creds->uid; + m->gid = creds->gid; + m->pid = creds->pid; + m->tid = creds->tid; + m->uid_valid = m->gid_valid = true; + } + r = bus_message_parse_fields(m); if (r < 0) { sd_bus_message_unref(m); |