Commit Graph

210 Commits

Author SHA1 Message Date
Lucas De Marchi
ca0b4c4c65 gdbus: Fix removal of filter after last filter_data
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-06-28 10:37:42 +03:00
Lucas De Marchi
80525c138b gdbus: add macro for methods marked as NOREPLY 2012-06-18 17:32:18 +03:00
Mikel Astiz
5c6bd559e9 gdbus: Fix incorrectly discarded signals
Signals with no arguments were incorrectly filtered out due to the NULL
inequality check.
2012-05-22 20:26:41 +02:00
Lucas De Marchi
67da9a4630 gdbus: do not check signature twice
Message signature is already checked in generic_message(), so there's no
need to check again in the callback.
2012-05-17 20:32:21 -07:00
Lucas De Marchi
e6ebddb1f1 gdbus: add Method.NoReply annotation in introspection 2012-05-17 20:32:21 -07:00
Lucas De Marchi
53e3faaf2b gdbus: add Deprecated annotation in introspection 2012-05-17 20:32:21 -07:00
Lucas De Marchi
e77a7c2775 gdbus: remove signature and reply from tables 2012-05-17 20:32:21 -07:00
Lucas De Marchi
fd9148dd25 gdbus: loop over args to check message signature 2012-05-17 20:32:20 -07:00
Lucas De Marchi
c430735fd4 gdbus: use GDBusArgInfo to generate introspection
By using GDBusArgInfo in methods and signals, the introspection
generation is much simpler and we can add each argument name.
2012-05-17 20:32:20 -07:00
Lucas De Marchi
2e576dd2f9 gdbus: add and use helpers for table declarations 2012-05-17 20:32:20 -07:00
Lucas De Marchi
56f4b3c8ae gdbus: add argument info to methods and signals 2012-05-17 20:32:20 -07:00
Marcel Holtmann
b01bcc4215 gdbus: Constify introspection method table 2012-05-17 19:56:27 -07:00
Lucas De Marchi
a40aa24e83 gdbus: do not call memset for terminating NUL 2012-05-17 19:53:53 -07:00
Lucas De Marchi
417d485119 gdbus: return if method signature is malformed 2012-05-17 19:52:59 -07:00
Marcel Holtmann
2c8caaf0ba gdbus: Remove unneeded NEED_DBUS_WATCH_GET_UNIX_FD check 2012-04-16 18:23:01 +02:00
Anderson Lizardo
c4494591c9 gdbus: Use destroy callback for service watch
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-04 12:56:51 +03:00
Syam Sidhardhan
e1d2db4976 gdbus: Fix white space coding style issue
- corrected the space before '{'
2011-07-09 19:10:04 +03:00
Szymon Janc
3c07ee5578 Remove unused result variable from g_dbus_pending_success 2011-05-15 01:47:11 +03:00
Grant Erickson
af4519a50c gdbus: Unconditionally remove D-Bus timeouts
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-03-09 13:34:03 -08:00
Daniel Wagner
f1d07327bf gdbus: Remove root node 'name' attribute in introspection
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-19 20:36:47 +05:30
Daniel Wagner
eea57f916c gdbus: invaldate_parent_data: walk the whole path down
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-19 20:36:45 +05:30
Marcel Holtmann
e7c4557de7 gdbus: Update copyright information 2011-01-01 17:32:11 -08:00
Johan Hedberg
986ff02852 gdbus: fix accessing freed callback data
cb->disc_func or cb->conn_func could remove the callback so this needs
to be checked for before continuing processing.
2010-12-09 22:02:30 +02:00
Lucas De Marchi
6e66423fe8 gdbus: explicitly compare pointers to NULL
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-12-08 16:33:28 +01:00
Luiz Augusto von Dentz
fd6b74727b gdbus: fix not handling bus disconnects
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-10-13 15:53:44 +03:00
Marcel Holtmann
3a792ff3ce Add support for builtin GDBus security using PolicyKit 2010-09-09 18:30:43 +02:00
Marcel Holtmann
aafe340fa7 Add support for GDBus security action and flags 2010-09-09 18:30:43 +02:00
Marcel Holtmann
a7dc2305a8 Use simpler error callbacks for GDBus security hooks 2010-09-09 18:30:43 +02:00
Marcel Holtmann
c7aa1b025a Add support for GDBus security handlers 2010-09-09 18:30:43 +02:00
Luiz Augusto von Dentz
9acfec4459 Fix calling watch callbacks after it has been removed
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-07 23:41:20 +03:00
Luiz Augusto Von Dentz
a6dbffeb35 Fix signal watch when a service name is given
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-07 23:41:05 +03:00
Luiz Augusto Von Dentz
44f0cfce54 Do not automatically remove watches for service names
Services can be owned again so it is perfectly fine to keep the watch.
2010-09-07 23:41:00 +03:00
Marcel Holtmann
3a8efc07f5 Add printf format attribute for error creation helper 2010-08-19 19:36:01 +02:00
Zhenhua Zhang
9a06b941c5 gdbus: Fix memory leak of service_data
Avoid the memory leak of server_data after service_reply has been
called.
2010-07-26 12:30:31 +03:00
Johan Hedberg
800e8fa257 Fix parent path introspection data invalidation for multiple levels
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-30 01:23:45 +03:00
Johan Hedberg
9bbcbff039 Fix memory leak in g_dbus_register_interface 2010-04-30 00:27:54 +03:00
Marcel Holtmann
d44989c514 Make interface callback tables const 2010-03-07 14:33:40 -08:00
Vinicius Costa Gomes
e6b83be22e Fix the case when the requested name is already in use
We weren't setting the dbus error in this situation.
2010-03-07 14:31:15 -08:00
Vinicius Costa Gomes
9839edb217 Fix: a pending call was leaking in check_service
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-02-17 01:58:51 -08:00
Marcel Holtmann
dd99e73bd8 Remove unneeded use of status variable 2010-01-27 09:50:04 +01:00
Forrest Zhao
22d39c8860 Introduce g_dbus_setup_private() to gdbus
g_dbus_setup_private() is used to setup private DBusConnection
2010-01-27 09:50:04 +01:00
Luiz Augusto Von Dentz
d43ade97b2 Fix regression when removing watches
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-08 12:26:28 +02:00
Marcel Holtmann
4da121910a Cleanup of D-Bus mainloop integration 2010-01-02 21:42:49 -08:00
Marcel Holtmann
d21f53083c Update copyright information of D-Bus helper library 2010-01-01 17:04:13 -08:00
Luiz Augusto Von Dentz
d0b19b5cae Fix undefined symbols 2009-12-29 14:10:15 +02:00
Luiz Augusto Von Dentz
2ae4af4d42 Port gdbus to use g_dbus_add_signal_watch 2009-12-29 11:16:39 +02:00
Luiz Augusto Von Dentz
0b456960c0 Add initial implementation of g_dbus_add_signal_watch
With g_dbus_add_signal_watch there is no need to register multiple filters
for dbus nor add matching rules manually.
2009-12-29 10:53:21 +02:00
Daniel Orstadius
0b15d14b98 Fix D-Bus timeout handling
Timeouts should also be removed in the remove_timeout callback in
addition to the timeout_handler_free function. This is how dbus-glib
does it and it seems to prevent crashes in certain situations.
2009-12-17 07:35:40 +02:00
Claudio Takahasi
45806a9b07 Fix message handling for autostart.
Current implementation of libdbus Request name is blocking, consequently
the first incomming message that triggered the service autostart is not
being processed properly.
2009-10-29 15:40:08 +02:00
RISKÓ Gergely
b7ec8242e5 gdbus: handle introspection generally in generic_message.
Previously it was a specific case, now introspection is just another
interface, which is always implemented.  It is registered/unregistered
when an object path is referenced first/last.
2009-09-24 20:16:15 +03:00
RISKÓ Gergely
8f8cb865db Add introspection interface to the output of introspection calls
This provides better compatibility with some D-Bus clients, such as qdbus.
2009-09-14 18:25:13 +03:00
Marcel Holtmann
a5b1e3d02c Switch to a full non-recursive build system 2009-08-23 00:40:59 -07:00
Johan Hedberg
6c7c4ec6b0 Use NameHasOwner instead of ListNames for name checking 2009-08-08 20:22:40 +03:00
Marcel Holtmann
f19ee3a6dc Fix blocking service watch initial connect handling 2009-08-06 22:12:53 -07:00
Denis Kenzior
1f6936fe7c Make the parent path invalidateable 2009-05-11 11:50:18 -07:00
Luiz Augusto von Dentz
be02c289d9 Fix crash when calling g_dbus_remove_watch from inside the watch callback. 2009-05-06 17:15:27 -03:00
Luiz Augusto von Dentz
50686653da Fix g_dbus_remove_all_watches to remove all watches for the given connection. 2009-04-03 12:23:08 +03:00
Luiz Augusto von Dentz
9cf730b626 Fix gdbus watch function not handling multiple dbus connections.
gdbus was only adding a message filter for the very first connection given
by the user, this caused a bug in agent registration since it has a diffent
connection than previous watches it won't detect agent disappearing from the
bus.
2009-04-03 12:23:08 +03:00
Johan Hedberg
167546e0a2 Revert "Fix null dereference in gdbus/watch.c"
This reverts commit 2a96da99c7 so that gdbus
updates from obexd can be merged.
2009-04-03 12:22:44 +03:00
Gustavo F. Padovan
2a96da99c7 Fix null dereference in gdbus/watch.c
If name or data->name is null we have a null dereference. Not name and
data->name.
2009-04-01 08:50:38 +03:00
Marcel Holtmann
b8481a1eb4 Check that interface name is provided 2009-02-28 22:42:10 +01:00
Marcel Holtmann
fb333f1c88 Update copyright information 2009-01-01 19:33:20 +01:00
Raymond Liu
21f3750cf5 Check if path is valid before unregistering it 2008-12-24 07:15:50 +01:00
Marcel Holtmann
b75f83543a Fix issue with signed/unsigned comparison 2008-12-23 03:32:15 +01:00
Marcel Holtmann
1467329278 Use tabs for indentation 2008-12-20 21:51:39 +01:00
Marcel Holtmann
9fb751d212 Add missing gdbus function declarations 2008-12-06 15:45:28 +01:00
Marcel Holtmann
be0ba88ce4 Change file headers for D-Bus helper library 2008-12-06 15:40:08 +01:00
Marcel Holtmann
b892677f0b Don't expect reply when sending D-Bus messages 2008-11-26 14:33:21 +01:00
Marcel Holtmann
dfd3e56a3c Add function for checking if a service is present 2008-11-26 14:27:19 +01:00
Marcel Holtmann
132cd4ce64 Add g_dbus_add_service_watch() implementation 2008-10-17 19:18:51 +02:00
Marcel Holtmann
606e4a9280 Fix connection disconnect function 2008-10-17 18:33:11 +02:00
Marcel Holtmann
924541ea61 Change declaration of GDBusWatchFunction 2008-10-17 18:32:39 +02:00
Johan Hedberg
0b3d10c5ef Implement support g_dbus_create_error_valist 2008-09-11 14:33:31 +03:00
Marcel Holtmann
9db2625447 Remove g_dbus_unregister_all_interfaces function 2008-07-31 02:18:48 +02:00
Marcel Holtmann
24d6b3d375 Revert wrong listner id counter offset 2008-06-08 14:01:39 +00:00
Marcel Holtmann
1008177538 Avoid a watch id of 0 2008-06-08 13:42:27 +00:00
Marcel Holtmann
22ec945f10 Move some D-Bus helpers around 2008-06-07 20:09:25 +00:00
Marcel Holtmann
a1a65a6821 Don't abstract functions that are only used once 2008-06-07 19:53:51 +00:00
Marcel Holtmann
012cac6d32 Remove another unused function 2008-06-07 19:48:45 +00:00
Marcel Holtmann
7abfb49cae Make helper function static and local 2008-06-07 19:44:44 +00:00
Marcel Holtmann
a80ddb03c8 Remove unused defines 2008-06-07 19:42:42 +00:00
Marcel Holtmann
957b231578 Don't consider mainloop integration of dbus-glib 2008-06-07 19:35:09 +00:00
Marcel Holtmann
e26cc82994 Remove another obsolete function 2008-06-07 19:32:20 +00:00
Marcel Holtmann
f06919f229 Add proper signal sending helpers 2008-06-07 16:22:47 +00:00
Marcel Holtmann
c910fb98d0 Remove obsolete dbus_connection_get_object_user_data function 2008-06-07 16:14:31 +00:00
Marcel Holtmann
dd368f1988 Remove object path creation and destroy helpers 2008-06-06 13:52:43 +00:00
Marcel Holtmann
30877999b6 Remove obsolete D-Bus interface helpers 2008-06-06 10:45:39 +00:00
Marcel Holtmann
38b422bbfe Remove obsolete D-Bus sending helpers 2008-06-06 10:42:15 +00:00
Marcel Holtmann
c4d01c3cd1 Add simple g_dbus_unregister_all_interfaces implementation 2008-06-03 14:56:37 +00:00
Marcel Holtmann
21e5707fba Add skeleton for g_dbus_unregister_all_interfaces 2008-06-03 14:51:51 +00:00
Marcel Holtmann
7d1a9d5671 Remove GDBusDisconnectFunction type 2008-05-29 21:12:03 +00:00
Johan Hedberg
cc0f97ec2c Change name_listener API to libgdbus watch API 2008-05-29 14:43:27 +00:00
Marcel Holtmann
80d6914d16 Add helpers for sending async replies 2008-05-27 18:02:23 +00:00
Marcel Holtmann
671e8bc734 Add helpers for creating replies 2008-05-27 17:48:01 +00:00
Marcel Holtmann
1ed48482e5 Fix broken signal checking for new style API 2008-05-27 12:17:15 +00:00
Marcel Holtmann
d0b06ea8fd Add helpers for error creation 2008-05-27 11:42:46 +00:00
Marcel Holtmann
cc2d696524 More fixes for the message dispatch handling 2008-05-27 09:07:28 +00:00
Marcel Holtmann
aff0ec6707 Add new message dispatching 2008-05-27 08:50:36 +00:00
Marcel Holtmann
af6885a49f Fix object path reference count handling 2008-05-27 08:33:45 +00:00
Marcel Holtmann
e7bf43c753 Add introspection support for new interface handlers 2008-05-27 07:57:04 +00:00
Marcel Holtmann
ac79141ef5 Use reference counting for the object paths 2008-05-27 07:47:26 +00:00
Marcel Holtmann
97e97deb25 Add first implementation of libgdbus interface helpers 2008-05-27 07:20:56 +00:00
Marcel Holtmann
5567809ce0 Add prototypes for interface registration 2008-05-27 07:06:07 +00:00
Marcel Holtmann
9e9f9adde3 Add real libgdbus types for interface definitions 2008-05-27 06:59:19 +00:00
Marcel Holtmann
15ea15b3a7 Move D-Bus object and interface helpers into libgdbus 2008-05-08 22:19:14 +00:00
Marcel Holtmann
e7d668ac9e Move D-Bus watch functions into libgdbus 2008-05-08 20:23:45 +00:00
Marcel Holtmann
aa215d6fa5 Emulate libgdbus API for mainloop integration 2008-05-08 19:39:12 +00:00
Marcel Holtmann
33191e6275 Move D-Bus mainloop integration into libgdbus 2008-05-08 19:12:44 +00:00
Marcel Holtmann
5442ba4d63 Add skeleton for libgdbus support 2008-05-08 17:58:33 +00:00
Marcel Holtmann
bd3c21b0cc Add directory for libgdbus library 2008-05-08 17:36:48 +00:00