Commit graph

53 commits

Author SHA1 Message Date
Frederik Van Bogaert
38a98dbf02 dbus-send: Add support for variants to arrays and dictionaries
Adds support for:
* Arrays of variants
* Dictionaries with variants as keys

Manually tested and confirmed working using dbus-monitor.
Example usage:
```
$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus \
    com.example.SomeExample dict:string:variant:one,int16:1
```
In dbus-monitor:
```
method call time=1652796044.991509 sender=:1.84 -> destination=org.freedesktop.DBus
    serial=2 path=/org/freedesktop/DBus; interface=com.example; member=SomeExample
   array [
      dict entry(
         string "one"
         variant             int16 1
      )
   ]
```

Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
2022-05-23 12:15:02 +00:00
Simon McVittie
a42a07a1fb dbus-send: Validate interface, member names before use
Instead of a failed check or assertion failure and a core dump, let's
produce an error message on stderr and a graceful nonzero exit status.
It's still not going to *work*, but at least we can avoid crashing.

    $ dbus-send / com.example.Nope..Nope
    Interface name was not valid: 'com.example.Nope.'
    $ dbus-send / com.example.Nope.0
    Invalid signal name: Member name was not valid: '0'

Resolves: dbus#338
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-21 12:04:05 +01:00
Simon McVittie
dde5c8fdc4 dbus-send: Print an error message if object path is syntactically invalid
$ dbus-send // nope
    Object path was not valid: '//'

Related to dbus#338.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-21 12:02:27 +01:00
Christopher Morin
9842689a29 dbus-send: add --sender option
Clients listening for a signal can match against the 'sender', expecting
it to come from a connection with a specific name. With this change,
dbus-send can send signals to them.
2019-07-15 12:36:50 +00:00
David King
c0bf0d185d dbus-send: Avoid duplicated-branches warning
Switch the order of the argument checks to avoid the
-Wduplicated-branches warning.

Signed-off-by: David King <dking@redhat.com>
Reviewed-by: Simon McVittie <smcv@collabora.com>
2018-10-18 12:36:03 +01:00
Simon McVittie
10c026332b Merge branch 'dbus-1.10' 2017-09-25 17:02:50 +01:00
Simon McVittie
7b623b65c6 dbus-send: Reassure the compiler that secondary_type is initialized
It's initialized to a non-trivial value whenever container_type
is DBUS_TYPE_DICT_ENTRY, and subsequently only used if
container_type is DBUS_TYPE_DICT_ENTRY, but Debian's gcc 7.2.0-7
doesn't seem to be able to infer that any more, causing build failure
under -Werror=maybe-uninitialized.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102979
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-09-25 16:59:23 +01:00
Philip Withnall
0a700328e8 dbus-send: Handle OOM failures by aborting
This is a fairly pointless feature to add, since the current behaviour
was to abort due to a NULL pointer dereference shortly after the OOM
failure. At least now people will get a helpful error message when they
try to use dbus-send on a machine with incurable memory pressure.

