summaryrefslogtreecommitdiff
path: root/gdbus
AgeCommit message (Collapse)AuthorFilesLines
2012-10-04gdbus: Fix not freeing list node by using g_slist_delete_linkLuiz Augusto von Dentz1-1/+1
g_slist_remove_link does not free the node which can cause leaks so replace that with g_slist_delete_link which does free memory properly.
2012-09-28gdbus: Refactor filter_data_find()Lucas De Marchi1-38/+5
Now this function is only used for searching the listeners of a connection and the other parameters are not needed anymore.
2012-09-28gdbus: Fix wrong signal handler matchLucas De Marchi1-21/+94
When we add a signal handler with g_dbus_add_signal_watch(), this function tries to multiplex the matches added in libdbus by checking if there's a previous filter_data with the same fields. However, if the field is NULL it accepts as being the same. The result is that the following watches will use the same filter data: watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member, cb1, data1, NULL); watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member, cb2, data2, NULL); watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member, cb3, data3, NULL); The result is that when a signal arrives with path == "/path2", all 3 callbacks above will be called, with the same signal delivered to all of them. Another problem is that, if we invert the calls like below, only signals to cb1 will never be trigerred, nonetheless it used path == NULL. watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member, cb2, data2, NULL); watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member, cb1, data1, NULL); watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member, cb3, data3, NULL); This is fixed by not multiplexing the matchs with filter data if any of the fields are different, including being NULL. When a signal arrives, if a field is NULL we accept it as a match, but not when adding the signal handler.
2012-09-28gdbus: Fix crash when getting disconnected from the busJohan Hedberg1-4/+5
When getting disconnected from the bus sometimes (maybe always?) dbus_watch_handle() can cause the "info" context to be free'd meaning that we should not try to access it after the call. The only member we need access to is the connection pointer and as the code already has a ref() call for it it's only natural to solve the issue by adding a local variable not dependent on "info". The backtrace of the crash fixed looks as follows: Invalid read of size 8 at 0x121085: watch_func (mainloop.c:105) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551) Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd at 0x4A079AE: free (vg_replace_malloc.c:427) by 0x4C7837E: g_free (gmem.c:252) by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614) by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132) by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884) by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497) by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683) by 0x121084: watch_func (mainloop.c:103) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551)
2012-08-28gdbus: Fix compilation error if macro "error" is definedJaganath Kanakkassery1-2/+2
The variable "signature" used in error is not defined and "args" is now a struct instead of a string.
2012-06-30gdbus: Fix removal of filter after last filter_dataLucas De Marchi1-9/+8
If there's a signal watch that's also watching for name (data->name_watch) currently we are trying to remove the message_filter twice since we may have the following call chain: filter_data_remove_callback() filter_data_free() g_dbus_remove_watch() filter_data_remove_callback() filter_data_free() dbus_connection_remove_filter() dbus_connection_remove_filter() Because of this we can't currently watch for signals passing the bus name. After this patch we don't have this issue anymore. We fix it by removing the filter before calling filter_data_free() if we are the last filter_data and thus avoid calling dbus_connection_remove_filter() twice.
2012-05-31gdbus: Add macro for methods marked as NOREPLYLucas De Marchi1-0/+7
Bring gdbus up to sync with other projects. The macro is not yet used in ConnMan.
2012-05-22gdbus: Fix incorrectly discarded signalsMikel Astiz1-7/+3
Signals with no arguments were incorrectly filtered out due to the NULL inequality check.
2012-05-18gdbus: do not check signature twiceLucas De Marchi1-5/+0
Message signature is already checked in generic_message(), so there's no need to check again in the callback.
2012-05-18gdbus: add Method.NoReply annotation in introspectionLucas De Marchi1-1/+6
2012-05-18gdbus: add Deprecated annotation in introspectionLucas De Marchi1-2/+17
2012-05-18gdbus: remove signature and reply from tablesLucas De Marchi2-52/+1
2012-05-18gdbus: loop over args to check message signatureLucas De Marchi1-7/+27
2012-05-18gdbus: use GDBusArgInfo to generate introspectionLucas De Marchi1-61/+14
By using GDBusArgInfo in methods and signals, the introspection generation is much simpler and we can add each argument name.
2012-05-18gdbus: add and use helpers for table declarationsLucas De Marchi2-1/+88
2012-05-18gdbus: add argument info to methods and signalsLucas De Marchi1-0/+8
2012-05-18gdbus: Constify introspection method tableMarcel Holtmann1-1/+1
2012-05-18gdbus: do not call memset for terminating NULLucas De Marchi1-1/+2
2012-05-18gdbus: return if method signature is malformedLucas De Marchi1-0/+4
2012-04-16gdbus: Remove unneeded NEED_DBUS_WATCH_GET_UNIX_FD checkMarcel Holtmann1-4/+0
2012-04-05gdbus: Use destroy callback for service watchAnderson Lizardo1-1/+1
Even though service watches accepted a "destroy" callback, they were being ignored. This fix properly pass them along so they are called when the watch is removed.
2012-04-05gdbus: Fix white space coding style issueSyam Sidhardhan1-1/+1
- corrected the space before '{'
2011-05-27gdbus: Remove unused result variable from g_dbus_pending_successSzymon Janc1-2/+1
2011-03-09gdbus: Unconditionally remove D-Bus timeoutsGrant Erickson1-3/+0
Address an issue in which the daemon incorrectly handles D-Bus main loop timeouts by only removing timeouts that are not enabled when D-Bus requests a timeout removal.
2011-01-19gdbus: Remove root node 'name' attribute in introspectionDaniel Wagner1-1/+1
generate_introspection_xml generates the root <node> tags with a 'name' attribute. This seems to be a valid attribute but it is not consistent with the way the D-Bus daemon generates empty nodes. For example if we register "/foo/bar", D-Bus daemon will generate for "/foo" a introspection which looks like this: <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> <node name="bar"/> </node> and generate_introspection_xml generates for "/foo/bar": <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node name="/foo/bar"> </node> Just don't add the 'name' attribute to the root node. The GLib binding for D-Bus does it the same way.
2011-01-19gdbus: invaldate_parent_data: walk the whole path downDaniel Wagner1-3/+4
Assume there is only one object registerd at "/". If we add a new object at "/foo/bar" the introspection of "/" has to be updated. A new node has to be added at "/". invalidate_parent_data stops invaldating the whole path because the boolean return value of dbus_connection_get_object_path_data is used wrong. If we get a TRUE just go on down in the path, if FALSE is return dbus_connection_get_object_path_data has run out of memory.
2011-01-02gdbus: Update copyright informationMarcel Holtmann5-5/+5
2010-12-09gdbus: fix accessing freed callback dataJohan Hedberg1-5/+5
cb->disc_func or cb->conn_func could remove the callback so this needs to be checked for before continuing processing.
2010-12-08gdbus: explicitly compare pointers to NULLLucas De Marchi3-24/+23
This patch was generated by the following semantic patch (http://coccinelle.lip6.fr/) // <smpl> @fix disable is_null,isnt_null1@ expression *E; @@ - !E + E == NULL // </smpl>
2010-10-13gdbus: fix not handling bus disconnectsLuiz Augusto von Dentz1-0/+4
We where not dispatching data when a bus disconnects which cause Disconnected signal to not be processed and thus causing the process to either not exit or to not trigger callbacks registered with g_dbus_set_disconnect_function. To fix this now we always schedule a dispatch which will make sure data still not processed will make its way to the proper handlers even if disconnected.
2010-09-09Add support for builtin GDBus security using PolicyKitMarcel Holtmann2-1/+247
2010-09-09Add support for GDBus security action and flagsMarcel Holtmann2-3/+21
2010-09-09Use simpler error callbacks for GDBus security hooksMarcel Holtmann2-8/+30
2010-09-09Add support for GDBus security handlersMarcel Holtmann2-22/+156
2010-09-08Fix calling watch callbacks after it has been removedLuiz Augusto von Dentz1-30/+49
Pending call should be removed if the watch is removed since the application no longer expect that to be reached and may already freed the data associated with it.
2010-09-08Fix signal watch when a service name is givenLuiz Augusto Von Dentz1-33/+128
The bus name should be resolved when adding a watch by service name since messages do always come with sender set to owner's bus name, also it should listen to owner updates since it can change without invalidating the watch.
2010-09-08Do not automatically remove watches for service namesLuiz Augusto Von Dentz1-6/+7
Services can be owned again so it is perfectly fine to keep the watch.
2010-08-19Add printf format attribute for error creation helperMarcel Holtmann1-1/+2
2010-07-26Free service data in service_replyZhenhua Zhang1-1/+1
Avoid the memory leak of server_data.
2010-04-29Fix parent path introspection data invalidation for multiple levelsJohan Hedberg1-1/+3
In the case that parent path data needs to be invalidated we shouldn't stop at the immediate parent if it doesn't have our own handler registered but should continue upwards in the tree until we reach root or our own handler.
2010-04-29Fix memory leak in g_dbus_register_interfaceJohan Hedberg1-1/+3
2010-03-07Make interface callback tables constMarcel Holtmann2-16/+16
2010-03-07Fix the case when the requested name is already in useVinicius Costa Gomes1-1/+5
We weren't setting the dbus error in this situation.
2010-02-17Fix: a pending call was leaking in check_serviceVinicius Costa Gomes1-0/+2
This was triggering an assert inside libdbus when the timeout inside the leaking pending call expired. The assert said that we were trying to remove an nonexistent timeout.
2010-01-27Remove unneeded use of status variableMarcel Holtmann1-8/+2
2010-01-27Introduce g_dbus_setup_private() to gdbusForrest Zhao2-13/+55
g_dbus_setup_private() is used to setup private DBusConnection
2010-01-08Fix regression when removing watchesLuiz Augusto Von Dentz1-5/+9
filter_data_find return the first data registered in this case so there is no guarantee that it return the same data as passed to filter_data_remove_callback which is the one that should be removed. The fix is to simple cache the connection removing the correct data before checking if there is any filter left.
2010-01-03Cleanup of D-Bus mainloop integrationMarcel Holtmann1-84/+107
2010-01-02Update copyright information of D-Bus helper libraryMarcel Holtmann4-4/+4
2009-12-30Fix undefined symbolsLuiz Augusto Von Dentz1-2/+2