diff options
author | Adrian Szyndela <adrian.s@samsung.com> | 2020-09-07 14:54:34 +0200 |
---|---|---|
committer | Adrian Szyndela <adrian.s@samsung.com> | 2020-09-15 08:09:28 +0200 |
commit | afebe30300066164ad7207b214bd177e74bd5a53 (patch) | |
tree | 36b6c02fbd573db5645a07af3b8fa570f3bddaa8 | |
parent | 95217ed69e2480d93a2796de95f12c2ec1207920 (diff) | |
download | dbus-afebe30300066164ad7207b214bd177e74bd5a53.tar.gz dbus-afebe30300066164ad7207b214bd177e74bd5a53.tar.bz2 dbus-afebe30300066164ad7207b214bd177e74bd5a53.zip |
cynara integration: create deferred message only when it's not already created
This will allow altering existing deferred messages, enabling
concurrent asynchronous cynara checks for SEND and RECEIVE.
Change-Id: I1f31c173e4229661bca9f14ecaa158ee67342db4
-rw-r--r-- | bus/cynara.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/bus/cynara.c b/bus/cynara.c index 8d4d50a1..98255cd5 100644 --- a/bus/cynara.c +++ b/bus/cynara.c @@ -153,6 +153,9 @@ bus_cynara_check_privilege (BusCynara *cynara, _dbus_assert(connection != NULL); + if (deferred_message_param) + deferred_message = *deferred_message_param; + if (dbus_connection_get_unix_user(connection, &uid) == FALSE) return BUS_RESULT_FALSE; @@ -189,14 +192,21 @@ bus_cynara_check_privilege (BusCynara *cynara, break; case CYNARA_API_CACHE_MISS: - deferred_message = bus_deferred_message_new(message, sender, addressed_recipient, - proposed_recipient, BUS_RESULT_LATER); - if (deferred_message == NULL) - { - _dbus_verbose("Failed to allocate memory for deferred message\n"); - return_result = BUS_RESULT_FALSE; - break; - } + if (deferred_message == NULL) + { + deferred_message = bus_deferred_message_new(message, sender, addressed_recipient, + proposed_recipient, BUS_RESULT_LATER); + if (deferred_message == NULL) + { + _dbus_verbose("Failed to allocate memory for deferred message\n"); + return_result = BUS_RESULT_FALSE; + break; + } + } + else + { + bus_deferred_message_ref(deferred_message); + } /* callback is supposed to unref deferred_message*/ result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id, |