Commit graph

490 commits

Author SHA1 Message Date
Will Thompson
6663cb5dcf Dispatch post-activation messages to anyone interested
Previously, if a method call activated a service, it would only be
delivered to that service, and not to other services with match rules
which should match. This patch replaces the improperly-duplicated
dispatch code in activation.c with a call back into the normal dispatch
code, fixing this bug (fd.o#26427).

(Additionally, were one to service-activate a service that doesn't
understand file descriptors with a message containing a file descriptor,
the previous code would send it anyway, and the service's dbus library
would blow up. This is also fixed here, since the normal dispatch code
checks this correctly.)
2010-03-19 17:48:00 +00:00
Will Thompson
3a2753e667 Move dispatching to destination to bus_dispatch_matches() 2010-03-19 17:48:00 +00:00
Colin Walters
18bcf800b6 Merge branch 'dbus-1.2' 2010-03-16 16:44:48 -04:00
Colin Walters
edecaa4abc Don't send an reply for driver messages if one isn't requested
Basically honor the no_reply flag; a binding is likely to want to
set this so it doesn't have to process extra traffic for match
rules.
2010-03-16 16:44:30 -04:00
Colin Walters
ebfa7c02fd Merge branch 'dbus-1.2'
Conflicts:
	bus/bus.c
	configure.in
2010-03-16 16:11:14 -04:00
Colin Walters
ce34415302 Make SELinux initialization failure fatal
https://bugzilla.redhat.com/show_bug.cgi?id=572769

Previously we'd just continue if AVC initialization failed, but
that didn't really work because then we'd later crash in
avc_has_perm.

Simply treat initialization failures as fatal, and hopefully we
can get data from the system log.
2010-03-16 15:57:27 -04:00
Colin Walters
f00c816c27 Add a prefix to our syslog messages
Previously we were simply logging as "dbus", and it was unclear
whether it was the system bus, or a session bus.  And if the latter,
which user?

This patch adds a prefix to the log message with the bus type
and the userid.
2010-03-16 15:57:27 -04:00
Colin Walters
04cf316600 Refactor _dbus_log_info, _dbus_log_security into _dbus_log_system
In preparation for a future patch which introduces a fatal logging level,
don't duplicate the API here.
2010-03-16 15:57:05 -04:00
Colin Walters
322c116a53 [main] Handle OOM in reload watch
http://bugs.freedesktop.org/show_bug.cgi?id=12953

Wait for memory if we can't init the string.

Based on an original patch by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>
2010-03-16 13:11:44 -04:00
Colin Walters
8586e83a5c Support inotify on older kernels
https://bugs.freedesktop.org/show_bug.cgi?id=23957

Previously we detected glibc support at compile time and used
it unconditionally; better to try it and fall back, this way
we continue to run on older kernels when compiled for newer ones.
2010-03-16 12:21:52 -04:00
Frederic Crozat
008cd59ef7 Fix build when selinux is disabled but libaudit enabled
https://bugs.freedesktop.org/show_bug.cgi?id=26859
2010-03-03 08:19:35 -05:00
Ralf Habacker
1bbb46421b fixed compile break introduced in commit e1c31c7307 2010-02-25 18:12:47 +01:00
Colin Walters
e1c31c7307 Merge branch 'dbus-1.2'
Conflicts:
	bus/bus.c
	bus/selinux.c
	configure.in
2010-02-22 09:48:45 -05:00
Colin Walters
9c90fcd2dc Monitor service directories for changes
It's not expected to have to manually SIGHUP the bus after installing
a new .service file.  Since our directory monitoring is already set
up to queue a full reload which includes service activation, simply
monitor the servicedirs too.

https://bugs.freedesktop.org/show_bug.cgi?id=23846
2010-02-18 15:33:28 -05:00
Brian Cameron
8ca10fd4de Fix dummy file monitoring backend compilation
https://bugs.freedesktop.org/show_bug.cgi?id=26421
2010-02-18 10:38:42 -05:00
Ralf Habacker
31d9f4d655 Merge branch 'master' of ssh://git.freedesktop.org/git/dbus/dbus 2010-02-09 19:44:12 +01:00
Ralf Habacker
523e01827e fixed bug on win32 not been able to use session bus with --config-file option
Internal setup of session bus type was bound to the presence of the --session
command line parameter which prevents to use the --config-file parameter for
session bus setup.
2010-02-09 08:37:50 +01:00
Cyril Brulebois
b429488739 Fix compilation of kqueue file monitoring on FreeBSD 2010-02-08 12:21:35 -05:00
Romain Pokrzywka
27a46ea9cb variable name fix (DBUS_DAEMON_NAME instead of DAEMON_NAME) 2010-02-07 00:32:51 +01:00
Romain Pokrzywka
1cd84d8258 remove DBUS_DAEMON_EXECUTABLE_NAME, we already have DBUS_DAEMON_NAME, and use the specified name for the executable when building with cmake 2010-02-07 00:32:46 +01:00
Colin Walters
7bc27d1e84 Fix inotify shutdown
We were incorrectly passing NULL for a DBusList when the usage expected
is a pointer to a NULL DBusList pointer.  Also during dbus_shutdown
we need to actually close the inotify fd, and remove our watch.

Move the shutdown handler out of bus.c and into inotify where we
can do all of this cleanly.
(cherry picked from commit 90fe96b187)
2010-02-03 12:05:28 -05:00
Colin Walters
15109202a9 Fix compilation in --disable-selinux case
_dbus_change_to_daemon_user moved into selinux.c for the --with-selinux
(and audit) case because that's where all of the relevant libcap headers
were being used.  However in the --disable-selinux case this didn't
compile and wasn't very clean.

If we don't have libaudit, use the legacy direct setgid/setuid bits
we had before in dbus-sysdeps-util-unix.c.
2010-02-03 08:36:38 +01:00
Colin Walters
3dac125d61 Fix compilation in --disable-selinux case
_dbus_change_to_daemon_user moved into selinux.c for the --with-selinux
(and audit) case because that's where all of the relevant libcap headers
were being used.  However in the --disable-selinux case this didn't
compile and wasn't very clean.

If we don't have libaudit, use the legacy direct setgid/setuid bits
we had before in dbus-sysdeps-util-unix.c.
2010-02-02 15:04:58 -05:00
Colin Walters
90fe96b187 Fix inotify shutdown
We were incorrectly passing NULL for a DBusList when the usage expected
is a pointer to a NULL DBusList pointer.  Also during dbus_shutdown
we need to actually close the inotify fd, and remove our watch.

Move the shutdown handler out of bus.c and into inotify where we
can do all of this cleanly.
2010-02-02 15:04:45 -05:00
Ralf Habacker
53bab8663e win32 fix for commit 8a9880ffd2 - Clean up inotify watch handling 2010-02-02 14:14:20 +01:00
Colin Walters
6db588b854 Merge branch 'my-dbus-1.2' 2010-02-01 17:27:26 -05:00
Colin Walters
8a9880ffd2 Clean up inotify watch handling
Substantially based on a patch by Matthias Clasen <mclasen@redhat.com>
kqueue implementation by Joe Marcus Clarke <marcus@freebsd.org>

Previously, when we detected a configuration change (which included
the set of config directories to monitor for changes), we would
simply drop all watches, then readd them.

The problem with this is that it introduced a race condition where
we might not be watching one of the config directories for changes.

Rather than dropping and readding, change the OS-dependent monitoring
API to simply take a new set of directories to monitor.  Implicit
in this is that the OS-specific layer needs to keep track of the
previously monitored set.
2010-02-01 16:22:56 -05:00
Ralf Habacker
2016b83dec _dbus_change_to_daemon_user() is platform related and commit 0a3905d7f3 broke windows builds 2010-01-29 23:57:07 +01:00
Colin Walters
0705eb5c86 Update messagebus.in init script to start earlier
Patch from Fedora.
2010-01-28 17:31:36 -05:00
Colin Walters
7a4cd46284 Merge branch 'my-dbus-1.2'
Conflicts:
	bus/Makefile.am
	dbus/dbus-sysdeps-util-unix.c
	dbus/dbus-transport.c
	test/test-service.c
2010-01-28 17:09:15 -05:00
Colin Walters
b93476ce07 Don't drop pending activations when reloading configuration
The reload handling for activation simply dropped all knowledge
of pending activations, which was clearly wrong.  Refactor things
so that reload only reloads directories, server address etc.

Based on a patch originally from Matthias Clasen <mclasen@redhat.com>
2010-01-28 17:01:24 -05:00
Colin Walters
0a3905d7f3 Switch to libcap-ng, avoid linking libdbus against libcap[-ng]
(Commit message written by Colin Walters <walters@verbum.org>)

A current Fedora goal is to convert projects to libcap-ng which
more easily allows dropping Linux capabilities.  For software
which also links to libdbus, it's problematic to link against
libcap as well.

Though really, libdbus should have never linked against libcap
in the first place, which is another thing this patch changes
by moving the libcap-using bits out of dbus/ and into bus/.

https://bugzilla.redhat.com/show_bug.cgi?id=518541
2010-01-28 17:01:24 -05:00
Colin Walters
b7e77c6b03 Ignore exit code zero from activated services
A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>
2010-01-28 17:01:24 -05:00
Will Thompson
0411f9d632 Rename DBusConnection *disconnected param to connection 2010-01-05 21:11:13 +01:00
Will Thompson
b4264cb0e6 Group match rules by their interface.
In my informal studies of "normal" sets of match rules, only checking
match rules with the appropriate interface for the message reduces the
number that need to be checked by almost 100x on average (ranging from
halving for messages from the bus daemon, to a >200x reduction in many
cases). This reduces the overhead added to dispatching each message by
having lots of irrelevant match rules.
2010-01-05 21:11:12 +01:00
Will Thompson
86d0d2baf5 Extract rule_list_remove_by_connection 2010-01-05 21:11:12 +01:00
Will Thompson
a2c4eca52a Extract freeing a DBusList<BusMatchRule> 2010-01-05 21:11:11 +01:00
Will Thompson
38ead76613 Don't bother re-matching features we've checked.
This is currently not a big deal, but will make more of a difference
once the set of match rules is partitioned by more features than just
the message type.
2010-01-05 21:11:10 +01:00
Will Thompson
647912b81f Index match rules by message type
This avoids scanning all the signal matches while dispatching method
calls and returns, which are rarely matched against.
2010-01-05 21:11:09 +01:00
Ralf Habacker
3da9815113 win32 fix: disabled some tests, they may be not intendent for windows or need to be implemented 2009-12-20 10:45:08 +01:00
Matthias Clasen
8343c971cd Bug 25697 - Fix memory leak in policy reload
Signed-off-by: Colin Walters <walters@verbum.org>
2009-12-18 14:29:40 -05:00
Ralf Habacker
68fb041ac3 DBusPipe related unix compile fix 2009-12-18 17:35:43 +01:00
Colin Walters
949a64b127 Ignore exit code zero from activated services
A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>
2009-12-15 13:08:02 -05:00
Ralf Habacker
492e0ae06a fixed cmake version macro and string handling 2009-12-07 00:49:42 +01:00
Ralf Habacker
73b926275f uses tcp based test connections for now 2009-12-01 11:17:40 +01:00
Frank Osterfeld
d9e4725fa9 Windows fixes
Replace dbus_daemon_init() by dbus_publish_session_bus_address(),
publishing the full address. Omit username from mutexes (not necessary
as mutex names are local to session). Don't exit if publishing the
address failed (allow multiple session bus instances per
session). Based on 00ee92ae314 by Tor Lillqvist.

Cherry-picked from commit 23945513e9a4da61d286ebfbce3897aa061ddbfe in
the dbus4win repository by tml@iki.fi. Remove claim of that commit not
being merged from README.dbus4win.
2009-12-01 10:28:00 +01:00
Tor Lillqvist
475dc2fc73 Use nonce-tcp default session bus on Windows 2009-12-01 09:25:59 +01:00
Nguyễn Thái Ngọc Duy
366ffe4478 bus/Makefile.am: make dbus-daemon and friends bin_PROGRAMS on Windows
On Linux, dbus-daemon and dbus-daemon-launch-helper are treated specially
because they need permission adjustment.

On Windows, all executables are stubs, created by libtool. The real
executables are in .libs. We need to use libtool to install them
properly. So let's make them bin_PROGRAMS on Windows.
(cherry picked from commit 7fb35992d67433ac3ba82e9e2e786e123323456d)
2009-12-01 08:38:06 +01:00
Marc Mutz
ae776f576a bus/Makefile.am: conditional compilation for W32, use EXEEXT in install hooks (cherry picked from commit 551a9c446b782167aa8b0a74a41a1b7ffb42c6eb) 2009-12-01 08:36:31 +01:00
Marc Mutz
a871d0f42e Makefile.am's: reorder libraries so static libs come first (fixes linking on W32) (cherry picked from commit f88bd88d6b4b318f9401fae595343c8b1bacf654) 2009-12-01 08:36:29 +01:00