summaryrefslogtreecommitdiffstats
path: root/server/sbus
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-02-16 11:07:57 -0500
committerSimo Sorce <idra@samba.org>2009-02-16 20:33:41 -0500
commita0610e92ac970ebbc0d83761f9fef5ca4f95f4c9 (patch)
tree8186f2057c3015df21034878993efe4e84c76c10 /server/sbus
parent4166dd54ebb56083bf61f8d2d4b151c0e476e22c (diff)
downloadsssd-a0610e92ac970ebbc0d83761f9fef5ca4f95f4c9.tar.gz
sssd-a0610e92ac970ebbc0d83761f9fef5ca4f95f4c9.tar.xz
sssd-a0610e92ac970ebbc0d83761f9fef5ca4f95f4c9.zip
Modifying sbus_message_handler to return DBUS_ERROR_UNKNOWN_METHOD when the requested method is not registered with the message handler. Previously, we returned DBUS_HANDLER_RESULT_HANDLED with no indication that nothing had happened.
Diffstat (limited to 'server/sbus')
-rw-r--r--server/sbus/sssd_dbus_connection.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 2d2758146..601ca0095 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -485,6 +485,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn,
const char *msg_interface;
DBusMessage *reply = NULL;
int i, ret;
+ int found;
if (!user_data) {
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -504,17 +505,24 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn,
/* Validate the D-BUS path */
if (strcmp(path, ctx->method_ctx->path) == 0) {
+ found = 0;
for (i = 0; ctx->method_ctx->methods[i].method != NULL; i++) {
if (strcmp(method, ctx->method_ctx->methods[i].method) == 0) {
+ found = 1;
ret = ctx->method_ctx->methods[i].fn(message, ctx, &reply);
if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
break;
}
}
- /* FIXME: check if we didn't find any matching method */
+
+ if (!found) {
+ /* Reply DBUS_ERROR_UNKNOWN_METHOD */
+ DEBUG(1, ("No matching method found for %s.\n", method));
+ reply = dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD, NULL);
+ }
}
- DEBUG(5, ("Method %s complete. Reply was %srequested.\n", method, reply?"":"not "));
+ DEBUG(5, ("Method %s complete. Reply was %ssent.\n", method, reply?"":"not "));
if (reply) {
dbus_connection_send(conn, reply, NULL);