summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-22 23:38:38 -0300
committerLennart Poettering <lennart@poettering.net>2013-04-22 23:38:38 -0300
commit120f919e708b49d58e4302c91d32d12917068ba3 (patch)
tree8dc36163cd0000238464aefcb2f7a6f2375a1e1f /src/libsystemd-bus/bus-message.c
parentbc7f3beb3090716d12406e2bfdba1df0e9d4b333 (diff)
bus: parse audit metadata from kdbus messages
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index f0de7a32fb..6b4a0f3432 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -904,6 +904,30 @@ int sd_bus_message_get_cmdline(sd_bus_message *m, char ***cmdline) {
return 0;
}
+int sd_bus_message_get_audit_sessionid(sd_bus_message *m, uint32_t *sessionid) {
+ if (!m)
+ return -EINVAL;
+ if (!sessionid)
+ return -EINVAL;
+ if (!m->audit)
+ return -ESRCH;
+
+ *sessionid = m->audit->sessionid;
+ return 0;
+}
+
+int sd_bus_message_get_audit_loginuid(sd_bus_message *m, uid_t *uid) {
+ if (!m)
+ return -EINVAL;
+ if (!uid)
+ return -EINVAL;
+ if (!m->audit)
+ return -ESRCH;
+
+ *uid = m->audit->loginuid;
+ return 0;
+}
+
int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const char *member) {
if (!m)
return -EINVAL;
@@ -3084,7 +3108,8 @@ int bus_message_dump(sd_bus_message *m) {
char **cmdline = NULL;
unsigned level = 1;
int r;
- uid_t owner;
+ uid_t owner, audit_loginuid;
+ uint32_t audit_sessionid;
assert(m);
@@ -3163,6 +3188,10 @@ int bus_message_dump(sd_bus_message *m) {
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_audit_loginuid(m, &audit_loginuid) >= 0)
+ printf("\taudit_loginuid=%lu\n", (unsigned long) audit_loginuid);
+ if (sd_bus_message_get_audit_sessionid(m, &audit_sessionid) >= 0)
+ printf("\taudit_sessionid=%lu\n", (unsigned long) audit_sessionid);
if (sd_bus_message_get_cmdline(m, &cmdline) >= 0) {
char **c;