Coverity ID: 54710
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99759
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2017-02-13 16:08:05 +00:00
Simon McVittie
7959d90719 Add missing function attributes suggested by clang (but not by gcc)
clang is a little more enthusiastic about suggesting these.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-10-13 22:44:13 +01:00
Thomas Zimmermann
d0be2333d5 Fix warnings from compiler option '-Wshadow'
Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98192
2016-10-10 18:04:09 +01:00
Ralf Habacker
72549f316f Fix of 'warning: conversion to ‘dbus_bool_t‘ from ‘int‘ may change the sign of the result [-Wsign-conversion]'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04 12:32:53 +01:00
Ralf Habacker
360a68eddd dbus-monitor: Add timestamp to --monitor mode.
Use cross platform function _dbus_get_real_time() for fetching current time.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: use %ld to avoid needing casts; reinstate printing the timestamp;
libdbus-1 is sufficient now that fd.o#83115 is fixed; print timestamp for
non-literal dbus-send replies too]
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-02-24 13:29:45 +00:00
Andrey Mazo
b994830c7f dbus-send: replace --address with --peer and --bus.
--peer is a direct substitute for --address.
With --bus dbus-send registers on bus given by ADDRESS, thus allowing
messages to be sent to the bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
[adjusted to apply to current master -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-09 11:18:20 +01:00
Simon McVittie
39673b945c Revert "dbus-send: replace --address"... to fix attribution
This reverts commit 5b74af796c.
2013-10-09 11:17:20 +01:00
Simon McVittie
5b74af796c dbus-send: replace --address with --peer and --bus.
--peer is a direct substitute for --address.
With --bus dbus-send registers on bus given by ADDRESS, thus allowing
messages to be sent to the bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
[adjusted to apply to current master -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-08 16:08:33 +01:00
Chengwei Yang
dd2ca80e3f dbus-send: Fix fail to run without "--dest" option
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65923
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-20 13:30:40 +01:00
Chengwei Yang
c690ee4351 dbus-send: check usage a bit strictly
This commit does several more strictly check for dbus-send as its usage
suggested.

* now --address is an invalid option but --address=, this just like the
  others, say --reply-timeout=, --dest=, --type=
* --print-reply= only take an optional argument "=literal"
* --print-reply= will cause error with missing MSEC and invalid MSEC
  will cause invalid value error
* --dest= will cause error with missing a NAME and also call
  dbus_validate_bus_name to verify the NAME

Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65424
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-06 13:07:51 +01:00
Simon McVittie
666344fc67 dbus-send.1, dbus-send: document --print-reply=literal consistently
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=14005
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
2012-02-14 16:15:59 +00:00
Simon McVittie
2ae391ccb3 dbus-send: remove minor dead code
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-05-25 16:11:27 +01:00
Marcus Brinkmann
5e4ef80e09 Add replacement functions strtoll/strtoull for dbus-send, mainly for Windows CE. 2010-04-13 21:08:10 +02:00
Marcus Brinkmann
f041773df2 Port dbus tools to Windows CE. 2010-04-13 20:58:20 +02:00
Tobias Mueller
5baf2f856a Bug 21161 - Update the FSF address
No comment.

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-10 19:32:38 -04:00
Lawrence R. Steeger
14afa0564e Bug 15412: Add --address option to dbus-send
Signed-off-by: Colin Walters <walters@verbum.org>
2008-10-18 14:50:49 -04:00
John (J5) Palmieri
d7446ac003 Revert "fix dbus-send so it can correctly send dictionaries"
This reverts commit a689ef29f1.

Conflicts:

	ChangeLog

* Turns out I reversed a patch that was alread committed but the bug had not
  been closed.  Since the patch was applied before I also reverted the
  mention of Jérémie in the AUTHORS list mainly for license book keeping
  sanity.
2008-04-04 14:58:07 -04:00
Jérémie Dimino
a689ef29f1 fix dbus-send so it can correctly send dictionaries
* tools/dbus-send.c (append_dict): Send in signature when opening up
  a dict entry container

* AUTHORS: Add Jérémie to AUTHORS file since it was a slightly above
  trivial fix
2008-04-03 11:32:09 -04:00
Havoc Pennington
4058579dae Do not provide a signature to dbus_message_iter_open_container() when opening a dict entry.
2008-03-27  Havoc Pennington  <hp@redhat.com>

	* tools/dbus-send.c (append_dict): Do not provide a signature to
	dbus_message_iter_open_container() when opening a dict entry.
2008-03-27 16:52:40 -04:00
Havoc Pennington
d012387afe 2007-07-13 Havoc Pennington <hp@redhat.com>
* Add indent-tabs-mode: nil to all file headers.
2007-07-14 02:44:01 +00:00
Ralf Habacker
572ae0a7d4 win32 compile fix 2006-12-31 11:31:12 +00:00
Havoc Pennington
89d97b4779 2006-10-17 Havoc Pennington <hp@redhat.com>
* tools/dbus-send.c (main): don't close shared connection, fix
	from Timo Hoenig
2006-10-17 22:31:16 +00:00
John (J5) Palmieri
7652304bff * s/D-BUS/D-Bus/g 2006-08-03 20:34:36 +00:00
Colin Walters
1889d97d4e 2005-08-01 Colin Walters <walters@verbum.org>
Patch from Joe Markus Clarke:

	* tools/dbus-send.c (main):

	Don't use C99 style initializers (bug #3933).
2005-08-01 16:10:34 +00:00
David Zeuthen
955cc78770 2005-07-13 David Zeuthen <davidz@redhat.com>
* tools/dbus-send.c (append_arg, type_from_name): Also support 16 and
        64 bit signed and unsigned parameters
2005-07-13 21:13:16 +00:00
Colin Walters
2ca6e95764 2005-07-06 Colin Walters <walters@verbum.org>
* dbus/dbus-glib.h (DBusGPendingCall, DBusGPendingCallNotify)
	(DBUS_TYPE_G_PENDING_CALL, dbus_g_pending_call_get_g_type)
	(dbus_g_pending_call_ref, dbus_g_pending_call_unref): Delete.
	(dbus_g_pending_call_set_notify, dbus_g_pending_call_cancel):
	Delete in favor of dbus_g_proxy_begin_call and
	dbus_g_proxy_cancel_call.
	(DBusGProxyCall, DBusGProxyCallNotify): New.
	(dbus_g_proxy_begin_call): Change prototype to take callback, user
	data, and destroy function.  This replaces
	dbus_g_pending_call_set_notify.
	(dbus_g_proxy_cancel_call): Prototype.
	(DBusGAsyncData): Delete, shouldn't be needed anymore.

	* glib/dbus-gproxy.c (struct _DBusGProxy): Add call_id_counter and
	pending_calls map.
	(struct _DBusGProxyManager): Add bus_proxy member, which is an
	internal proxy for calls to the bus. Remove
	pending_nameowner_calls, now the internal proxy keeps track.
	(dbus_g_proxy_manager_unref): Unref bus proxy, remove reference to
	pending_nameowner_calls.
	(got_name_owner_cb): Update prototype, and use
	dbus_g_proxy_end_call.
	(got_name_owner_cb): Remove reference to pending_nameowner_calls.
	(dbus_g_proxy_manager_register): Delete directly libdbus code in
	favor of using internal proxy.
	(dbus_g_proxy_manager_unregister): Update to use
	dbus_g_proxy_cancel_call for any pending GetNameOwner call.
	(dbus_g_proxy_init): Initialize pending calls map.
	(dbus_g_proxy_constructor): New.
	(dbus_g_proxy_class_init): Add get/set property functions,
	constructor, and add NAME, PATH, and INTERFACE properties.
	(cancel_pending_call): New function.
	(dbus_g_proxy_dispose): Iterate over any outstanding calls and
	cancel them.
	(dbus_g_proxy_set_property, dbus_g_proxy_get_property): New.
	(GPendingNotifyClosure): New structure.
	(d_pending_call_notify, d_pending_call_free): Moved here from
	dbus-glib.c.
	(DBUS_G_VALUE_ARRAY_COLLECT_ALL): Moved around to satisfy function
	ordering.
	(manager_begin_bus_call): New internal function for talking to
	internal bus proxy.
	(dbus_g_proxy_new): Construct object using GObjet properties.
	(dbus_g_proxy_begin_call_internal): Update to take user data, etc.
	Create closure of same, and insert call into map of pending calls.
	(dbus_g_proxy_end_call_internal): Take call id instead of pending
	call.  Look up pending call in current set.  Remove it when we've
	completed.
	(dbus_g_pending_call_end, dbus_g_proxy_end_call_internal): Delete.
	(dbus_g_proxy_begin_call): Change API to take callback, user data,
	and destroy function directly.
	(dbus_g_proxy_end_call): Update to take DBusGProxyCall.
	(dbus_g_proxy_call): Invoke with NULL callback.
	(dbus_g_proxy_cancel_call): New function, replaces
	dbus_g_pending_call_cancel.

	* glib/dbus-gparser.c (validate_signature): Fix call to
	dbus_set_g_error.

	* glib/dbus-gobject.c (dbus_g_object_type_dbus_metadata_quark):
	New quark for attaching metadata to GType.
	(info_hash): Delete.
	(lookup_object_info): Look up using quark.
	(dbus_g_object_type_install_info): Check that a type is classed,
	not that it's an object.  Also just install type data using quark
	instead of using global hash.

	* glib/dbus-glib.c (dbus_g_pending_call_ref)
	(dbus_g_pending_call_unref, dbus_pending_call_get_g_type)
	(GPendingNotifyClosure): Delete.
	(d_pending_call_notify, d_pending_call_free): Move to dbus-gproxy.c.
	(dbus_g_pending_call_set_notify, dbus_g_pending_call_cancel): Delete.

	* glib/dbus-binding-tool-glib.c (generate_client_glue): Disable async
	client method generation until we can fix it...

	* tools/dbus-viewer.c (load_child_nodes): Use dbus_g_proxy_call.
	(load_from_service_thread_func): Ditto.

	* tools/dbus-names-model.c (struct NamesModel): Hold
	DBusGProxyCall.
	(have_names_notify): Update prototype, use
	dbus_g_proxy_cancel_call.
	(names_model_reload): Update for new dbus_g_proxy_begin_call API.

	* tools/dbus-monitor.c (filter_func): Update for print_message
	API change.

	* test/glib/test-dbus-glib.c: Add more tests for async
	invocations.  Update many begin_call/end_call pairs to just use
	dbus_g_proxy_call.

	* tools/dbus-send.c (main): Add --print-reply=literal mode.  This
	allows us to dump print-introspect.c.

	* tools/dbus-print-message.h (print_message): Add literal argument
	to print_message which is intended to allow printing arguments without
	metadata like "string=".

	* tools/dbus-print-message.c (print_iter): Add literal argument.
	(print_message): Allow printing string messages literally.
2005-07-06 21:27:53 +00:00
Colin Walters
ab1ae1f4e2 2005-06-29 Colin Walters <walters@verbum.org>
* glib/dbus-gproxy.c (struct _DBusGProxy): Add new member
	name_call for keeping track of any outgoing GetNameOwner call.
	Also add for_owner and associated.
	(struct _DBusGProxyManager): Add owner_names, which is hash table
	that maps a base name to a list of names it owns (that we're
	interested in).  Add pending_nameowner_calls which is a list of
	all outstanding GetNameOwner; avoids us having to iterate over
	every proxy.  Add unassociated_proxies which keeps track of name
	proxies with no associated name owner.
	(dbus_g_proxy_manager_unref): Destroy owner_names.
	(struct DBusGProxyNameOwnerInfo): New struct for keeping track of
	name refcounts.
	(find_name_in_info, name_owner_foreach)
	(dbus_g_proxy_manager_lookup_name_owner, insert_nameinfo)
	(dbus_g_proxy_manager_monitor_name_owner)
	(dbus_g_proxy_manager_unmonitor_name_owner)
	(unassociate_proxies, dbus_g_proxy_manager_replace_name_owner):
	New functions; they manipulate the owner_names mapping.
	(got_name_owner_cb): New function.
	(get_name_owner): New function, extracted from
	dbus_g_proxy_new_for_name_owner.
	(dbus_g_proxy_manager_register): For now we need to keep track of
	all NameOwnerChanged.  Also if the proxy is for a name, if we
	don't already know the name owner, queue a new GetNameOwner
	request and add it to our list of unassociated proxies.  Otherwise
	inc the refcount.
	(dbus_g_proxy_manager_unregister): If this proxy is for a name,
	cancel any pending GetNameOwner call, etc.
	(dbus_g_proxy_manager_filter): Handle NameOwnerChanged.  Also use
	the owner_names mapping to look up the current names for the
	signal source, and dispatch to any proxies for that name.
	(dbus_g_proxy_new): Initialize new members.
	(dbus_g_proxy_new_for_name): Delete unused proxy variable.
	(dbus_g_proxy_new_for_name_owner): Use get_name_owner.
	(dbus_g_pending_call_end_valist): New function, extracted from
	dbus_g_proxy_end_call_internal.  Useful when we don't have a proxy
	but want to use the GLib infrastructure.  Also note how many
	arguments in reply were over.
	(dbus_g_pending_call_end): New function, just call
	dbus_g_pending_call_end_valist.
	(dbus_g_proxy_end_call_internal): Just call
	dbus_g_pending_call_end_valist.

	* glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): Fix lookup
	of builtin marshaller for STRING_STRING_STRING.

	* test/glib/test-dbus-glib.c:
	* test/glib/test-service-glib.c:
	* test/glib/test-service-glib.xml:
	Extend tests to cover name proxies, destruction of owner proxies,
	etc.

	* glib/examples/example-signal-recipient.c
	(dbus_g_proxy_new_for_name_owner): Create a name proxy.

	* tools/dbus-send.c (main): Print D-BUS error name in addition
	to message.
2005-06-29 16:59:00 +00:00
Colin Walters
70bd20a50e 2005-06-16 Colin Walters <walters@verbum.org>
* tools/dbus-send.c (append_array): Use strtok.
	(append_dict): New function.
	(type_from_name): New function, extracted from main.
	(main): Handle sending dicts.

	* tools/dbus-print-message.c (print_iter): Print dict
	entries.
2005-06-16 04:48:10 +00:00
John (J5) Palmieri
f03c0af1c7 * tools/dbus-send.c (main):
s/dbus_connection_disconnect/dbus_connection_close

	* test/glib/test-profile.c (no_bus_thread_func, with_bus_thread_func):
	s/dbus_connection_disconnect/dbus_connection_close

	* test/test-service.c (path_message_func, filter_func):
	s/dbus_connection_disconnect/dbus_connection_close
2005-06-02 18:22:04 +00:00
Colin Walters
3fa4c2f404 2005-05-11 Colin Walters <walters@verbum.org>
* tools/dbus-send.c (append_array): New function.
	(append_arg): Broken out from main.
	(main): Add cheesy hack to send arrays and variants.
	(usage): Update.
	* tools/dbus-print-message.c (print_iter): Broken out
	from main.
2005-05-11 18:48:24 +00:00
Havoc Pennington
8873c90f99 2005-01-18 Havoc Pennington <hp@redhat.com>
* Throughout, grand renaming to strip out the use of "service",
	just say "name" instead (or "bus name" when ambiguous).  Did not
	change the internal code of the message bus itself, only the
	programmer-facing API and messages.

	* doc/dbus-specification.xml: further update the message bus section

	* bus/config-parser.c (all_are_equiv): fix bug using freed string
	in error case
2005-01-18 20:42:15 +00:00
Havoc Pennington
62e465339a 2005-01-17 Havoc Pennington <hp@redhat.com>
* dbus/dbus-types.h: hardcode dbus_bool_t to 32 bits

	* Throughout: modify DBUS_TYPE_BOOLEAN to be a 32-bit type instead
	of an 8-bit type. Now dbus_bool_t is the type to use whenever you
	are marshaling/unmarshaling a boolean.
2005-01-17 19:49:52 +00:00
Havoc Pennington
31988af408 2005-01-16 Havoc Pennington <hp@redhat.com>
* Add and fix docs according to Doxygen warnings throughout
	source.

	* dbus/dbus-marshal-recursive.c
	(_dbus_type_reader_array_is_empty): change this to just call
	array_reader_get_array_len() and make it static

	* dbus/dbus-message.c (dbus_message_iter_get_element_type): rename
	from get_array_type
	(dbus_message_iter_init_append): rename from append_iter_init

	* dbus/dbus-marshal-recursive.c
	(_dbus_type_reader_get_element_type): rename from
	_dbus_type_reader_get_array_type
2005-01-16 15:51:55 +00:00
Havoc Pennington
9c3d566e95 2005-01-15 Havoc Pennington <hp@redhat.com>
* Land the new message args API and type system.

	This patch is huge, but the public API change is not
	really large. The set of D-BUS types has changed somewhat,
	and the arg "getters" are more geared toward language bindings;
	they don't make a copy, etc.

	There are also some known issues. See these emails for details
	on this huge patch:
	http://lists.freedesktop.org/archives/dbus/2004-December/001836.html
        http://lists.freedesktop.org/archives/dbus/2005-January/001922.html

	* dbus/dbus-marshal-*: all the new stuff

	* dbus/dbus-message.c: basically rewritten

	* dbus/dbus-memory.c (check_guards): with "guards" enabled, init
	freed blocks to be all non-nul bytes so using freed memory is less
	likely to work right

	* dbus/dbus-internals.c (_dbus_test_oom_handling): add
	DBUS_FAIL_MALLOC=N environment variable, so you can do
	DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or
	DBUS_FAIL_MALLOC=10 to make it really, really, really slow and
	thorough.

	* qt/message.cpp: port to the new message args API
	(operator<<): use str.utf8() rather than str.unicode()
	(pretty sure this is right from the Qt docs?)

	* glib/dbus-gvalue.c: port to the new message args API

	* bus/dispatch.c, bus/driver.c: port to the new message args API

	* dbus/dbus-string.c (_dbus_string_init_const_len): initialize the
	"locked" flag to TRUE and align_offset to 0; I guess we never
	looked at these anyhow, but seems cleaner.

	* dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING):
	move allocation padding macro to this header; use it to implement
	(_DBUS_STRING_STATIC): ability to declare a static string.

	* dbus/dbus-message.c (_dbus_message_has_type_interface_member):
	change to return TRUE if the interface is not set.

	* dbus/dbus-string.[hc]: move the D-BUS specific validation stuff
	to dbus-marshal-validate.[hc]

	* dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from
	dbus-internals.c

	* dbus/Makefile.am: cut over from dbus-marshal.[hc]
	to dbus-marshal-*.[hc]

	* dbus/dbus-object-tree.c (_dbus_decompose_path): move this
	function here from dbus-marshal.c
