diff options
author | Simo Sorce <idra@samba.org> | 2009-02-24 14:53:31 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-02-24 16:39:51 -0500 |
commit | 3621d86ad205dcacb50022f8e6b669218600257f (patch) | |
tree | 039418120ac2786e566e80c9d269664286a33eb7 /server/sbus/sssd_dbus_connection.c | |
parent | c14486feb47672a3562989ddb00653f58357e368 (diff) | |
download | sssd-3621d86ad205dcacb50022f8e6b669218600257f.tar.gz sssd-3621d86ad205dcacb50022f8e6b669218600257f.tar.bz2 sssd-3621d86ad205dcacb50022f8e6b669218600257f.zip |
Revert "Fixing serious memory allocation bug in sbus_message_handler."
This reverts commit 13421cbe0af4343f9d110600755ffa756690b282.
Conflicts:
server/infopipe/infopipe.c
server/infopipe/infopipe.h
While this solution fixed the contingent memory problem it introduced
other problems in handling asynchronous replies.
Reverting in preparation for a different way to solve it.
Conflicts have been taken care of.
Diffstat (limited to 'server/sbus/sssd_dbus_connection.c')
-rw-r--r-- | server/sbus/sssd_dbus_connection.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c index 186df356..d02dc6c8 100644 --- a/server/sbus/sssd_dbus_connection.c +++ b/server/sbus/sssd_dbus_connection.c @@ -483,7 +483,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, const char *method; const char *path; const char *msg_interface; - struct sbus_message_ctx *reply = NULL; + DBusMessage *reply = NULL; int i, ret; int found; @@ -503,22 +503,14 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, if (strcmp(path, ctx->method_ctx->path) != 0) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - reply = talloc_zero(ctx, struct sbus_message_ctx); - if (!reply) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - reply->mh_ctx = ctx; - reply->reply_message = NULL; - /* Validate the method interface */ if (strcmp(msg_interface, ctx->method_ctx->interface) == 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, reply); - if (ret != EOK) { - talloc_free(reply); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } + ret = ctx->method_ctx->methods[i].fn(message, ctx, &reply); + if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; break; } } @@ -526,7 +518,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, if (!found) { /* Reply DBUS_ERROR_UNKNOWN_METHOD */ DEBUG(1, ("No matching method found for %s.\n", method)); - reply->reply_message = dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD, NULL); + reply = dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD, NULL); } } else { @@ -540,24 +532,20 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, /* If we have been asked for introspection data and we have * an introspection function registered, user that. */ - ret = ctx->method_ctx->introspect_fn(message, reply); - if (ret != EOK) { - talloc_free(reply); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } + ret = ctx->method_ctx->introspect_fn(message, ctx, &reply); + if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } else return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - DEBUG(5, ("Method %s complete. Reply was %ssent.\n", method, reply->reply_message?"":"not ")); + DEBUG(5, ("Method %s complete. Reply was %ssent.\n", method, reply?"":"not ")); - if (reply->reply_message) { - dbus_connection_send(conn, reply->reply_message, NULL); - dbus_message_unref(reply->reply_message); + if (reply) { + dbus_connection_send(conn, reply, NULL); + dbus_message_unref(reply); } - talloc_free(reply); return DBUS_HANDLER_RESULT_HANDLED; } |