From: Havoc Pennington Date: Wed, 20 Aug 2003 14:48:04 +0000 (+0000) Subject: 2003-08-19 Havoc Pennington X-Git-Tag: dbus-0.20~37^2~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0c588575e3e2911eacb098fac26f02d1010cbfd;p=platform%2Fupstream%2Fdbus.git 2003-08-19 Havoc Pennington * 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 / 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 --- diff --git a/ChangeLog b/ChangeLog index 4a2d6a8..b5b37d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2003-08-19 Havoc Pennington + + * 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 / 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 + 2003-08-18 Havoc Pennington * dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix diff --git a/bus/dispatch.c b/bus/dispatch.c index 8eda250..16102aa 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -418,11 +418,14 @@ pop_message_waiting_for_memory (DBusConnection *connection) } static void -warn_unexpected (DBusConnection *connection, - DBusMessage *message, - const char *expected) +warn_unexpected_real (DBusConnection *connection, + DBusMessage *message, + const char *expected, + const char *function, + int line) { - _dbus_warn ("Received message interface \"%s\" member \"%s\" error name \"%s\" on %p, expecting %s\n", + _dbus_warn ("%s:%d received message interface \"%s\" member \"%s\" error name \"%s\" on %p, expecting %s\n", + function, line, dbus_message_get_interface (message) ? dbus_message_get_interface (message) : "(unset)", dbus_message_get_member (message) ? @@ -433,6 +436,23 @@ warn_unexpected (DBusConnection *connection, expected); } +#define warn_unexpected(connection, message, expected) \ + warn_unexpected_real (connection, message, expected, _DBUS_FUNCTION_NAME, __LINE__) + +static void +verbose_message_received (DBusConnection *connection, + DBusMessage *message) +{ + _dbus_verbose ("Received message interface \"%s\" member \"%s\" error name \"%s\" on %p\n", + dbus_message_get_interface (message) ? + dbus_message_get_interface (message) : "(unset)", + dbus_message_get_member (message) ? + dbus_message_get_member (message) : "(unset)", + dbus_message_get_error_name (message) ? + dbus_message_get_error_name (message) : "(unset)", + connection); +} + typedef struct { const char *expected_service_name; @@ -748,8 +768,7 @@ check_hello_message (BusContext *context, goto out; } - _dbus_verbose ("Received message %p on %p\n", - message, connection); + verbose_message_received (connection, message); if (!dbus_message_has_sender (message, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS)) { @@ -984,8 +1003,7 @@ check_nonexistent_service_activation (BusContext *context, goto out; } - _dbus_verbose ("Received message %p on %p\n", - message, connection); + verbose_message_received (connection, message); if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) { @@ -1542,8 +1560,8 @@ check_existent_service_activation (BusContext *context, goto out; } - _dbus_verbose ("Received message %p on %p after sending %s\n", - message, connection, "ActivateService"); + verbose_message_received (connection, message); + _dbus_verbose (" (after sending %s)\n", "ActivateService"); if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) { @@ -1748,8 +1766,7 @@ check_segfault_service_activation (BusContext *context, goto out; } - _dbus_verbose ("Received message %p on %p\n", - message, connection); + verbose_message_received (connection, message); if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) { diff --git a/bus/policy.c b/bus/policy.c index 04ea423..f7978c0 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) { diff --git a/bus/session.conf.in b/bus/session.conf.in index 673d873..09dd250 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -14,8 +14,8 @@ - - + + diff --git a/bus/system.conf.in b/bus/system.conf.in index bd454ff..96513a7 100644 --- a/bus/system.conf.in +++ b/bus/system.conf.in @@ -34,16 +34,16 @@ - - + + - - + + - + - +