diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-02-23 15:43:31 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-02-23 16:20:52 -0500 |
commit | 13421cbe0af4343f9d110600755ffa756690b282 (patch) | |
tree | fab749d3fd49148ec62d7d664c933fb40b36d9a9 /server/sbus/sssd_dbus.h | |
parent | f8469b71247b5a41cfdf0f54c25ceda1552e0ee9 (diff) | |
download | sssd-13421cbe0af4343f9d110600755ffa756690b282.tar.gz sssd-13421cbe0af4343f9d110600755ffa756690b282.tar.bz2 sssd-13421cbe0af4343f9d110600755ffa756690b282.zip |
Fixing serious memory allocation bug in sbus_message_handler.
dbus_message_append_args() adds a reference to memory that is not
copied to the outgoing message until dbus_connection_send() is
called. Since we compile our reply messages in functions and then
return the reply, we need a mechanism for deleting allocated
memory after invoking dbus_connection_send. I have changed the
arguments to sbus_msg_handler_fn so that it takes a talloc ctx
containing the sbus_message_handler_ctx and a pointer to a reply
object. We can now allocate memory as a child of the reply context
and free it after calling dbus_connection_send.
Diffstat (limited to 'server/sbus/sssd_dbus.h')
-rw-r--r-- | server/sbus/sssd_dbus.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h index c75bbc93..bc65e314 100644 --- a/server/sbus/sssd_dbus.h +++ b/server/sbus/sssd_dbus.h @@ -27,7 +27,8 @@ struct sbus_srv_ctx; #include "dbus/dbus.h" -typedef int (*sbus_msg_handler_fn)(DBusMessage *, void *, DBusMessage **); +struct sbus_message_ctx; +typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_message_ctx *); /* * sbus_conn_destructor_fn @@ -71,6 +72,11 @@ struct sbus_message_handler_ctx { struct sbus_method_ctx *method_ctx; }; +struct sbus_message_ctx { + struct sbus_message_handler_ctx *mh_ctx; + DBusMessage *reply_message; +}; + /* Server Functions */ int sbus_new_server(TALLOC_CTX *mem_ctx, struct event_context *ev, struct sbus_method_ctx *ctx, |