summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* dbus-monitor: disable automatic handling of o.fd.Peer messagesSimon McVittie2015-07-211-0/+5
| | | | | | | | | | | | | | | A normal DBusConnection will automatically reply to o.fd.Peer messages such as Ping. We don't want this: if we are using traditional eavesdropping with an older dbus-daemon, we'll confuse everyone else by replying to messages that weren't intended for us. If we are using the new Monitoring interface (since 1.9.12), the same still applies, but in addition, the dbus-daemon will disconnect us for not being a well-behaved monitor. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* Move session & system bus configuration to datadir, by default.Dimitri John Ledkov2015-05-271-2/+0
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Make UUID generation failableSimon McVittie2015-05-141-5/+2
| | | | | | | | | | | | | Previously, this would always succeed, but might use weak random numbers in rare failure cases. I don't think these UUIDs are security-sensitive, but if they're generated by a PRNG as weak as rand() (<= 32 bits of entropy), we certainly can't claim that they're universally unique. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> [smcv: document @error] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* tools: MSVC compile fixesRalf Habacker2015-05-012-2/+10
| | | | | | | | unistd.h and sleep() are normally Unix-specific, although mingw also provides them. The Windows C runtime documents _environ as its equivalent of Unix environ. https://bugs.freedesktop.org/show_bug.cgi?id=90089 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus_test_tool_spam: Fix 'variable payload going out of scope leaks the ↵Ralf Habacker2015-05-011-0/+1
| | | | | | | | | storage it points to' (CID 54759) Reported by Coverity: CID 54759: Resource leak (RESOURCE_LEAK) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus_test_tool_spam: Fix 'variable random_sizes going out of scope leaks the ↵Ralf Habacker2015-05-011-0/+2
| | | | | | | | | storage it points to' (CID 54761) Reported by Coverity: CID 54761: Resource leak (RESOURCE_LEAK) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Fix assorted compiler warnings on Windows.Simon McVittie2015-03-241-4/+2
| | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> [rh: rebased because a few hunks have already been applied with commit 92c39d1d8a30110c5760bd8d5e695e26a8538d1a]
* Fix of 'warning: variable ‘..‘ set but not used ↵Ralf Habacker2015-03-171-5/+1
| | | | | | | [-Wunused-but-set-variable]'. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-print-message: conditionalize Unix FD handling on DBUS_UNIXSimon McVittie2015-03-051-0/+2
| | | | | | | | | We close() the fd after we have printed it, but close() isn't standard functionality on Windows. Unix FD-passing is never going to work on non-Unix platforms anyway. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* dbus-monitor: use _dbus_get_real_time instead of gettimeofdaySimon McVittie2015-03-051-10/+4
| | | | | | | | | gettimeofday is implicitly declared (i.e. not in our #include'd header files) when cross-compiling for on Windows. Now that fd.o#83115 has been fixed, using _dbus functions is not a problem. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* Add missing header for _dbus_sleep_milliseconds() (commit 43d2455)Simon McVittie2015-03-041-0/+1
|
* Drop duplicated function tool_millisleep() and use dbus_sleep_milliseconds() ↵Ralf Habacker2015-03-043-21/+1
| | | | | | | instead. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Fix warning 'conversion to ‘long unsigned int’ from ‘WriteResult’ ↵Ralf Habacker2015-03-041-5/+8
| | | | | | | 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>
* Fix of 'warning: conversion to ‘dbus_bool_t‘ from ‘int‘ may change ↵Ralf Habacker2015-03-041-2/+2
| | | | | | | 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>
* Fix warning: conversion to 'DWORD' from 'int' may change the sign of the ↵Ralf Habacker2015-03-042-2/+2
| | | | | | | result [-Wsign-conversion]. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Trivial -Wsign-compare fixes.Ralf Habacker2015-03-042-3/+3
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=17289 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: Keep term 'dest' in --monitor output in sync with related ↵Ralf Habacker2015-02-241-2/+2
| | | | | | | | | watch expression. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> [smcv: rebase onto differently indented version of previous commit] Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* dbus-monitor: Add timestamp to --monitor mode.Ralf Habacker2015-02-244-64/+37
| | | | | | | | | | | 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>
* dbus-monitor: Keep parameter list of method returns in --monitor mode in ↵Ralf Habacker2015-02-241-1/+2
| | | | | | | sync with --profile mode. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: convert remaining hard tabs to 8 space.Ralf Habacker2015-02-241-216/+216
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-launch: if autolaunching, use XDG_RUNTIME_DIR/bus if availableSimon McVittie2015-02-242-4/+62
| | | | | | | | | | | | | | This provides backwards-compatible autolaunching behaviour, as long as dbus-launch inherits the XDG_RUNTIME_DIR (which it presumably did if it's going to work at all, since it must also have inherited the DISPLAY). In particular, we go through the motions of starting the dbus-daemon, so that we can start the "babysitter" process that will maintain the X11 window to store the bus address. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> [smcv: decorate _dbus_lookup_user_bus with DBUS_PRIVATE_EXPORT so we can still call it after fixing fd.o#83115; update cmake to match Autotools]
* dbus-launch: use libdbus to read the UUIDSimon McVittie2015-02-243-35/+21
| | | | | | | | | | | | | As a side benefit, this means that dbus-launch now understands /etc/machine-id and not just /var/lib/dbus/machine-id. Since machine_uuid comes out of libdbus allocated with dbus_malloc, to avoid having to copy it from malloc-allocated to dbus_malloc-allocated storage, it makes sense to change it to be consistently dbus_malloc-allocated (particularly now that Bug #83115 has made use of internal symbols relatively painless). However, I'm deliberately not changing the allocation model of any other strings in dbus-launch right now; that's a larger yak-shaving exercise.
* Add dbus-update-activation-environment toolSimon McVittie2015-02-242-0/+425
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If OS builders (distributions) have chosen to use the per-user bus, this provides two possible modes of operation for compatibility with existing X session startup hooks. A legacy-free system can just upload DISPLAY, XAUTHORITY and possibly DBUS_SESSION_BUS_ADDRESS into dbus-daemon's and systemd's activation environments, similar to http://cgit.freedesktop.org/systemd/systemd/tree/xorg/50-systemd-user.sh installed by systemd (but unlike systemctl, dbus-update-activation-environment works for traditional D-Bus-activated services, not just for systemd services). A system where compatibility is required for environment variables exported by snippets in /etc/X11/xinit/xinitrc.d (in Red Hat derivatives, Gentoo, etc.) or /etc/X11/Xsession.d (Debian derivatives) can upload the entire environment of the X session, minus some selected environment variables which are specific to a login session (notably XDG_SESSION_ID). In Debian, I plan to put the former in a new dbus-user-session package that enables a user-session-centric mode of operation for D-Bus, and the latter in the existing dbus-x11 package, with the intention that dbus-x11 eventually becomes a tool for change-averse setups or goes away entirely. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* dbus-monitor: Remove empty column in --profile mode.Ralf Habacker2015-02-161-3/+1
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89165 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: Combine sec and usec columns into one timestamp column and ↵Ralf Habacker2015-02-161-12/+4
| | | | | | | unify platform related format string. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89165 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: whitespaceSimon McVittie2015-02-161-1/+1
|
* dbus-monitor: clarify column headersSimon McVittie2015-02-161-2/+2
| | | | | | | | | - change "ref serial" to "in_reply_to" (avoiding whitespace for easy visual parsing) - prefix with # to clarify that these are not part of the data Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89165 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* dbus-monitor.c: unify columns format in --profile mode and display column ↵Ralf Habacker2015-02-161-3/+24
| | | | | | | | header. [rebase onto correctly indented version -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89165 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* dbus-monitor: convert remaining hard tabs to 8 spacesSimon McVittie2015-02-161-38/+38
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89165 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* dbus-send: pretty-print GVariant-style bytestringsSimon McVittie2015-02-162-30/+35
| | | | | | | | | | | | | | dbus-send could already pretty-print bytestrings that do not have \0 termination, but those are awkward to work with (they need copying), so they are now discouraged. Teach it to print bytestrings that do have \0 termination as well. In the process, rewrite this part of the message parser to use dbus_message_iter_get_fixed_array(), which is the Right way to get arrays of numbers out of a message. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89109 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* dbus-monitor: add options to log binary data with or without pcap framingSimon McVittie2015-02-043-5/+185
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* dbus-monitor: add support for using BecomeMonitor to be a read-only monitorSimon McVittie2015-02-041-9/+75
| | | | | | | | | Move the dbus_connection_add_filter() call further up as a precaution, because it isn't safe for a monitor to not have a filter that swallows all messages. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* dbus-monitor: use common code from dbus-test-toolSimon McVittie2015-02-042-13/+10
| | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787 Reviewed-by: Philip Withnall [also sync up the cmake build system -smcv]
* lcov: use builddir, not srcdirSimon McVittie2015-02-021-2/+2
| | | | | | | | It seems lcov (or gcc?) has changed its paths since last time this worked. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88808 Reviewed-by: Philip Withnall
* dbus-test-tool: add black-hole modeAlban Crequy2014-10-143-32/+123
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-test-tool spam: add --messages-per-conn=NAlban Crequy2014-10-141-17/+77
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Add dbus-test-tool, currently with "echo" and "spam" modesAlban Crequy2014-10-148-0/+842
| | | | | | | | | | This is installed by default, but easy to filter out for embedded systems or whatever. Based on earlier work by Simon McVittie and Will Thompson Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* GetAllMatchRules: provide an example how it could be usedAlban Crequy2014-10-062-0/+117
| | | | | | | [use dist_examples_SCRIPTS instead of EXTRA_DIST -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=84598 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: more details on file descriptorsAlban Crequy2014-09-151-1/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Print more details when receiving a file descriptor. Before: unix fd 5 After: file descriptor inode: 1030 type: char file descriptor inode: 295664 type: socket address family: unknown (16) file descriptor inode: 295665 type: socket address family: inet name 127.0.0.1 port 47723 peer 127.0.0.1 port 22 file descriptor inode: 295666 type: socket address family: unix name @/tmp/d67s774Sws0pEra file descriptor inode: 295667 type: socket address family: unix name @ peer @ Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80603 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: do not leak file descriptors from fd-passingAlban Crequy2014-09-151-0/+7
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80603 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-launch: kill bus if we can't attach to a session when requestedРоман Донченко2014-06-111-1/+1
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74698 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Avoid killing all available processes if an X error arrives early onРоман Донченко2014-04-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timeline of events in dbus-launch's main process goes something like this: * do initial X calls [1] * do some other stuff * fork (child process starts doing some other stuff) * return "intermediate parent" pid from fork() * obtain bus daemon pid from bus_pid_to_launcher_pipe [2] * do things that might include X11 calls or killing the dbus-daemon Meanwhile, the "babysitter" child goes like this: * return 0 from fork() [3] * obtain bus daemon pid from parent process via bus_pid_to_babysitter_pipe [4] * do things that might include X11 calls or killing the bus daemon Before [1] or [3], the right thing to do about an X error is to just exit. The current implementation called kill(-1) first, which is undesirable: it kills unrelated processes. With this change, we just exit. After [2] or [4], the right thing to do is to kill the dbus-daemon, and that's what the existing code did. Between [1] and [2], or between [3] and [4], there is no correct thing that we can do immediately: we would have to wait for the end of the "critical section", *then* kill the dbus-daemon. This has not yet been implemented, so this patch relies for its correctness on the fact that there are no libX11 calls between those points, so we cannot receive an X error between them. dbus-launch deserves more comments, or a reimplementation that is easier to understand, but this change is certainly better than nothing. [Commit message added, summarizing reviewers' comments -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74698 Reviewed-by: Simon McVittie Reviewed-by: Thiago Macieira
* Update .gitignore filesLukasz Skalski2014-03-061-0/+1
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75833 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Support printing unix file descriptors in dbus-send/dbus-monitorRobert Ancell2013-11-271-1/+9
| | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70592 Reviewed-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-monitor: keep backwards compatibilityChengwei Yang2013-10-091-6/+25
| | | | | | | | | | | | | | | | eavesdropping as a match rule key introduced in DBus 1.5.6, and the privous implementation doesn't keep backwards compatibility with older dbus-daemon. And the reference dbus-daemon implementation just fail if unknwon key found in match rule, this is undefined hehavior in DBus Sepcification. Also there is a feature request for change this hehavior to "ignore unknown key in match rule", See https://bugs.freedesktop.org/show_bug.cgi?id=66114 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66107 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-send: replace --address with --peer and --bus.Andrey Mazo2013-10-091-6/+31
| | | | | | | | | | --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>
* Revert "dbus-send: replace --address"... to fix attributionSimon McVittie2013-10-091-31/+6
| | | | This reverts commit 5b74af796c8f1d9f3f60594f22c6bfd4c097ad8b.
* Unify the way to find dbus-daemon test binaryChengwei Yang2013-10-081-29/+33
| | | | | | | | | | | | | | There are two ways to find the dbus-daemon for testing. The first one is defined as string at compile stage and the second one is export it from test environment. The first way has limitation that after defined, it's static string, so it's impossible to run installable check. So let's unify to the second way. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849 [added missing "}" -smcv] Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* dbus-send: replace --address with --peer and --bus.Simon McVittie2013-10-081-6/+31
| | | | | | | | | | --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>
* dbus-monitor: remove redundant match rulesChengwei Yang2013-10-081-16/+1
| | | | | | | | | | Currently, DBus Specification only consists of four message types, so to monitor all the types of message, no need to match all of them but just left it empty is OK. Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66107 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>