summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-25 13:22:55 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-25 14:28:34 +0100
commit6dfcc64bb5c67ec2e026715146c19acf93dab31a (patch)
treed8dc8ad019a5a7b120538d32ccf319743d10368c /src/libsystemd
parenta6ede528c478177821423f1e61e625030a6602c0 (diff)
sd-bus: properly handle non-initialized audit records attached to incoming kernel messages
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index e66a263c48..a8adb9c565 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -628,9 +628,15 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
break;
case KDBUS_ITEM_AUDIT:
- m->creds.audit_session_id = (uint32_t) d->audit.sessionid;
- m->creds.audit_login_uid = (uid_t) d->audit.loginuid;
- m->creds.mask |= (SD_BUS_CREDS_AUDIT_SESSION_ID|SD_BUS_CREDS_AUDIT_LOGIN_UID) & bus->creds_mask;
+ if ((uint32_t) d->audit.sessionid != (uint32_t) -1) {
+ m->creds.audit_session_id = (uint32_t) d->audit.sessionid;
+ m->creds.mask |= SD_BUS_CREDS_AUDIT_SESSION_ID & bus->creds_mask;
+ }
+
+ if ((uid_t) d->audit.loginuid != (uid_t) -1) {
+ m->creds.audit_login_uid = (uid_t) d->audit.loginuid;
+ m->creds.mask |= SD_BUS_CREDS_AUDIT_LOGIN_UID & bus->creds_mask;
+ }
break;
case KDBUS_ITEM_CAPS: