summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-06-04 09:24:01 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2020-06-04 10:09:15 +0200
commitf86ec804c9835b5ca12c4b74dadec55faeb1f34e (patch)
tree848b68aa642eca4d6d31e42ed2d4d6f2936ecdb7
parent22b66c9160ba7276c9872528ef0a03473fe3c6a6 (diff)
downloaddbus-f86ec804c9835b5ca12c4b74dadec55faeb1f34e.tar.gz
dbus-f86ec804c9835b5ca12c4b74dadec55faeb1f34e.tar.bz2
dbus-f86ec804c9835b5ca12c4b74dadec55faeb1f34e.zip
Check target name taken from message instead of org.freedesktop.DBus in case of no peer available. This is the case when activation is happening. Change-Id: I181edbb28a1b26ed79552bb6df8b00892d2ceac8
-rw-r--r--bus/policy.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bus/policy.c b/bus/policy.c
index 4ba7d6f3..53a6682d 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -918,6 +918,7 @@ typedef struct RuleParams {
BusRegistry *registry;
dbus_bool_t requested_reply;
DBusConnection *peer;
+ const char *name;
DBusMessage *message;
dbus_bool_t eavesdropping;
} sr;
@@ -1340,11 +1341,13 @@ find_and_check_rules (DBusHashTable *rules,
privilege, matched_rule);
}
}
- else
- score = find_and_check_rules_for_name (rules, DBUS_SERVICE_DBUS, score,
- check_func, params,
- toggles, log, result,
- privilege, matched_rule);
+ else if (p->u.sr.name != NULL)
+ {
+ score = find_and_check_rules_for_name (rules, p->u.sr.name, score,
+ check_func, params,
+ toggles, log, result,
+ privilege, matched_rule);
+ }
}
else
score = find_and_check_rules_for_name (rules, _dbus_string_get_data(p->u.name),
@@ -1446,6 +1449,7 @@ bus_client_policy_check_can_send (DBusConnection *sender,
params.u.sr.requested_reply = requested_reply;
params.u.sr.peer = receiver;
params.u.sr.message = message;
+ params.u.sr.name = dbus_message_get_destination (message);
_dbus_verbose (" (policy) checking send rules\n");
@@ -1704,6 +1708,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
params.u.sr.eavesdropping =
addressed_recipient != proposed_recipient &&
dbus_message_get_destination (message) != NULL;
+ params.u.sr.name = dbus_message_get_sender (message);
_dbus_verbose (" (policy) checking receive rules, eavesdropping = %d\n", eavesdropping);