Commit graph

592 commits

Author SHA1 Message Date
Simon McVittie
58f968a2cc Always remove, invalidate and free watches before closing watched sockets
This should mean we don't get invalid fds in the main loop.

The BSD (kqueue) and Windows code paths are untested, but follow the same
patterns as the tested Linux/generic Unix versions.

DBusTransportSocket was already OK (it called free_watches() before
_dbus_close_socket, and that did the remove, invalidate, unref dance).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 15:45:54 +01:00
Simon McVittie
963a38d0b1 Merge branch 'dbus-1.4' 2011-06-08 11:38:21 +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
a09de5c004 Merge branch 'dbus-1.4'
Conflicts:
	NEWS
2011-06-07 14:37:30 +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
e7677fc83c Merge branch 'dbus-1.4' 2011-05-25 18:18:00 +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
0e501b3091 Merge branch 'dbus-1.4' 2011-04-27 17:59:35 +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
Simon McVittie
338678757c Merge branch 'dbus-1.4'
Conflicts:
	NEWS
2011-04-26 19:20:18 +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
1aab994077 Merge branch 'dbus-1.4'
Conflicts:
	NEWS
2011-04-26 19:05:53 +01: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
Simon McVittie
c4b76acc6b Merge branch 'dbus-1.4'
Conflicts:
	NEWS
2011-04-08 15:23:17 +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
74072479a0 Merge branch 'arg0namespace-24317'
Reviewed-by: David Zeuthen <davidz@redhat.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24317
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=31818
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34870
2011-04-07 17:16:24 +01:00
Simon McVittie
c99ead074a Merge branch 'dbus-1.4' 2011-04-07 17:15:41 +01:00
Simon McVittie
2dafaac839 Check parsing (or otherwise) of path_namespace in match rules 2011-04-07 16:30:41 +01:00
Simon McVittie
b92f2224bf Remove support for trailing "." on arg0namespace 2011-04-07 16:12:35 +01:00
Simon McVittie
97bf0b2b48 Rename path_prefix to path_namespace and disallow trailing '/'
Also disallow having both path and path_namespace in the same match rule
(it wouldn't make sense, path is more specific than path_namespace).

As per IRC discussion with davidz and wjt.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34870
2011-04-07 16:12:22 +01:00
Simon McVittie
d23cdacb0d path_prefix: anchor matches at path-component boundaries, and give examples
It seems wrong that path_prefix="/foo" matches /foobar, and it isn't
difficult or expensive to check.
2011-04-07 15:04:48 +01:00
David Zeuthen
0980e63aac Add path_prefix match rule
Add a new path_prefix match rule that can be used for efficient
implementations of the org.freedesktop.DBus.ObjectManager interface
(see bug 34869).

https://bugs.freedesktop.org/show_bug.cgi?id=34870

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-07 14:06:05 +01:00
Simon McVittie
08b251f0bc signals.h: rename argument in declaration to match implementation 2011-04-07 12:41:52 +01:00
Simon McVittie
bf3a7d8653 Merge remote-tracking branch 'wjt/arg0namespace' into arg0namespace-24317 2011-04-07 12:40:30 +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
Lennart Poettering
f934a967e3 connection: hook UnknownObject and UnknownInterface up where appropriate
This makes use of UnknownInterface and UnknownObject where appropriate
in the D-Bus core.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34527
Reviewed-By: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-03-11 23:08:25 +01: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