Commit graph

583 commits

Author SHA1 Message Date
Simon McVittie
2f183ac576 Don't build any of the reload-pipe code on non-Unix
In commit ab7b3f9, Ralf notes that handle_reload_watch() is (in principle)
cross-platform. However, there's no way to trigger it on Windows, because
nothing ever writes to the pipe. Make the entire pipe-to-self trick
Unix-specific instead.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40002
2011-08-26 15:02:30 +01:00
Ralf Habacker
4a3e5b0af4 Fix compilation on MSVC, which doesn't understand "inline" with its C99 meaning.
This fix is limited to msvc compilers only.

Reviewed-by:Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-08-13 22:08:26 +02:00
Steve Grubb
70fb675a10 capng: Drop supplemental groups when switching to daemon user
This patch ensures the daemon process doesn't inherit any supplemental
groups for the root user from an administrator login via an init
script.

This is only an issue for pre-systemd systems.

https://bugzilla.redhat.com/show_bug.cgi?id=726953
2011-08-11 10:54:45 +01:00
Ralf Habacker
b0b5f9b134 Win32 compile fix.
msvc compilers define 'inline' only for c++ code, so wrap it
with a platform independent DBUS_INLINE define in cmake
generated config.h.
2011-08-05 23:01:10 +02:00
Simon McVittie
ba2892396a bus signal_handler: call _exit in the unlikely event that the pipe is full or invalid
On OSs with abstract sockets, this is close enough. On OSs without
abstract sockets, this results in failing to clean up Unix sockets
in /tmp if someone has sent us thousands of SIGHUP signals since we
last entered the main loop - I think that's acceptable.

The reload pipe should never get closed, but if it is for some reason,
we want a SIGTERM after that to cause an exit too.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 14:39:34 +01:00
Simon McVittie
05389054bd bus signal_handler: comment why it's OK if the reload pipe gets full
Backported to dbus-1.4, originally part of commit c7ef3ead55.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-08-05 14:39:27 +01:00
Simon McVittie
e90e7e9e71 bus signal_handler: don't pretend to be portable away from Unix
Signals are POSIX but not ISO C, so guard it with DBUS_UNIX.

dbus-sysdeps-util-win doesn't actually implement _dbus_set_signal_handler
anyway, so not compiling this code on non-Unix seems more honest.

Backported to dbus-1.4, originally part of commit c7ef3ead55.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-08-05 14:39:24 +01:00
Simon McVittie
3cf9fa4dc7 Conditionalize inclusion of unistd.h
Windows doesn't have it, for instance.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 14:39:04 +01:00
Brian Cameron
94e7a1df3e Handle SIGTERM again, to avoid leaving /tmp/dbus-XXX sockets on Solaris
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-08-05 14:38:55 +01:00
Lennart Poettering
d837d937c5 activation: add /lib/dbus-1/system-services to the search path for services
In order to allow D-Bus usage during early boot (where /usr is not
accessible) also search for bus activation files in
/lib/dbus-1/system-services/. This is only a first step in the right
direction, before we really can boot without /usr we'd need to move all
current activation files (or possibly replace
/usr/dbus-1/system-services to a symlink to
/lib/dbus-1/system-services).
2011-07-28 21:22:07 +02:00
Simon McVittie
638828526a Fix spelling/grammatical mistakes detected by Debian's lintian(1)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38284
Reviewed-by: Lennart Poettering <lennart@poettering.net>
2011-07-28 11:05:43 +01:00
Sascha Silbe
2c776890bf list_allows_user: fix debug output for groups
Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-07-27 18:51:03 +01:00
Simon McVittie
b354cfc84a Run bus tests from test/
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34405
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-07-18 19:14:55 +01:00
Simon McVittie
3b82500b1b bus: use ln -fs to enable dbus in systemd, not $(LN_S)
Using $(LN_S) is inappropriate because it could in theory mean either
ln -s, ln or cp -p depending on autoconf checks.

Not using -f breaks reinstallation directly from source (DESTDIR unset),
because the symlinks will already exist.