2005-01-15 07:15:38 +00:00
Colin Walters
fefa40496b 2004-08-11 Colin Walters <walters@redhat.com>
* tools/dbus-send.c (main, usage): Add --reply-timeout
	argument.
2004-08-11 14:59:34 +00:00
Havoc Pennington
a221eefadf 2004-03-27 Havoc Pennington <hp@redhat.com>
Patch from Timo Teräs:

	* tools/dbus-send.c (main): if --print-reply, assume type is
	method call; support boolean type args

	* dbus/dbus-connection.c (dbus_connection_send_with_reply): fix a
	bunch of memleak and logic bugs
2004-03-27 05:29:31 +00:00
Havoc Pennington
6a65f4802e 2003-10-09 Havoc Pennington <hp@redhat.com>
Make matching rules theoretically work (add parser).

	* bus/bus.c (bus_context_check_security_policy): fix up to handle
	the case where destination is explicitly specified as bus driver
	and someone else is eavesdropping.

	* bus/policy.c (bus_client_policy_check_can_receive): fix up
	definition of eavesdropping and assertion

	* tools/dbus-send.c (main): use dbus_message_type_from_string

	* bus/signals.c (bus_match_rule_parse): implement

	* dbus/dbus-message.c (dbus_message_type_from_string): new

	* dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add
