diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-03-06 10:13:29 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-06 12:37:21 -0500 |
commit | 060ded24a52ffbc523dc68fc3f43c4c20e80a073 (patch) | |
tree | 731d3bd2570f95a5fb83f1225122f6a95104887c /server | |
parent | b8c2c7e5c3a323d2d4982353ea79ad2eda1b9cc8 (diff) | |
download | sssd-060ded24a52ffbc523dc68fc3f43c4c20e80a073.tar.gz sssd-060ded24a52ffbc523dc68fc3f43c4c20e80a073.tar.bz2 sssd-060ded24a52ffbc523dc68fc3f43c4c20e80a073.zip |
Add sbus_reply_internal_error() feature to sbus_message_handler()
If an SBUS function returns an error code, we'll immediately
return an error reply to the client stating "Internal Error"
instead of ignoring the request and forcing the client to wait
for a timeout.
Diffstat (limited to 'server')
-rw-r--r-- | server/sbus/sssd_dbus_connection.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c index 51a1f75c..6dc3130b 100644 --- a/server/sbus/sssd_dbus_connection.c +++ b/server/sbus/sssd_dbus_connection.c @@ -477,6 +477,16 @@ void sbus_disconnect (struct sbus_conn_ctx *dct_ctx) DEBUG(5,("Disconnected %lX\n", dct_ctx->conn)); } +static int sbus_reply_internal_error(DBusMessage *message, struct sbus_conn_ctx *sconn) { + DBusMessage *reply = dbus_message_new_error(message, DBUS_ERROR_IO_ERROR, "Internal Error"); + if (reply) { + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return DBUS_HANDLER_RESULT_HANDLED; + } + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + /* messsage_handler * Receive messages and process them */ @@ -515,7 +525,8 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, if (strcmp(method, ctx->method_ctx->methods[i].method) == 0) { found = 1; ret = ctx->method_ctx->methods[i].fn(message, ctx->conn_ctx); - if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (ret != EOK) return sbus_reply_internal_error(message, + ctx->conn_ctx); break; } } @@ -538,7 +549,8 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, * an introspection function registered, user that. */ ret = ctx->method_ctx->introspect_fn(message, ctx->conn_ctx); - if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (ret != EOK) return sbus_reply_internal_error(message, + ctx->conn_ctx); } } else |