Lines Matching refs:rule
37 BusPolicyRule *rule; in bus_policy_rule_new() local
39 rule = dbus_new0 (BusPolicyRule, 1); in bus_policy_rule_new()
40 if (rule == NULL) in bus_policy_rule_new()
43 rule->type = type; in bus_policy_rule_new()
44 rule->refcount = 1; in bus_policy_rule_new()
45 rule->allow = allow; in bus_policy_rule_new()
47 switch (rule->type) in bus_policy_rule_new()
50 rule->d.user.uid = DBUS_UID_UNSET; in bus_policy_rule_new()
53 rule->d.group.gid = DBUS_GID_UNSET; in bus_policy_rule_new()
56 rule->d.send.message_type = DBUS_MESSAGE_TYPE_INVALID; in bus_policy_rule_new()
61 rule->d.send.requested_reply = rule->allow; in bus_policy_rule_new()
64 rule->d.receive.message_type = DBUS_MESSAGE_TYPE_INVALID; in bus_policy_rule_new()
68 rule->d.receive.requested_reply = rule->allow; in bus_policy_rule_new()
74 return rule; in bus_policy_rule_new()
78 bus_policy_rule_ref (BusPolicyRule *rule) in bus_policy_rule_ref() argument
80 _dbus_assert (rule->refcount > 0); in bus_policy_rule_ref()
82 rule->refcount += 1; in bus_policy_rule_ref()
84 return rule; in bus_policy_rule_ref()
88 bus_policy_rule_unref (BusPolicyRule *rule) in bus_policy_rule_unref() argument
90 _dbus_assert (rule->refcount > 0); in bus_policy_rule_unref()
92 rule->refcount -= 1; in bus_policy_rule_unref()
94 if (rule->refcount == 0) in bus_policy_rule_unref()
96 switch (rule->type) in bus_policy_rule_unref()
99 dbus_free (rule->d.send.path); in bus_policy_rule_unref()
100 dbus_free (rule->d.send.interface); in bus_policy_rule_unref()
101 dbus_free (rule->d.send.member); in bus_policy_rule_unref()
102 dbus_free (rule->d.send.error); in bus_policy_rule_unref()
103 dbus_free (rule->d.send.destination); in bus_policy_rule_unref()
106 dbus_free (rule->d.receive.path); in bus_policy_rule_unref()
107 dbus_free (rule->d.receive.interface); in bus_policy_rule_unref()
108 dbus_free (rule->d.receive.member); in bus_policy_rule_unref()
109 dbus_free (rule->d.receive.error); in bus_policy_rule_unref()
110 dbus_free (rule->d.receive.origin); in bus_policy_rule_unref()
113 dbus_free (rule->d.own.service_name); in bus_policy_rule_unref()
121 dbus_free (rule); in bus_policy_rule_unref()
141 BusPolicyRule *rule = data; in free_rule_func() local
143 bus_policy_rule_unref (rule); in free_rule_func()
247 BusPolicyRule *rule = link->data; in add_list_to_client() local
250 switch (rule->type) in add_list_to_client()
261 if (!bus_client_policy_append_rule (client, rule)) in add_list_to_client()
391 BusPolicyRule *rule = link->data; in list_allows_user() local
394 if (rule->type == BUS_POLICY_RULE_USER) in list_allows_user()
397 list, rule->d.user.uid); in list_allows_user()
399 if (rule->d.user.uid == DBUS_UID_UNSET) in list_allows_user()
401 else if (rule->d.user.uid != uid) in list_allows_user()
404 else if (rule->type == BUS_POLICY_RULE_GROUP) in list_allows_user()
407 list, rule->d.group.gid); in list_allows_user()
409 if (rule->d.group.gid == DBUS_GID_UNSET) in list_allows_user()
418 if (rule->d.group.gid == group_ids[i]) in list_allows_user()
430 allowed = rule->allow; in list_allows_user()
491 BusPolicyRule *rule) in bus_policy_append_default_rule() argument
493 if (!_dbus_list_append (&policy->default_rules, rule)) in bus_policy_append_default_rule()
496 bus_policy_rule_ref (rule); in bus_policy_append_default_rule()
503 BusPolicyRule *rule) in bus_policy_append_mandatory_rule() argument
505 if (!_dbus_list_append (&policy->mandatory_rules, rule)) in bus_policy_append_mandatory_rule()
508 bus_policy_rule_ref (rule); in bus_policy_append_mandatory_rule()
542 BusPolicyRule *rule) in bus_policy_append_user_rule() argument
551 if (!_dbus_list_append (list, rule)) in bus_policy_append_user_rule()
554 bus_policy_rule_ref (rule); in bus_policy_append_user_rule()
562 BusPolicyRule *rule) in bus_policy_append_group_rule() argument
571 if (!_dbus_list_append (list, rule)) in bus_policy_append_group_rule()
574 bus_policy_rule_ref (rule); in bus_policy_append_group_rule()
582 BusPolicyRule *rule) in bus_policy_append_console_rule() argument
586 if (!_dbus_list_append (&policy->at_console_true_rules, rule)) in bus_policy_append_console_rule()
591 if (!_dbus_list_append (&policy->at_console_false_rules, rule)) in bus_policy_append_console_rule()
595 bus_policy_rule_ref (rule); in bus_policy_append_console_rule()
726 BusPolicyRule *rule = data; in rule_unref_foreach() local
728 bus_policy_rule_unref (rule); in rule_unref_foreach()
760 BusPolicyRule *rule = link->data; in remove_rules_by_type_up_to() local
763 if (rule->type == type) in remove_rules_by_type_up_to()
766 bus_policy_rule_unref (rule); in remove_rules_by_type_up_to()
798 BusPolicyRule *rule; in bus_client_policy_optimize() local
803 rule = link->data; in bus_client_policy_optimize()
807 _dbus_assert (rule != NULL); in bus_client_policy_optimize()
809 switch (rule->type) in bus_client_policy_optimize()
813 rule->d.send.message_type == DBUS_MESSAGE_TYPE_INVALID && in bus_client_policy_optimize()
814 rule->d.send.path == NULL && in bus_client_policy_optimize()
815 rule->d.send.interface == NULL && in bus_client_policy_optimize()
816 rule->d.send.member == NULL && in bus_client_policy_optimize()
817 rule->d.send.error == NULL && in bus_client_policy_optimize()
818 rule->d.send.destination == NULL; in bus_client_policy_optimize()
822 rule->d.receive.message_type == DBUS_MESSAGE_TYPE_INVALID && in bus_client_policy_optimize()
823 rule->d.receive.path == NULL && in bus_client_policy_optimize()
824 rule->d.receive.interface == NULL && in bus_client_policy_optimize()
825 rule->d.receive.member == NULL && in bus_client_policy_optimize()
826 rule->d.receive.error == NULL && in bus_client_policy_optimize()
827 rule->d.receive.origin == NULL; in bus_client_policy_optimize()
831 rule->d.own.service_name == NULL; in bus_client_policy_optimize()
840 remove_rules_by_type_up_to (policy, rule->type, in bus_client_policy_optimize()
852 BusPolicyRule *rule) in bus_client_policy_append_rule() argument
855 rule, rule->type, policy); in bus_client_policy_append_rule()
857 if (!_dbus_list_append (&policy->rules, rule)) in bus_client_policy_append_rule()
860 bus_policy_rule_ref (rule); in bus_client_policy_append_rule()
888 BusPolicyRule *rule = link->data; in bus_client_policy_check_can_send() local
897 if (rule->type != BUS_POLICY_RULE_SEND) in bus_client_policy_check_can_send()
903 if (rule->d.send.message_type != DBUS_MESSAGE_TYPE_INVALID) in bus_client_policy_check_can_send()
905 if (dbus_message_get_type (message) != rule->d.send.message_type) in bus_client_policy_check_can_send()
919 … if (!requested_reply && rule->allow && rule->d.send.requested_reply && !rule->d.send.eavesdrop) in bus_client_policy_check_can_send()
929 if (requested_reply && !rule->allow && !rule->d.send.requested_reply) in bus_client_policy_check_can_send()
936 if (rule->d.send.path != NULL) in bus_client_policy_check_can_send()
940 rule->d.send.path) != 0) in bus_client_policy_check_can_send()
947 if (rule->d.send.interface != NULL) in bus_client_policy_check_can_send()
958 if ((no_interface && rule->allow) || in bus_client_policy_check_can_send()
961 rule->d.send.interface) != 0)) in bus_client_policy_check_can_send()
968 if (rule->d.send.member != NULL) in bus_client_policy_check_can_send()
972 rule->d.send.member) != 0) in bus_client_policy_check_can_send()
979 if (rule->d.send.error != NULL) in bus_client_policy_check_can_send()
983 rule->d.send.error) != 0) in bus_client_policy_check_can_send()
990 if (rule->d.send.destination != NULL) in bus_client_policy_check_can_send()
1000 rule->d.send.destination)) in bus_client_policy_check_can_send()
1003 rule->d.send.destination); in bus_client_policy_check_can_send()
1012 _dbus_string_init_const (&str, rule->d.send.destination); in bus_client_policy_check_can_send()
1018 rule->d.send.destination); in bus_client_policy_check_can_send()
1025 rule->d.send.destination); in bus_client_policy_check_can_send()
1032 allowed = rule->allow; in bus_client_policy_check_can_send()
1033 *log = rule->d.send.log; in bus_client_policy_check_can_send()
1075 BusPolicyRule *rule = link->data; in bus_client_policy_check_can_receive() local
1079 if (rule->type != BUS_POLICY_RULE_RECEIVE) in bus_client_policy_check_can_receive()
1085 if (rule->d.receive.message_type != DBUS_MESSAGE_TYPE_INVALID) in bus_client_policy_check_can_receive()
1087 if (dbus_message_get_type (message) != rule->d.receive.message_type) in bus_client_policy_check_can_receive()
1097 if (eavesdropping && rule->allow && !rule->d.receive.eavesdrop) in bus_client_policy_check_can_receive()
1106 if (!eavesdropping && !rule->allow && rule->d.receive.eavesdrop) in bus_client_policy_check_can_receive()
1119 …if (!requested_reply && rule->allow && rule->d.receive.requested_reply && !rule->d.receive.eavesdr… in bus_client_policy_check_can_receive()
1129 if (requested_reply && !rule->allow && !rule->d.receive.requested_reply) in bus_client_policy_check_can_receive()
1136 if (rule->d.receive.path != NULL) in bus_client_policy_check_can_receive()
1140 rule->d.receive.path) != 0) in bus_client_policy_check_can_receive()
1147 if (rule->d.receive.interface != NULL) in bus_client_policy_check_can_receive()
1158 if ((no_interface && rule->allow) || in bus_client_policy_check_can_receive()
1161 rule->d.receive.interface) != 0)) in bus_client_policy_check_can_receive()
1168 if (rule->d.receive.member != NULL) in bus_client_policy_check_can_receive()
1172 rule->d.receive.member) != 0) in bus_client_policy_check_can_receive()
1179 if (rule->d.receive.error != NULL) in bus_client_policy_check_can_receive()
1183 rule->d.receive.error) != 0) in bus_client_policy_check_can_receive()
1190 if (rule->d.receive.origin != NULL) in bus_client_policy_check_can_receive()
1200 rule->d.receive.origin)) in bus_client_policy_check_can_receive()
1203 rule->d.receive.origin); in bus_client_policy_check_can_receive()
1212 _dbus_string_init_const (&str, rule->d.receive.origin); in bus_client_policy_check_can_receive()
1219 rule->d.receive.origin); in bus_client_policy_check_can_receive()
1226 rule->d.receive.origin); in bus_client_policy_check_can_receive()
1233 allowed = rule->allow; in bus_client_policy_check_can_receive()
1260 BusPolicyRule *rule = link->data; in bus_rules_check_can_own() local
1268 if (rule->type != BUS_POLICY_RULE_OWN) in bus_rules_check_can_own()
1271 if (!rule->d.own.prefix && rule->d.own.service_name != NULL) in bus_rules_check_can_own()
1274 rule->d.own.service_name)) in bus_rules_check_can_own()
1277 else if (rule->d.own.prefix) in bus_rules_check_can_own()
1282 rule->d.own.service_name)) in bus_rules_check_can_own()
1286 next_char = data[strlen (rule->d.own.service_name)]; in bus_rules_check_can_own()
1292 allowed = rule->allow; in bus_rules_check_can_own()