2003-10-10 02:42:21 +00:00
Havoc Pennington
a683a80c40 2003-09-21 Havoc Pennington <hp@pobox.com>
Get matching rules mostly working in the bus; only actually
	parsing the rule text remains. However, the client side of
	"signal connections" hasn't been started, this patch is only the
	bus side.

	* dbus/dispatch.c: fix for the matching rules changes

	* bus/driver.c (bus_driver_handle_remove_match)
	(bus_driver_handle_add_match): send an ack reply from these
	method calls

	* glib/dbus-gproxy.c (dbus_gproxy_begin_call): fix order of
	arguments, reported by Seth Nickell

	* bus/config-parser.c (append_rule_from_element): support
	eavesdrop=true|false attribute on policies so match rules
	can be prevented from snooping on the system bus.

	* bus/dbus-daemon-1.1.in: consistently use terminology "sender"
	and "destination" in attribute names; fix some docs bugs;
	add eavesdrop=true|false attribute

	* bus/driver.c (bus_driver_handle_add_match)
	(bus_driver_handle_remove_match): handle AddMatch, RemoveMatch
	messages

	* dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST): get
	rid of broadcast service concept, signals are just always broadcast

	* bus/signals.c, bus/dispatch.c, bus/connection.c, bus/bus.c:
	mostly implement matching rules stuff (currently only exposed as signal
	connections)
