From d82a27006af15852648da9b4ef803bb85739f6ec Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Tue, 11 Apr 2017 17:08:23 +0900 Subject: [PATCH] common: Not handle missing method - If there is method call with not implemented method, it is not handled and return DBUS_HANDLER_RESULT_NOT_YET_HANDLED Change-Id: I46e24e2a71e7b29f589705ac7a5439b8c7c6e755 Signed-off-by: pr.jung --- src/shared/dbus.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/shared/dbus.c b/src/shared/dbus.c index e8502e4..5c0fb9b 100644 --- a/src/shared/dbus.c +++ b/src/shared/dbus.c @@ -222,11 +222,12 @@ static DBusHandlerResult method_call_handler(DBusConnection *connection, const dbus_interface_s *iface; const dbus_method_s *methods; DBusMessage *result = NULL; + bool method_is_implemented = false; _D("Method call handler"); if (!msg || !mh) { - return DBUS_HANDLER_RESULT_HANDLED; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; // No message to handle } iface = mh->iface; @@ -236,10 +237,11 @@ static DBusHandlerResult method_call_handler(DBusConnection *connection, if (dbus_message_is_method_call(msg, iface->name, methods[i].member) != TRUE) continue; + method_is_implemented = true; reply = calloc(1, sizeof(struct dbus_method_reply_handle_s)); if (!reply) { _E("calloc() failed"); - return DBUS_HANDLER_RESULT_HANDLED; + return DBUS_HANDLER_RESULT_NEED_MEMORY; // Failed to create reply, try again later } reply->handle = mh->handle; @@ -250,8 +252,11 @@ static DBusHandlerResult method_call_handler(DBusConnection *connection, break; } + if (!method_is_implemented) + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; // Missing method, no reply + /* If result is null, reply will be sent by worker thread */ if (result) - reply_dbus_method_result(reply, result); + reply_dbus_method_result(reply, result); // Method handled, reply sent return DBUS_HANDLER_RESULT_HANDLED; } -- 2.7.4