Commit graph

3526 commits

Author SHA1 Message Date
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
Chengwei Yang
c9b942e56f Assign default value to enable compiler coverage
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:05:38 +01:00
Chengwei Yang
049a132b86 Fix a typo: enable_x11 -> have_x11
From git history, enable_x11 was used to track have_x11, but it's
useless now.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65443
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-06 13:04:38 +01:00
Chengwei Yang
46602768c5 XML: hard depends on expat and delete libxml
[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-06 13:02:24 +01:00
Chengwei Yang
0a76508672 Fix dbus-daemon crash due to invalid service file
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-06 12:58:56 +01:00
Chengwei Yang
ff641bdb2f Do not suggest user to do 'make' if configure failed
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65415
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-06 12:57:40 +01:00
Simon McVittie
9760bdf393 massively simplify run-with-tmp-session-bus.sh by using dbus-run-session
It turns out that if you don't second-guess the system by catching
SIGINT, the right things happen: it's received by every program in the
foreground process group, including dbus-run-session and dbus-daemon.
Neither of those catch SIGINT (unlike dbus-launch) so they'll exit
gracefully without the wrapper script needing to do anything special.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Reviewed-by: Colin Walters <walters@verbum.org>
2013-06-05 17:58:52 +01:00
Simon McVittie
9c0ef70288 Recomend dbus-run-session over dbus-launch for starting text-mode sessions
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Reviewed-by: Colin Walters <walters@verbum.org>
[reformatted from roff to Docbook -smcv]
2013-06-05 17:58:51 +01:00
Simon McVittie
59acbc4854 Put dbus-run-session through doclifter and adjust to match other man pages 2013-06-05 17:58:51 +01:00
Simon McVittie
f691c24dd1 Add dbus-run-session
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Reviewed-by: Colin Walters <walters@verbum.org>
2013-06-05 17:55:23 +01:00
Simon McVittie
108ea348d8 NEWS 2013-06-05 17:00:40 +01:00
Chengwei Yang
eba9402951 Fix build error: unused-result
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-05 16:56:15 +01:00
Chengwei Yang
371e7b000d doc: fix a little bit for dbus-send
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-05 16:56:15 +01:00
Chengwei Yang
8b3681e35d When "activating" systemd, handle its special case better
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-05 16:33:59 +01:00
Simon McVittie
d35f64339e Remove unused global mutexes for win_fds, sid_atom_cache
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: Ralf Habacker <ralf.habacker@freenet.de>
2013-05-13 11:58:38 +01:00
Simon McVittie
24a9b93021 Turn a runtime assertion into a compile-time assertion
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: Ralf Habacker <ralf.habacker@freenet.de>
2013-05-10 17:04:31 +01:00
Simon McVittie
e8136f0d30 NEWS for part 1 of fd.o#54972 2013-05-10 12:59:35 +01:00
Simon McVittie
17a23d08b5 dbus_threads_init_default, dbus_threads_init: be safe to call at any time
On Unix, we use a pthreads mutex, which can be allocated and
initialized in global memory.

On Windows, we use a CRITICAL_SECTION, together with a call to
InitializeCriticalSection() from the constructor of a global static
C++ object (thanks to Ralf Habacker for suggesting this approach).

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: Ralf Habacker <ralf.habacker@freenet.de>
2013-05-10 11:35:08 +01:00
Simon McVittie
863c989bb6 Fix compiler warnings when X11 autolaunch and launchd are both disabled
From the department of "if it isn't tested, it doesn't work". I tried
compiling dbus without an assortment of optional features:

    in_builddir ~/build/dbus/legacy ${MR_REPO}/configure \
        --enable-developer --enable-maintainer-mode --enable-tests \
        dbus_cv_sync_sub_and_fetch=no \
        --disable-selinux \
        --disable-inotify \
        --disable-dnotify \
        --disable-epoll \
        --disable-kqueue \
        --disable-launchd \
        --disable-systemd \
        --disable-libaudit \
        --without-valgrind \
        --disable-x11-autolaunch \
        && ...

and it resulted in -Wunused warnings.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64362
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2013-05-10 11:34:42 +01:00
Simon McVittie
eabf6c42a1 dbus_threads_init: call _dbus_threads_init_platform_specific()
This reverses the relationship between these two functions.
Previously, dbus_threads_init() wouldn't allocate dbus_cond_event_tls
on Windows, call check_monotonic_clock on Unix, or call
_dbus_check_setuid on Unix.

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: Ralf Habacker <ralf.habacker@freenet.de>
2013-05-09 10:33:38 +01:00
Simon McVittie
c36f21a2e9 DBusAtomic: on Unix, use pthreads mutexes for fallback
On pthreads platforms, POSIX guarantees that we can "allocate" mutexes
as library-global variables, without involving malloc. This means we
don't need to error-check their allocation - if the dynamic linker
succeeds, then we have enough memory for all our globals - which is an
important step towards being thread-safe by default. In particular,
making atomic operations never rely on DBusMutex means that we are free
to implement parts of DBusMutex in terms of DBusAtomic, if it would help.

We do not currently support any non-Windows platform that does not have
pthreads. This is unlikely to change.

On Windows, we already used real atomic operations; we can just
delete the unused global variable.

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: Ralf Habacker <ralf.habacker@freenet.de>
2013-05-09 10:32:54 +01:00
Simon McVittie
7ac9b68220 Add _DBUS_GNUC_WARN_UNUSED_RESULT, similar to GLib's
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2013-05-08 14:34:16 +01:00
Simon McVittie
bd5cec18cd NEWS 2013-05-08 14:30:46 +01:00
Simon McVittie
82b3d94ab1 start spec 0.22 development 2013-05-02 14:50:34 +01:00
Simon McVittie
657a589a98 start 1.7.4 development 2013-05-02 14:50:34 +01:00
Ralf Habacker
286923789e Fixed cmake windows build system bug not installing runtime part of shared libraries into bin dir.
This patch also take care of different install directories on unix like os.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-29 20:42:30 +02:00
Simon McVittie
7ff0cd0640 prepare version 1.7.2 and spec 0.21 2013-04-25 13:12:15 +01:00
Simon McVittie
1f3b479a12 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	configure.ac
2013-04-24 20:31:28 +01:00
Simon McVittie
1d560ff7f9 development version 2013-04-24 20:30:00 +01:00
Simon McVittie
a1883ddcac Prepare release 1.6.10 2013-04-24 12:14:57 +01:00
Simon McVittie
79c150c519 NEWS for 1.7 2013-04-23 19:16:23 +01:00
Simon McVittie
684916fb67 Disable sd-daemon.c's support for POSIX message queues
This fixes build failures with recent glibc while avoiding an
otherwise useless librt dependency.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63166
Reviewed-by: Thiago Macieira <thiago@kde.org>
2013-04-23 17:46:24 +01:00
Simon McVittie
9e04ddba7d NEWS for 1.7 2013-04-22 16:21:02 +01:00
Cristian Rodríguez
235fd739a4 dbus.service.in: Do not order after syslog.target
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-22 16:17:48 +01:00
Simon McVittie
0c97243219 Specification: explicitly allow the Unicode noncharacters
This follows Unicode Corrigendum #9.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63072
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 16:16:09 +01:00
Simon McVittie
5f12e6e081 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
2013-04-22 16:16:03 +01:00
Simon McVittie
6d7782659a NEWS for 1.6 2013-04-22 16:15:34 +01:00
Simon McVittie
6b2add5e70 Accept non-characters when validating Unicode
Unicode Corrigendum #9 clarifies that the non-characters U+nFFFE
(for n in the range 0 to 0x10), U+nFFFF (for n in the same range),
and U+FDD0..U+FDEF are valid for interchange, and their presence
does not make a string ill-formed.

GLib 2.36 made the corresponding change in its definition of UTF-8
as used by g_utf8_validate() and similar functions.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63072
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 15:36:32 +01:00
Ralf Habacker
7467a410ef Unify docbook dtd version to 4.4.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-19 12:40:01 +01:00
Simon McVittie
c27d913789 NEWS 2013-04-18 19:26:59 +01:00
Simon McVittie
2872422718 Rename default_message_unix_fds to DEFAULT_MESSAGE_UNIX_FDS
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-18 19:21:51 +01:00
Simon McVittie
1502908465 cmake: define default_message_unix_fds so it can be substituted in session.conf
This fixes a regression since 1.7.0: session.conf would be invalid when
generated by cmake.

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-18 19:21:18 +01:00
Simon McVittie
68c1a26d1e sd-daemon.c: update from systemd for better portability 2013-04-16 17:40:41 +01:00
Simon McVittie
1aaeb6afd0 NEWS for 1.7 2013-04-11 14:00:15 +01:00
Matt Fischer
977293549d Set default maximum number of Unix fds according to OS
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-11 13:34:55 +01:00
Simon McVittie
2ab900b678 Do not suppress syslog test's stderr just because init is systemd
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-04-08 12:17:28 +01:00
Simon McVittie
60511bb995 fix NEWS: a Windows "sid" is a security ID, not a session ID 2013-04-05 17:01:29 +01:00
Simon McVittie
3b1ad7f7c5 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	configure.ac
2013-04-05 13:00:22 +01:00
Simon McVittie
71fc71fe55 NEWS for 1.7 2013-04-05 12:57:56 +01:00
Simon McVittie
540e5692e0 Allow use of GLib 2.32 functionality, which we do conditionally 2013-04-05 12:54:57 +01:00