2003-09-21 19:53:56 +00:00
Havoc Pennington
5fd1e389e1 2003-08-30 Havoc Pennington <hp@pobox.com>
* test/data/valid-config-files/system.d/test.conf: change to
	root for the user so warnings don't get printed

	* dbus/dbus-message.c: add dbus_message_get_path,
	dbus_message_set_path

	* dbus/dbus-object-tree.c (do_test_dispatch): add test of
	dispatching to a path

	* dbus/dbus-string.c (_dbus_string_validate_path): add

	* dbus/dbus-marshal.c (_dbus_demarshal_object_path): implement
	(_dbus_marshal_object_path): implement

	* dbus/dbus-protocol.h (DBUS_HEADER_FIELD_PATH): new header field
	to contain the path to the target object
	(DBUS_HEADER_FIELD_SENDER_SERVICE): rename
	DBUS_HEADER_FIELD_SENDER to explicitly say it's the sender service
2003-08-31 01:51:44 +00:00
Havoc Pennington
68a3c593b9 2003-08-18 Havoc Pennington <hp@redhat.com>
* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix

	* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
	dumb bug created earlier (wrong order of args to
	decode_header_data())

	* tools/dbus-send.c: port

	* tools/dbus-print-message.c (print_message): port

        * test/data/*messages: port all messages over

        * dbus/dbus-message-builder.c: support including
	message type

        * bus/driver.c: port over

	* bus/dispatch.c: port over to new stuff

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	rename disconnect signal to "Disconnected"
2003-08-18 22:43:30 +00:00
Havoc Pennington
b29ea9115e 2003-08-10 Havoc Pennington <hp@pobox.com>
* tools/dbus-send.c (main): add --type argument, for now
	supporting only method_call and signal types.

	* tools/dbus-print-message.c: print message type

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	init connection->objects

	* doc/dbus-specification.sgml: fix sgml

	* bus/*.c: port over to object-instance API changes

	* test/test-service.c: ditto

	* dbus/dbus-message.c (dbus_message_create_header): allow #NULL
	name, we will have to fix up the rest of the code to also handle
	this
	(dbus_message_new): generic message-creation call
	(set_string_field): allow appending name field
2003-08-11 02:11:58 +00:00
Anders Carlsson
e94493fc11 2003-06-19 Philip Blundell <philb@gnu.org>
* tools/dbus-print-message.c (print_message): Handle BOOLEAN.

	* tools/dbus-send.c: Accept both --system and --session.

	* tools/dbus-monitor.c: Same here.
2003-06-19 22:22:37 +00:00
Colin Walters
fc5e3a06cf 2003-05-17 Colin Walters <walters@gnu.org>
* tools/dbus-send.c: Don't exit with an error code if --help was
	passed.  Default to using the session bus instead of the system
	one.

	* tools/dbus-launch.c: Ditto.

	* tools/dbus-monitor.c: Ditto.

	* tools/dbus-send.1: Update with new arguments.

	* tools/dbus-launch.c: Emit code to export variables.  New
	arguments -s and -c to specify shell syntax, and a bit of code to
	autodetect syntax.  Also, allow specifying a program to run.

	* tools/dbus-launch.1: Update with new arguments.

	* tools/dbus-send.1: Ditto.

	* tools/dbus-monitor.1: Ditto.
2003-05-18 02:39:47 +00:00