summaryrefslogtreecommitdiff
path: root/bus
AgeCommit message (Collapse)AuthorFilesLines
2013-08-23Export dbus_setenv() as a utility functionSimon McVittie4-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>
2013-08-23Revert "Factor out DBusAuthorization from DBusTransport"Simon McVittie1-11/+0
This reverts commit 600621dbc8073527a958091316eddfbb490c1032.
2013-08-23Factor out DBusAuthorization from DBusTransportCosimo Alfarano1-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>
2013-08-22GetConnectionCredentials: addSimon McVittie1-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>
2013-08-22Fix build with "--enable-stats"Chengwei Yang1-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>
2013-06-28tests to embedded tests: replaced in automake filesChengwei Yang1-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
2013-06-28tests to embedded tests: replaced in dbus-daemonChengwei Yang13-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
2013-06-28dir-watch: remove dnotify backendChengwei Yang3-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>
2013-06-26kqueue: remove unused variableChengwei Yang1-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
2013-06-25Convert a{sv} helpers from Stats into generic utility codeSimon McVittie1-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>
2013-06-24Fix build failure if build with "--enable-stats"Chengwei Yang1-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>
2013-06-20Let dbus-daemon not print unavailable options on windows.Ralf Habacker1-5/+23
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42441 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-17Make taking a global lock automatically initialize locking if neededSimon McVittie1-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>
2013-06-12Imported Upstream version 1.7.4upstream/1.7.4Simon McVittie6-482/+179
2013-06-12Fix dbus-daemon crash due to invalid service fileChengwei Yang1-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>
2013-06-06XML: hard depends on expat and delete libxmlChengwei Yang2-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>
2013-06-06Fix dbus-daemon crash due to invalid service fileChengwei Yang1-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>
2013-06-05Fix build error: unused-resultChengwei Yang1-2/+8
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-05When "activating" systemd, handle its special case betterChengwei Yang1-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>
2013-06-05Fix build error: unused-resultChengwei Yang1-2/+8
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-05When "activating" systemd, handle its special case betterChengwei Yang1-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>
2013-04-25Imported Upstream version 1.7.2upstream/1.7.2Simon McVittie6-102/+69
2013-04-22dbus.service.in: Do not order after syslog.targetCristian Rodríguez1-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>
2013-04-18Rename default_message_unix_fds to DEFAULT_MESSAGE_UNIX_FDSSimon McVittie1-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>
2013-04-11Set default maximum number of Unix fds according to OSMatt Fischer2-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>
2013-04-08Do not suppress syslog test's stderr just because init is systemdSimon McVittie1-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>
2013-02-27bus driver: factor out common code to get a named connectionSimon McVittie1-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>
2013-02-22Imported Upstream version 1.7.0upstream/1.7.0Simon McVittie5-5/+16
2013-02-21Fix inotify usage for QNXMatt Fischer1-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>
2013-02-12Merge <servicehelper> from included config fileKrzysztof Konopko1-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>
2012-10-04Merge branch 'dbus-1.6'Simon McVittie1-1/+1
Conflicts: NEWS bus/activation-helper.c configure.ac
2012-10-04activation helper: when compiled for tests, do not reset system bus addressSimon McVittie1-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
2012-09-29Imported Upstream version 1.6.6upstream/1.6.6Simon McVittie1-23/+5
2012-09-28activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctlyGeoffrey Thomas1-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>
2012-09-28hardening: Remove activation helper handling for DBUS_VERBOSEColin Walters1-13/+1
It's not really useful. See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
2012-09-28activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctlyGeoffrey Thomas1-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>
2012-09-28hardening: Remove activation helper handling for DBUS_VERBOSEColin Walters1-13/+1
It's not really useful. See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
2012-08-13Revert "Split DBUS_SESSION_BUS_DEFAULT_ADDRESS into listen, connect ↵Simon McVittie1-1/+1
addresses and set better defaults" This reverts commit b5d36dc27d1905d4d46ad7f0097f0ea0e0776adb. On second thoughts, this is too big a change for a stable branch.
2012-08-13Split DBUS_SESSION_BUS_DEFAULT_ADDRESS into listen, connect addresses and ↵Simon McVittie1-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>
2012-07-18Imported Upstream version 1.6.4upstream/1.6.4Simon McVittie1-1/+1
2012-06-27Imported Upstream version 1.6.2upstream/1.6.2Simon McVittie1-0/+1
2012-06-05Imported Upstream version 1.6.0upstream/1.6.0Simon McVittie3-25/+68
2012-04-12Avoid using monotonic time in the DBUS_COOKIE_SHA1 authentication methodDavid Zeuthen2-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
2012-03-27Imported Upstream version 1.5.12upstream/1.5.12Simon McVittie4-34/+143
2012-03-22test: enforce own_prefix policy rulesAlban Crequy3-8/+90
After parsing [allow|deny] rules with own_prefix, check they are enforced correctly. https://bugs.freedesktop.org/show_bug.cgi?id=46886
2012-03-22policy: remove unused parameterAlban Crequy3-4/+1
2012-03-04policy: enforce policy on "allow own_prefix"Alban Crequy1-1/+14
https://bugs.freedesktop.org/show_bug.cgi?id=46886
2012-03-04config parser: add own_prefixAlban Crequy2-21/+38
https://bugs.freedesktop.org/show_bug.cgi?id=46882
2012-02-21Imported Upstream version 1.5.10upstream/1.5.10Simon McVittie11-214/+244
2012-02-21Move _dbus_check_fdleaks_enter to dbus-message-internal.hSimon McVittie1-1/+1
This means the bus test can use them without needing dbus-message-private.h, reducing its view of message internals. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>