summaryrefslogtreecommitdiff
path: root/bus/policy.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-08-20 14:48:04 +0000
committerHavoc Pennington <hp@redhat.com>2003-08-20 14:48:04 +0000
commitd0c588575e3e2911eacb098fac26f02d1010cbfd (patch)
treeae33b122f0e28611117ad1d8f90c2611c3f99041 /bus/policy.c
parent68a3c593b9e77b33614726363c7b6fd85d113021 (diff)
downloaddbus-d0c588575e3e2911eacb098fac26f02d1010cbfd.tar.gz
2003-08-19 Havoc Pennington <hp@pobox.com>
* dbus/dbus-message.c (decode_string_field): support FIELD_SENDER (dbus_message_is_error): fix this function * bus/dbus-daemon-1.1: clarify logic on when <deny>/<allow> rules match * bus/policy.c (bus_client_policy_check_can_receive): fix code to reflect clarified man page (bus_client_policy_check_can_send): ditto * bus/session.conf.in: fixup * bus/system.conf.in: fixup
Diffstat (limited to 'bus/policy.c')
-rw-r--r--bus/policy.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/bus/policy.c b/bus/policy.c
index 04ea4230..f7978c05 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -801,7 +801,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
if (rule->d.send.interface != NULL)
{
- if (dbus_message_get_interface (message) == NULL ||
+ if (dbus_message_get_interface (message) != NULL &&
strcmp (dbus_message_get_interface (message),
rule->d.send.interface) != 0)
{
@@ -809,9 +809,10 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
continue;
}
}
- else if (rule->d.send.member != NULL)
+
+ if (rule->d.send.member != NULL)
{
- if (dbus_message_get_member (message) == NULL ||
+ if (dbus_message_get_member (message) != NULL &&
strcmp (dbus_message_get_member (message),
rule->d.send.member) != 0)
{
@@ -819,9 +820,10 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
continue;
}
}
- else if (rule->d.send.error != NULL)
+
+ if (rule->d.send.error != NULL)
{
- if (dbus_message_get_error_name (message) == NULL ||
+ if (dbus_message_get_error_name (message) != NULL &&
strcmp (dbus_message_get_error_name (message),
rule->d.send.error) != 0)
{
@@ -902,32 +904,28 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
{
BusPolicyRule *rule = link->data;
- link = _dbus_list_get_next_link (&policy->rules, link);
-
- /* Rule is skipped if it specifies a different
- * message name from the message, or a different
- * origin from the message
- */
+ link = _dbus_list_get_next_link (&policy->rules, link);
if (rule->type != BUS_POLICY_RULE_RECEIVE)
{
_dbus_verbose (" (policy) skipping non-receive rule\n");
continue;
}
-
+
if (rule->d.receive.interface != NULL)
{
- if (dbus_message_get_interface (message) == NULL ||
+ if (dbus_message_get_interface (message) != NULL &&
strcmp (dbus_message_get_interface (message),
rule->d.receive.interface) != 0)
{
_dbus_verbose (" (policy) skipping rule for different interface\n");
continue;
}
- }
- else if (rule->d.receive.member != NULL)
+ }
+
+ if (rule->d.receive.member != NULL)
{
- if (dbus_message_get_member (message) == NULL ||
+ if (dbus_message_get_member (message) != NULL &&
strcmp (dbus_message_get_member (message),
rule->d.receive.member) != 0)
{
@@ -935,9 +933,10 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
continue;
}
}
- else if (rule->d.receive.error != NULL)
+
+ if (rule->d.receive.error != NULL)
{
- if (dbus_message_get_error_name (message) == NULL ||
+ if (dbus_message_get_error_name (message) != NULL &&
strcmp (dbus_message_get_error_name (message),
rule->d.receive.error) != 0)
{