libchromeos: Fixed D-Bus method call error handling
Extracted portions of ExtractMethodCallResults into a separate
set of functions (ExtractMessageParametersAsTuple and
ExtractMessageParameters) to help with reading data from
D-Bus message buffers.
Also changed ExtractMethodCallResults to accespt generic
dbus::Message instead of dbus::Response. This way we can
deserialize parameters from other message types, such as
dbus::Signal.
Finally, since dbus::ObjectProxy::CallMethodAndBlock()
does not return any error information when a D-Bus method
call failed, it returns a nullptr response instead of
expected dbus::ErrorResponse. Therefore the intended
implementation of chromeos::dbus_utils::CallMethodAndBlock()
and chromeos::dbus_utils::ExtractMethodCallResults()
functions were not treating the failures correctly.
As a step towards fixing the issue, added error parameter
to chromeos::dbus_utils::CallMethodAndBlock() and
updated code that called it to check for nullptr return
values. The second step would be to add a new method
dbus::ObjectProxy::CallMethodAndBlockWithError() to
Chrome and switch chromeos::dbus_utils::CallMethodAndBlock()
to use that method instead and retrieve the error information
correctly.
BUG=chromium:414838
TEST=USE=attestation FEATURES=test emerge-link libchromeos buffet peerd platform2
Change-Id: Ia5d6999afb50c0b3c9ab1c5057a9fc805a528ab5
Reviewed-on: https://chromium-review.googlesource.com/218468
Reviewed-by: Alex Vakulenko <[email protected]>
Commit-Queue: Alex Vakulenko <[email protected]>
Tested-by: Alex Vakulenko <[email protected]>
1 file changed