summaryrefslogtreecommitdiff
path: root/bus/bus.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06Reload policy rules for completed connectionsChengwei Yang1-0/+12
The message bus which can monitor its conf dirs for changes and reload confs immediately if dir monitor enabled, for example, inotify in Linux, kqueue in *BSD. However, it doesn't apply policy rules change for completed connections, so to apply policy rules change, the client connection has to disconnect first and then re-connect to message bus. For imcomplete connections, it always has the latest review of policy rules. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39463 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-11-07selinux: Use selinux_set_mapping() to avoid hardcoded constants for policyosmond sun1-1/+1
Previous to the introduction of selinux_set_mapping(), DBus pulled constants generated from the system's policy at build time. But this means it's impossible to replace the system policy without rebuilding userspace components. This patch maps from arbitrary class/perm indices used by D-Bus and the policy values and handles all the translation at runtime on avc_has_perm() calls. Bug: https://bugs.freedesktop.org/attachment.cgi?id=88719 Reviewed-By: Colin Walters <walters@verbum.org> Tested-By: Colin Walters <walters@verbum.org>
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>
2012-02-13Replace a series of booleans, all (apparently) alike, with flagsSimon McVittie1-9/+13
This makes it a bit clearer what's going on. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Lennart Poettering <lennart@poettering.net>
2012-02-10bus: introduce --nopidfile switch to disable writing of PID filesLennart Poettering1-2/+8
When used with init systems such as systemd (where PID files are redundant) this allows us to disable PID files even if a path is configured for them in the normal bus configuration files. Make use of this new switch in the systemd unit file. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45520 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-02-07Merge branch 'socket-set-33337'Simon McVittie1-1/+13
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33337
2012-01-23Merge branch 'dbus-1.4', rejecting commit 08dd53c14b53b88cSimon McVittie1-0/+1
2012-01-23dbus-daemon: fix forgotten counter increase while copying configured auth ↵Simon McVittie1-0/+1
mechanisms Previously, only one auth mechanism was used. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45106 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-01-04Revert all changes since a36d4918a6f646e085Simon McVittie1-4/+39
Someone seems to have merged part of master into 1.4. Again. Let's go back to the "last known good" point (the branch-point of some 1.4 branches I had locally), then we can cherry-pick the changes that should have gone in.
2011-08-05Remove various never-used variablesSimon McVittie1-8/+0
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-13Add a stub _dbus_loop_toggle_watch and call it where neededSimon McVittie1-1/+13
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33337 Bug-NB: NB#197191
2011-06-13DBusLoop: remove second layer of watch callbacks where possibleSimon McVittie1-18/+2
Similar to the previous commit, almost every use of DBusWatch can just have the main loop call dbus_watch_handle. The one exception is the bus activation code; it's had a comment explaining why it's wrong since 2003. We should fix that one day, but for now, just migrate it to a new _dbus_loop_add_watch_full which preserves the second-layer callback. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342 Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13DBusLoop: remove a layer of pointless abstraction around timeoutsSimon McVittie1-13/+2
Instead of supplying 8 tiny wrapper functions around dbus_timeout_handle, each with a user_data parameter that's a potentially unsafe borrowed pointer but isn't actually used, we can call dbus_timeout_handle directly and save a lot of trouble. One of the wrappers previously called dbus_timeout_handle repeatedly if it returned FALSE to indicate OOM, but that timeout's handler never actually returned FALSE, so there was no practical effect. The rest just ignore the return, which is documented as OK to do. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342 Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-05-25bus_context_log: divert messages to stderr if we're not using syslogSimon McVittie1-2/+13
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358 Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25process_config_first_time_only: initialize syslog as intended.Simon McVittie1-0/+2
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-25bus_context_check_security_policy: syslog if we hit the outgoing quotaSimon McVittie1-10/+13
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-25bus_context_check_security_policy: for SELinux denials, share code to set errorsSimon McVittie1-15/+6
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358 Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25bus_context_check_security_policy: factor out complain_about_messageSimon McVittie1-98/+85
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358 Reviewed-by: Colin Walters <walters@verbum.org>
2011-02-03bus: Raise file descriptor limit to match configurationColin Walters1-0/+20
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-01-17clean up credentials on OOM in process_config_first_time_onlyChristian Dywan1-3/+12
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-17remove obviously-redundant code from list_concat_newSimon McVittie1-1/+0
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>
2010-08-10Fixed wince build problem reported by aheinecke at intevation dot de.Ralf Habacker1-0/+2
2010-08-10Delete stale pid file on cygwin.Yaakov Selkowitz1-0/+20
2010-07-09activation: optionally, use systemd for system bus activationLennart Poettering1-1/+12
2010-07-09bus: add --address switchLennart Poettering1-87/+111
This is allows overriding of the listening address on the command line, which is particularly useful for systemd socket-based activation.
2010-03-22Merge branch 'dbus-1.2'Colin Walters1-1/+4
Conflicts: bus/dispatch.c configure.in test/name-test/test-names.c
2010-03-22Add DBUS_GNUC_PRINTF checks to new formatting functionsColin Walters1-0/+3
Otherwise we don't get GCC warnings.
2010-03-21[bus] While creating a syslog, correctly get pointer data from DBusStringColin Walters1-1/+1
2010-03-19Consistently include <config.h> in all C source files and never in header files.Marcus Brinkmann1-0/+1
2010-03-16Merge branch 'dbus-1.2'Colin Walters1-70/+98
Conflicts: bus/bus.c configure.in
2010-03-16Make SELinux initialization failure fatalColin Walters1-2/+2
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-16Add a prefix to our syslog messagesColin Walters1-46/+87
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-16Refactor _dbus_log_info, _dbus_log_security into _dbus_log_systemColin Walters1-23/+10
In preparation for a future patch which introduces a fatal logging level, don't duplicate the API here.
2010-02-22Merge branch 'dbus-1.2'Colin Walters1-2/+42
Conflicts: bus/bus.c bus/selinux.c configure.in
2010-02-18Monitor service directories for changesColin Walters1-2/+42
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-03Fix inotify shutdownColin Walters1-8/+0
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 90fe96b1875350f86a4a773d4a0a22009950dd4d)
2010-02-02Fix inotify shutdownColin Walters1-8/+0
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-01Merge branch 'my-dbus-1.2'Colin Walters1-9/+10
2010-02-01Clean up inotify watch handlingColin Walters1-9/+10
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-01-28Merge branch 'my-dbus-1.2'Colin Walters1-9/+14
Conflicts: bus/Makefile.am dbus/dbus-sysdeps-util-unix.c dbus/dbus-transport.c test/test-service.c
2010-01-28Don't drop pending activations when reloading configurationColin Walters1-9/+12
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>
2009-12-18Bug 25697 - Fix memory leak in policy reloadMatthias Clasen1-0/+2
Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-16Merge branch 'fd-passing'Thiago Macieira1-2/+8
Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
2009-07-14Bug 21161 - Update the FSF addressTobias Mueller1-1/+1
No comment. Signed-off-by: Colin Walters <walters@verbum.org> (cherry picked from commit 5baf2f856a9c6625993234855b07680da1c8916f)
2009-07-10Bug 21161 - Update the FSF addressTobias Mueller1-1/+1
No comment. Signed-off-by: Colin Walters <walters@verbum.org>
2009-05-20bus: make use of new unix fd limitsLennart Poettering1-2/+8
Create configuration settings and enforce message unix fd limits the same way we do for allocated message memory.
2009-01-06Initialize AVC earlier so we can look up service security contextsJames Carter1-5/+5
* bus/bus.c: Initialize AVC earlier: http://lists.freedesktop.org/archives/dbus/2008-October/010493.html Signed-off-by: Colin Walters <walters@verbum.org>
2009-01-06Bug 18446: Keep umask for session busMatt McCutchen1-1/+4
Signed-off-by: Colin Walters <walters@verbum.org>
2008-12-18Add requested_reply to send denials, and connection loginfo to "would deny"Colin Walters1-31/+38
The requested_reply field is necessary in send denials too because it's used in the policy language. The connection loginfo lack in "would deny" was just an oversight.
2008-12-18Add uid, pid, and command to security logsColin Walters1-11/+31
Extend the current security logs with even more relevant information than just the message content. This requires some utility code to look up and cache (as a string) the data such as the uid/pid/command when a connection is authenticated.