summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-01 03:24:03 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-01 03:29:29 +0200
commit8411d2a2b15ec8020cd563162cf1b372d8c0319a (patch)
tree05438c6fd09f6bea4cc65207d699a13a3f256049 /src/libsystemd-bus/bus-socket.c
parent638866cbea2d95b3f65f3abc4ada240a94e64c3a (diff)
bus: ignore the passed UID on EXTERNAL auth if ANONYMOUS is allowed
Diffstat (limited to 'src/libsystemd-bus/bus-socket.c')
-rw-r--r--src/libsystemd-bus/bus-socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index b9ef7c0372..30e594243d 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -235,7 +235,7 @@ static int verify_external_token(sd_bus *b, const char *p, size_t l) {
* the owner of this bus wanted authentication he should have
* checked SO_PEERCRED before even creating the bus object. */
- if (!b->ucred_valid)
+ if (!b->anonymous_auth && !b->ucred_valid)
return 0;
if (l <= 0)
@@ -258,7 +258,9 @@ static int verify_external_token(sd_bus *b, const char *p, size_t l) {
if (r < 0)
return 0;
- if (u != b->ucred.uid)
+ /* We ignore the passed value if anonymous authentication is
+ * on anyway. */
+ if (!b->anonymous_auth && u != b->ucred.uid)
return 0;
return 1;