summaryrefslogtreecommitdiff
path: root/bus
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'dbus-1.6'Simon McVittie2013-10-231-1/+29
|\
| * path_namespace='/' should match everythingSimon McVittie2013-10-231-1/+29
| | | | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70799 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: Ryan Lortie <desrt@desrt.ca>
| * Fix dbus-daemon crash due to invalid service fileChengwei Yang2013-06-121-0/+6
| | | | | | | | | | | | | | | | | | | | dbus-daemon will crash due to invalid service file which key/value starts before section. In that situation, new_line() will try to access invalid address. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60853 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
| * Fix build error: unused-resultChengwei Yang2013-06-051-2/+8
| | | | | | | | | | Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
| * When "activating" systemd, handle its special case betterChengwei Yang2013-06-051-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dbus-daemon receives a request to activate a systemd service before systemd has connected to it, it enqueues a fake request to "activate" systemd itself (as a way to get a BusPendingActivationEntry to track the process of waiting for systemd). When systemd later joins the bus, dbus-daemon sends the actual activation message; any future activation messages are sent directly to systemd. In the "pending" code path, the activation messages are currently dispatched as though they had been sent by the same process that sent the original activation request, which is wrong: the bus security policy probably doesn't allow that process to talk to systemd directly. They should be dispatched as though they had been sent by the dbus-daemon itself (connection == NULL), the same as in the non-pending code path. In the worst case, if the attempt to activate systemd timed out, the dbus-daemon would crash with a (fatal) warning, because in this special case, activation_message is a signal with no serial number, whereas the code to send an error reply is expecting a method call with a serial number. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=50199 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Tested-by: Ma Yu <yu.ma@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Remove unused key-word of DBus .service fileChengwei Yang2013-10-091-1/+0
| | | | | | | | | | | | | | | | Key-word "Group" of DBus .service file hasn't been used since it was introduced in 2007, so it's fine to remove it. https://bugs.freedesktop.org/show_bug.cgi?id=19158 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | launch-helper: fix error code parsingChengwei Yang2013-10-093-2/+10
| | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66728 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | bus-test: only expect GetConnectionUnixProcessID to succeed sometimesSimon McVittie2013-09-231-0/+6
| | | | | | | | | | | | | | On platforms that use getpeereid(), this can't work. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340 Reviewed-by: Colin Walters <walters@verbum.org>
* | selinux: when dropping capabilities only include AUDIT caps if we have themLennart Poettering2013-09-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we drop capabilities we shouldn't assume we can keep CAP_AUDIT_WRITE unconditionally, since it will not be available when running in containers. This patch only adds CAP_AUDIT_WRITE to the list of caps we keep if we actually have it in the first place. This makes audit/selinux enabled D-Bus work in a Linux container. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49062 Acked-by: Thiago Macieira <thiago@kde.org> Acked-by: Colin Walters <walters@verbum.org> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Allow dbus-daemon --nofork on WindowsSimon McVittie2013-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, the dbus-daemon is not able to fork (daemonize). If someone explicitly requests forking, it should fail, but if someone explicitly requests *not* forking, there seems no harm in allowing it. A few of the regression tests specifically require a dbus-daemon that will not fork, so allowing this option on Windows means those tests don't need an extra OS condition. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* | Fix unused function when SELinux is not enabledSimon McVittie2013-08-301-3/+4
| | | | | | | | It must be one of the "only smcv tests this" configurations...
* | _dbus_get_tmpdir: be thread-safeSimon McVittie2013-08-291-1/+7
| | | | | | | | | | | | | | | | | | Sharing a static variable between threads is not safe in general, and this function is used in the shared libdbus (for nonce files), so it can't rely on being single-threaded. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* | Cleanup: simplify assertion checkChengwei Yang2013-08-231-14/+3
| | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | fix whitespaceSimon McVittie2013-08-231-1/+1
| |
* | Cleanup: polish inotify backendChengwei Yang2013-08-231-9/+7
| | | | | | | | | | | | | | | | | | | | | | At previous, it will do get pid and print a verbose string per inotify event, and then do send signal to the daemon. This patch changes the behavior to get pid and print a verbose string one time. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Cleanup: polish verbose mode checkingChengwei Yang2013-08-232-16/+5
| | | | | | | | Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Export dbus_setenv() as a utility functionSimon McVittie2013-08-234-9/+13
| | | | | | | | | | | | | | | | | | | | It's sufficiently portable that GLib has an equivalent, and I really don't want to have to either open-code it in dbus-run-session or link dbus-run-session statically. We have enough statically-linked rubbish already. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196 Reviewed-by: Colin Walters <walters@verbum.org>
* | Revert "Factor out DBusAuthorization from DBusTransport"Simon McVittie2013-08-231-11/+0
| | | | | | | | This reverts commit 600621dbc8073527a958091316eddfbb490c1032.
* | Factor out DBusAuthorization from DBusTransportCosimo Alfarano2013-08-231-0/+11
| | | | | | | | | | | | | | | | | | | | In order to authorize/reject a connection in a polite way, instead of cutting it off after authentication succeed and Hello() is sent, because authorization failed, we need to factor out some authorization bits from DBusTransport and pass them to DBusAuth. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | GetConnectionCredentials: addSimon McVittie2013-08-221-0/+77
| | | | | | | | | | | | | | | | | | | | | | The initial set of credentials is just UnixUserID and ProcessID. The rest can follow when someone is sufficiently interested to actually test them. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> [rename a function that Ralf found unclear -smcv] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Fix build with "--enable-stats"Chengwei Yang2013-08-221-1/+1
| | | | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | tests to embedded tests: replaced in automake filesChengwei Yang2013-06-281-2/+2
| | | | | | | | | | | | Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
* | tests to embedded tests: replaced in dbus-daemonChengwei Yang2013-06-2813-30/+30
| | | | | | | | | | | | Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
* | dir-watch: remove dnotify backendChengwei Yang2013-06-283-104/+0
| | | | | | | | | | | | | | | | | | | | dnotify as a dir watch backend is broken since Jan 2010 (almost 3.5 years). According to fd.o: #33001, it's no harm to remove dnotify from this project. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33001 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | kqueue: remove unused variableChengwei Yang2013-06-261-1/+1
| | | | | | | | | | | | Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66035
* | Convert a{sv} helpers from Stats into generic utility codeSimon McVittie2013-06-251-187/+52
| | | | | | | | | | | | Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* | Fix build failure if build with "--enable-stats"Chengwei Yang2013-06-241-2/+3
| | | | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66004 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Let dbus-daemon not print unavailable options on windows.Ralf Habacker2013-06-201-5/+23
| | | | | | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42441 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Make taking a global lock automatically initialize locking if neededSimon McVittie2013-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets them be thread-safe by default, at the cost that they can now fail. init_uninitialized_locks() and init_global_locks() must now both reimplement the equivalent of _dbus_register_shutdown_func(), by using _dbus_platform_rmutex_lock() on the same underlying mutex around a call to _dbus_register_shutdown_func_unlocked(). This is because if they used the usual _DBUS_LOCK() API (as _dbus_register_shutdown_func() does), it would automatically try to initialize global locking, leading to infinite recursion. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> Reviewed-by: Anas Nashif <anas.nashif@intel.com>
* | XML: hard depends on expat and delete libxmlChengwei Yang2013-06-062-329/+0
| | | | | | | | | | | | | | | | | | [The libxml code path has been broken for at least 2.5 years, and Expat is tiny, so there seems no point in supporting both. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=20253 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Fix dbus-daemon crash due to invalid service fileChengwei Yang2013-06-061-0/+6
| | | | | | | | | | | | | | | | | | | | dbus-daemon will crash due to invalid service file which key/value starts before section. In that situation, new_line() will try to access invalid address. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60853 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Fix build error: unused-resultChengwei Yang2013-06-051-2/+8
| | | | | | | | | | Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | When "activating" systemd, handle its special case betterChengwei Yang2013-06-051-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dbus-daemon receives a request to activate a systemd service before systemd has connected to it, it enqueues a fake request to "activate" systemd itself (as a way to get a BusPendingActivationEntry to track the process of waiting for systemd). When systemd later joins the bus, dbus-daemon sends the actual activation message; any future activation messages are sent directly to systemd. In the "pending" code path, the activation messages are currently dispatched as though they had been sent by the same process that sent the original activation request, which is wrong: the bus security policy probably doesn't allow that process to talk to systemd directly. They should be dispatched as though they had been sent by the dbus-daemon itself (connection == NULL), the same as in the non-pending code path. In the worst case, if the attempt to activate systemd timed out, the dbus-daemon would crash with a (fatal) warning, because in this special case, activation_message is a signal with no serial number, whereas the code to send an error reply is expecting a method call with a serial number. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=50199 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Tested-by: Ma Yu <yu.ma@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | dbus.service.in: Do not order after syslog.targetCristian Rodríguez2013-04-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is no longer required or recommended in fact it no longer exists since http://cgit.freedesktop.org/systemd/systemd/commit/?id=5d4caf565471ff3401bd9b53aa814c8545a18a93 [Clarification: there are two reasons why we do not need that dependency. First, we do not have DefaultDependencies=no, so we only get run after sockets.target. Second, syslog.socket doesn't provide /dev/log, which is part of systemd-journald.socket. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63531 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Rename default_message_unix_fds to DEFAULT_MESSAGE_UNIX_FDSSimon McVittie2013-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | As Ralf pointed out, we usually use upper-case when substituting variables (apart from "somethingdir", which Autoconf conventionally makes lower-case for some reason). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63682 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* | Set default maximum number of Unix fds according to OSMatt Fischer2013-04-112-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QNX has an arbitrary limit to the number of file descriptors which may be passed in a message, which is smaller than the current default. This patch therefore changes the default from a hardcoded constant to a macro, which is determined at configure time by looking at the host operating system. [This reduces the limit from 4096 (session)/1024 (system) to 128 fds per message on QNX, and 1024 fds per message on other operating systems. I think the reduced session bus limit on other OSs is a reasonable change too, given that the default hard/soft ulimits in Linux are only 4096/1024 fds per process. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176 Reviewed-by: Simon McVittie <simon.mcvittie.collabora.co.uk>
* | Do not suppress syslog test's stderr just because init is systemdSimon McVittie2013-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | This causes the test to fail. The assumption implicitly being made was "if pid 1 is systemd, then every caller of _dbus_init_system_log() is a systemd service" which is not valid for the regression test. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63163 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Colin Walters <walters@verbum.org>
* | bus driver: factor out common code to get a named connectionSimon McVittie2013-02-271-96/+63
| | | | | | | | | | | | Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Reviewed-by: Thiago Macieira <thiago@kde.org>
* | Fix inotify usage for QNXMatt Fischer2013-02-211-0/+4
| | | | | | | | | | | | | | | | | | QNX's copy of sys/inotify.h is broken, and doesn't include stdint.h even though it refers to types from it. Therefore, it must be included manually. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Merge <servicehelper> from included config fileKrzysztof Konopko2013-02-121-1/+8
| | | | | | | | | | | | | | | | | | | | | | <servicehelper> is not supported in the included config file, i. e. it's not merged in merge_included(). There's clearly no reason it shouldn't be supported in the included config file along with <user>, <type> and others. It's quite reasonable for a client willing to override the default servicehelper, e. g. in system-local.conf. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=51560 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* | Merge branch 'dbus-1.6'Simon McVittie2012-10-041-1/+1
|\ \ | |/ | | | | | | | | | | Conflicts: NEWS bus/activation-helper.c configure.ac
| * activation helper: when compiled for tests, do not reset system bus addressSimon McVittie2012-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | Otherwise, the tests try to connect to the real system bus, which will often fail - particularly if you run the tests configured for the default /usr/local (with no intention of installing the result), in which case the tests would try to connect to /usr/local/var/run/dbus/system_bus_socket. Reviewed-by: Colin Walters <walters@verbum.org> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=52202
| * activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctlyGeoffrey Thomas2012-09-281-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for CVE-2012-3524 filters out all environment variables if libdbus is used from a setuid program, to prevent various spoofing attacks. Unfortunately, the activation helper is a setuid program linking libdbus, and this creates a regression for launched programs using DBUS_STARTER_ADDRESS, since it will no longer exist. Fix this by hardcoding the starter address to the default system bus address. Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com> Signed-off-by: Colin Walters <walters@verbum.org>
| * hardening: Remove activation helper handling for DBUS_VERBOSEColin Walters2012-09-281-13/+1
| | | | | | | | | | | | It's not really useful. See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
| * Revert "Split DBUS_SESSION_BUS_DEFAULT_ADDRESS into listen, connect ↵Simon McVittie2012-08-131-1/+1
| | | | | | | | | | | | | | | | addresses and set better defaults" This reverts commit b5d36dc27d1905d4d46ad7f0097f0ea0e0776adb. On second thoughts, this is too big a change for a stable branch.
* | activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctlyGeoffrey Thomas2012-09-281-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for CVE-2012-3524 filters out all environment variables if libdbus is used from a setuid program, to prevent various spoofing attacks. Unfortunately, the activation helper is a setuid program linking libdbus, and this creates a regression for launched programs using DBUS_STARTER_ADDRESS, since it will no longer exist. Fix this by hardcoding the starter address to the default system bus address. Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com> Signed-off-by: Colin Walters <walters@verbum.org>
* | hardening: Remove activation helper handling for DBUS_VERBOSEColin Walters2012-09-281-13/+1
|/ | | | | | It's not really useful. See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
* Split DBUS_SESSION_BUS_DEFAULT_ADDRESS into listen, connect addresses and ↵Simon McVittie2012-08-131-1/+1
| | | | | | | | | | | | | | | | set better defaults On Unix, the connect address should basically always be "autolaunch:" but the listen address has to be something you can listen on. On Windows, you can listen on "autolaunch:" or "autolaunch:scope=*install-path", for instance, and the dbus-daemon is involved in the auto-launching process. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38201 Reviewed-by: David Zeuthen <davidz@redhat.com> [default address changed to autolaunch: for interop with GDBus -smcv] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Avoid using monotonic time in the DBUS_COOKIE_SHA1 authentication methodDavid Zeuthen2012-04-122-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | When libdbus-1 moved to using monotonic time support for the DBUS_COOKIE_SHA1 authentication was broken, in particular interoperability with non-libdbus-1 implementations such as GDBus. The problem is that if monotonic clocks are available in the OS, _dbus_get_current_time() will not return the number of seconds since the Epoch so using it for DBUS_COOKIE_SHA1 will violate the D-Bus specification. If both peers are using libdbus-1 it's not a problem since both ends will use the wrong time and thus agree. However, if the other end is another implementation and following the spec it will not work. First, we change _dbus_get_current_time() back so it always returns time since the Epoch and we then rename it _dbus_get_real_time() to make this clear. We then introduce _dbus_get_monotonic_time() and carefully make all current users of _dbus_get_current_time() use it, if applicable. During this audit, one of the callers, _dbus_generate_uuid(), was currently using monotonic time but it was decided to make it use real time instead. Signed-off-by: David Zeuthen <davidz@redhat.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48580
* test: enforce own_prefix policy rulesAlban Crequy2012-03-223-8/+90
| | | | | | | After parsing [allow|deny] rules with own_prefix, check they are enforced correctly. https://bugs.freedesktop.org/show_bug.cgi?id=46886