summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-kernel.c2
-rw-r--r--src/libsystemd-bus/bus-message.c31
-rw-r--r--src/libsystemd-bus/bus-message.h2
3 files changed, 34 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 115297dca4..42b16966bd 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -473,6 +473,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
m->cmdline_length = l;
} else if (d->type == KDBUS_MSG_SRC_CGROUP)
m->cgroup = d->str;
+ else if (d->type == KDBUS_MSG_SRC_AUDIT)
+ m->audit = &d->audit;
else
log_debug("Got unknown field from kernel %llu", d->type);
}
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;
diff --git a/src/libsystemd-bus/bus-message.h b/src/libsystemd-bus/bus-message.h
index 9440bbebb4..66b434816c 100644
--- a/src/libsystemd-bus/bus-message.h
+++ b/src/libsystemd-bus/bus-message.h
@@ -119,6 +119,8 @@ struct sd_bus_message {
char *session;
char *unit;
char *user_unit;
+
+ struct kdbus_audit *audit;
};
#define BUS_MESSAGE_NEED_BSWAP(m) ((m)->header->endian != SD_BUS_NATIVE_ENDIAN)