Because systemd isn't currently portable to non-Linux, let alone
non-SUS-compliant systems, it seems safe to assume that ln -fs behaves
as specified by SUS if systemd was found.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37870
Reviewed-by: Colin Walters <walters@verbum.org>
2011-06-08 11:33:21 +01:00
Simon McVittie
ff2047a75a Remove support for -Wl,--gc-sections altogether
Packagers should only enable this flag if they have confirmed that it
actually works on their toolchain (it's the sort of rarely used feature
that frequently regresses on obscure architectures/OSs without anyone
noticing), and also confirmed that it is actually a significant size win
for their configuration.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33466
Reviewed-by: Colin Walters <walters@verbum.org>
2011-06-07 14:26:20 +01:00
Mark Brand
add71e5d7a don't try to build dbus-daemon-launch-helper for Windows
Fixed regression in b0acded which breaks build for Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37838
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-06-07 14:20:05 +01:00
Simon McVittie
6e255ae93d bus_context_log: divert messages to stderr if we're not using syslog
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:37 +01:00
Simon McVittie
c9af1526d1 process_config_first_time_only: initialize syslog as intended.
On Linux, we previously called openlog() (with different options!) while
initializing SELinux; leave SELinux messages as LOG_USER|LOG_INFO in case
anyone was relying on that, but let the rest of our log messages come
out as LOG_DAEMON.

Also enable LOG_PERROR (copy syslog messages to stderr) unconditionally;
we can make this an autoconf check if anyone's pet Unix doesn't have
LOG_PERROR.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:35 +01:00
Simon McVittie
b28ddba9bd bus_context_check_security_policy: syslog if we hit the outgoing quota
In practice, nothing copes with missing broadcast signals, so the least
we can do is make the failure mode visible.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:31 +01:00
Simon McVittie
be07ce6362 bus_context_check_security_policy: for SELinux denials, share code to set errors
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:29 +01:00
Simon McVittie
79f02ca04a bus_context_check_security_policy: factor out complain_about_message
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:02 +01:00
Simon McVittie
e4abc1d1a5 Don't report file descriptors as "leaked" if they were already open
This is necessary to run the regression tests under valgrind (if
telling it to output to a dedicated fd), gdb, fakeroot etc.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35173
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-27 16:28:36 +01:00
Colin Walters
1d24cecc41 activation: Use _dbus_system_log for activation information
Log when we are activating something (and whether it's via systemd)
as well as when we fail to activate, and when one succeeds.

https://bugs.freedesktop.org/show_bug.cgi?id=35705
2011-04-26 14:12:10 -04:00
Simon McVittie
53db0b73c4 Don't force use of -fPIE for the dbus-daemon if apparently supported
It's a minor security benefit, but not automatically beneficial (it
enables ASLR, but breaks prelinking, some buggy toolchains, and some gdb
versions). Distributions who know their infrastructure works well can
enable it just as easily via

    ./configure CFLAGS="-fPIE" LDFLAGS="-pie"

without extra support from us, and that's a generic solution applicable to
many packages.

Similarly, don't force libdbus and libdbus-internal to be PIC: libtool
knows better than we do whether that's necessary/beneficial on a
particular platform.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=16621
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27215
Bug-NB: NB#171940
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-26 18:47:23 +01:00
Simon McVittie
b0acdedae1 Install dbus-daemon and dbus-daemon-launch-helper in the conventional way
Also remove some pointless indirection (extra_tests etc.), don't install
the unused directory $(libexecdir)/dbus-1 (we actually install the
launch helper directly into $(libexecdir)), and allow dbus_daemondir to be
set on Windows rather than forcing dbus-daemon to be installed to
$(bindir) there.

