summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-25 01:59:48 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-25 14:28:34 +0100
commitbecca6eaafa8ad7771363099f55b8a7dde516f21 (patch)
tree04818faecf6cc67b73a27bc7bedb0ebd47c61160 /src
parent359c09b1c1afa5a5ed4002940d7d6e61b74b7e3b (diff)
sd-bus: properly handle uninitialized audit creds from kdbus
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index b887d32579..0027ad36c4 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -556,12 +556,14 @@ static int bus_populate_creds_from_items(sd_bus *bus,
break;
case KDBUS_ITEM_AUDIT:
- m = (SD_BUS_CREDS_AUDIT_SESSION_ID | SD_BUS_CREDS_AUDIT_LOGIN_UID) & mask;
+ if (mask & SD_BUS_CREDS_AUDIT_SESSION_ID && (uint32_t) item->audit.sessionid != (uint32_t) -1) {
+ c->audit_session_id = (uint32_t) item->audit.sessionid;
+ c->mask |= SD_BUS_CREDS_AUDIT_SESSION_ID;
+ }
- if (m) {
- c->audit_session_id = item->audit.sessionid;
- c->audit_login_uid = item->audit.loginuid;
- c->mask |= m;
+ if (mask & SD_BUS_CREDS_AUDIT_LOGIN_UID && (uid_t) item->audit.loginuid != (uid_t) -1) {
+ c->audit_login_uid = (uid_t) item->audit.loginuid;
+ c->mask |= SD_BUS_CREDS_AUDIT_LOGIN_UID;
}
break;