dbus_daemon_execdir has to contain "exec" so that the dbus-daemon will be
installed by "make install-exec" and not "make install-data".

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=14512
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-26 18:41:18 +01:00
Colin Walters
171934b377 activation: Strip out code to compare by Exec=
In commit:
 075945f6        (John (J5) Palmieri     2005-07-14 20:44:15 +0000

some code was added to compare services by Exec key.  The changelog is
not pariticularly informative as to why this was added. But while
debugging other code, we noticed this.

Comparing by Exec key is not in the specification, and triggered a
problem where while converting services to use systemd for activation,
a change was made to use Exec=/bin/false and simply rely on systemd
to activate.

While I think it was broken for the service files to be changed
to Exec=/bin/false, we shouldn't be doing something here that's
not in the spec either.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35750
2011-04-08 13:17:32 +01:00
Simon McVittie
75cecfc374 Break up the monster conditional in config-parser so gcov can cope
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=10887
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-07 11:25:54 +01:00
Simon McVittie
2adf484fb3 Revert merge of master (dbus-1.5) into dbus-1.4
This reverts commits d1d395774435..09c9d6406b75f, keeping Lennart's
addition of UnknownInterface etc.
2011-03-14 11:53:09 +00:00
Simon McVittie
3013fafae5 Merge branch 'dbus-1.4' 2011-03-07 14:51:46 +00:00
Simon McVittie
2e40818280 Fix some more stray occurrences of ELEMENT_TYPE 2011-03-07 13:55:10 +00:00
Andre Heinecke
e0fc90bdf2 Do not use the name ELEMENT_TYPE
On Windows Systems ELEMENT_TYPE is already defined
in Winioctl.h this header is included indirectly
in dbus-sysdeps.h. By avoiding the use of the Name
ELEMENT_TYPE it is ensured that config-parser-common.h
can be included together with dbus-sysdeps.h

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-03-07 13:50:38 +00:00
Simon McVittie
31a1b24c93 Merge branch 'dbus-1.4' 2011-02-24 18:40:31 +00:00
Simon McVittie
7848abe6c2 config-parser regression test: don't require that fd.o #34496 exists
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-02-24 18:40:11 +00:00
Simon McVittie
d887845c5c bus driver: allow implementing more than one interface
Previously, Introspect was just special-cased.

This could allow us to have a conditionally-compiled debugging interface,
for instance.

Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33757
2011-02-18 14:25:04 +00:00
Simon McVittie
d9af45a1fa update_desktop_file_entry: stylistic fixes based on Colin's review 2011-02-16 14:47:08 +00:00
Simon McVittie
75cfd97fc2 update_desktop_file_entry: unify cleanup code for success and failure cases
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Simon McVittie
fbecc33435 update_desktop_file_entry: don't double-free strings if added to entry before failure
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Simon McVittie
65f61236d7 update_desktop_file_entry: free @exec on error
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Simon McVittie
d95cc488a8 update_desktop_file_entry: make scope of exec_tmp as short as possible
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Simon McVittie
fb704ba78f update_desktop_file_entry: use _dbus_strdup for something we'll dbus_free
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Colin Walters
66a09fa7c3 bus: Raise file descriptor limit to match configuration
The default configuration has hardcoded 2048 complete connections,
and 64 incomplete.  We need at least that number of file descriptors,
plus some for internal use.

In the bus, attempt to call setrlimit() before we drop privileges.
Practically speaking for this means the system bus gets it, the
session bus doesn't.

http://bugs.freedesktop.org/show_bug.cgi?id=33474

Reviewed-By: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-02-03 13:25:34 -05:00
Simon McVittie
3a380137c0 bus-test: add support for only running one test
This is much quicker when valgrinding.

Reviewed-by: Colin Walters <walters@verbum.org>
2011-02-01 11:47:43 +00:00
Simon McVittie
7480dfdb2a If a file included via <includedir/> is invalid, syslog and skip it
This is more graceful than failing entirely (our previous behaviour),
but more visible than ignoring it completely (the previous behaviour
patched in by Debian and derivatives).

Based on a patch from Daniel Silverstone back in 2004, which was meant
to be temporary; I think it makes sense to change this permanently,
since files in *.d are typically supplied by other packages, whose bugs
shouldn't be able to bring down dbus-daemon.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19186
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=230231
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-31 19:16:00 +00:00
Alban Crequy
4d93cc858c Implement message type in match_rule_to_string
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-31 15:31:11 +00:00
Lennart Poettering
2bfed4cc54 systemd: ensure that the system bus is unlikely to be killed on OOM 2011-01-18 23:46:15 +01:00
Christian Dywan
a144bf4989 clean up credentials on OOM in process_config_first_time_only
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:41:15 +00:00
Simon McVittie
69c0c06e35 remove obviously-redundant code from list_concat_new
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:04:09 +00:00
Christian Dywan
0f67e86308 handle failure to register inotify shutdown function
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:02:30 +00:00
Christian Dywan
85cb8414ff bus_matchmaker_new: free matchmaker itself, on OOM
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 11:58:26 +00:00
Ralf Habacker
02d973686a Use absolute session service dir path in bus-test on windows. 2010-12-29 14:43:24 +01:00