summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
AgeCommit message (Collapse)Author
2015-06-10bus: we now support path_namespace=/David Herrmann
Our bloom-filters support root-path matching. Make sure we properly add the path_namespace= tag.
2015-06-10bus: fix pattern matchingDavid Herrmann
DBus-spec defines two different pattern matchings: 1) Path and namespace prefix matching. In this case, A matches B either if both are equal, or if B is fully included in the namespace of A. In other words, A has to be a prefix of B, but end with a separator character (or the following character in B must be one). This is used for path_namespace= and arg0namespace= 2) The other pattern matching is used for arg0path= which does a two-way matching. That is, A must be a prefix of B, or B a prefix of A. Furthermore, the prefix must end with a separator. Fix the sd-bus helpers to reflect that. The 'simple_' and 'complex_' prefixes don't make any sense now, but.. eh..
2015-06-10bus: fix test-bus-kerne-bloom.c to match properlyDavid Herrmann
Make sure we actually verify our match-rules are executed properly. Right now all we test is the bloom-matches, which are non-reliable as they leave through false-positives.
2015-06-10bus: fix arg0path= two-way matchingDavid Herrmann
DBus spec clearly defines arg0path= to be a two-way matching. That is, either the matcher or the matchee can be a prefix of the other to match. This is not possible to implement with bloom-filters. Instead, we'd have to add a separate filter for each prefix. This is non-trivial, though. Hence, just skip the match for now and match locally.
2015-06-10bus: fix bloom_add_prefixes() to add all required dataDavid Herrmann
Lets look at an example where we add arg0="/foo/bar/waldo" to a bloom-filter. The following strings are added: "arg0:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar" "arg0-slash-prefix:/foo" Two problems arise: 1) If we match on "arg0path=/foo/bar/waldo", the dbus-spec explicitly states that equal strings are also considered prefixes. However, in the bloom-match, we can only provide a single match-filter. Therefore, we have to add "arg0-slash-prefix:/foo/bar/waldo" there, but this never occured in the bloom-mask of the message. Hence, this patch makes sure bloom_add_prefixes() adds the full path as prefix, too. 2) If we match on "arg0path=/foo/", the dbus-spec states that arg0path does prefix-matching with the trailing slash _included_, unlike path_namespace= matches, which does *not* include them. This is inconsistent, but we have to support the specs. Therefore, we must add prefixes with _and_ without trailing separators. Hence, this patch makes sure bloom_add_prefixes() adds all prefixes with the trailing slash included. The final set of strings added therefore is: "arg0:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar/" "arg0-slash-prefix:/foo/bar" "arg0-slash-prefix:/foo/" "arg0-slash-prefix:/foo" "arg0-slash-prefix:/"
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-06-10Merge pull request #85 from keszybz/selinux-contextZbigniew Jędrzejewski-Szmek
2015-06-10sd-bus: remove ucred parameter from bus_message_from_header() since we don't ↵Lennart Poettering
use it anymore
2015-06-10sd-bus: fix early exit when we lack all data in bus_get_owner_creds_dbus1()Lennart Poettering
2015-06-10bus-message: remove shadow warning with log_debug_bus_message()Lennart Poettering
2015-06-10sd-bus: store selinux context at connection timeZbigniew Jędrzejewski-Szmek
This appears to be the right time to do it for SOCK_STREAM unix sockets. Also: condition bus_get_owner_creds_dbus1 was reversed. Split it out to a separate variable for clarity and fix. https://bugzilla.redhat.com/show_bug.cgi?id=1224211
2015-06-10sd-bus: do not use per-datagram auxiliary informationZbigniew Jędrzejewski-Szmek
SELinux information cannot be retrieved this way, since we are using stream unix sockets and SCM_SECURITY does not work for them. SCM_CREDENTIALS use dropped to be consistent. We also should get this information at connection time. https://bugzilla.redhat.com/show_bug.cgi?id=1224211 "SCM_SECURITY was only added for datagram sockets."
2015-06-10sd-bus: Correct typoTorstein Husebø
2015-06-10Merge pull request #117 from ↵Lennart Poettering
utezduyar/feat/dump-sync-dbus-message-with-logging-on sd-bus: dump sync messages in debug mode
2015-06-10sd-bus: dump sync messages in debug modeUmut Tezduyar Lindskog
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-06-09bus-creds: always set SD_BUS_CREDS_PID when we set pid in the maskZbigniew Jędrzejewski-Szmek
Also reorder the code a bit to be easier to parse.
2015-06-09sd-bus: add async convenience method call APIUmut Tezduyar Lindskog
2015-06-05bus: don't force send-masks on kdbus busesDavid Herrmann
Right now we always pass KDBUS_ITEM_ATTACH_FLAGS_RECV to KDBUS_CMD_BUS_MAKE, effectively forcing every bus connection to do the same during KDBUS_CMD_HELLO. This used to be a workaround to make sure all metadata is always present. However, we refrained from that approach and intend to make all metadata collection solely rely on /proc access restrictions. Therefore, there is no need to force the send-flags mask on newly created buses.
2015-06-04bus: update kdbus.hDavid Herrmann
Sync with upstream.
2015-06-03kdbus: remove attach_flags_mask module parameter settingKay Sievers
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-26treewide: fix typosTorstein Husebø
2015-05-22sd-bus,sd-event: make public APIsLennart Poettering
With the v221 release these APIs should be public, stable APIs, hence let's install their headers by default now, and add their symbols to the .sym file.
2015-05-19bus-socket: simplify initalization of struct msghdrZbigniew Jędrzejewski-Szmek
2015-05-15systemctl: introduce --now for enable, disable and maskJan Synacek
https://bugs.freedesktop.org/show_bug.cgi?id=42940
2015-05-14test-bus-chat: various modernizationsLennart Poettering
2015-05-14sd-bus: fix memory leak in test-bus-chatCristian Rodríguez
Building with address sanitizer enabled on GCC 5.1.x a memory leak is reported because we never close the bus, fix it by using cleanup variable attribute.
2015-05-14util: introduce memmem_safe() and make use of itLennart Poettering
GNU memmem() requires a nonnull first parameter. Let's introduce memmem_safe() that removes this restriction for zero-length parameters, and make use of it where appropriate. http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-05-06bus: don't switch to kdbus if not requestedDavid Herrmann
Whenever systemd is re-executed, it tries to create a system bus via kdbus. If the system did not have kdbus loaded during bootup, but the module is loaded later on manually, this will cause two system buses running (kdbus and dbus-daemon in parallel). This patch makes sure we never try to create kdbus buses if it wasn't explicitly requested on the command-line.
2015-04-30sd-bus,sd-login: add api for querying the slice within the the user systemd ↵Lennart Poettering
instance of a process units are organized in slice trees, not only for the system instance, but also for user systemd instances, expose this properly.
2015-04-30sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API versionLennart Poettering
As perparation for future incompatible kdbus kernel API changes.
2015-04-29sd-bus: properly handle creds that are known but undefined for a processLennart Poettering
A number of fields do not apply to all processes, including: there a processes without a controlling tty, without parent process, without service, user services or session. To distuingish these cases from the case where we simply don't have the data, always return ENXIO for them, while returning ENODATA for the case where we really lack the information. Also update the credentials dumping code to show this properly. Fields that are known but do not apply are now shown as "n/a". Note that this also changes some of the calls in process-util.c and cgroup-util.c to return ENXIO for these cases.
2015-04-29sd-bus: allow passing NULL as bus parameter to sd_bus_send()Lennart Poettering
If NULL is specified for the bus it is now automatically derived from the passed in message. This commit also changes a number of invocations of sd_bus_send() to make use of this.
2015-04-29sd-bus: drop bus parameter from message callback prototypeLennart Poettering
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
2015-04-29test: rename test-bus-kernel-benchmark to test-bus-benchmarkTom Gundersen
This can now benchmark more than just kdbus.
2015-04-29sd-bus: benchmark - also support testing non-kdbus transportsTom Gundersen
We introduce two news types of benchmarks in chart-mode: - 'legacy' connects using the session bus - 'direct' connects using a peer-to-peer socket We should probably also introduce a mode for testing the dbus1-kdbus proxy.
2015-04-28bus-util: drop redundant bus argument from bus_message_map_all_properties() ↵Lennart Poettering
and related calls
2015-04-28run: synchronously wait until the scope unit we create is startedLennart Poettering
Otherwise it might happen that by the time PID 1 adds our process to the scope unit the process might already have died, if the process is short-running (such as an invocation to /bin/true). https://bugs.freedesktop.org/show_bug.cgi?id=86520
2015-04-28bus-util: print correct warnings for units that fail but for which we have a ↵Lennart Poettering
NULL result only
2015-04-24sd-bus: teach bus_print_property() how to print SD_BUS_TYPE_INT64Daniel Mack
2015-04-23sd-bus: add controlling tty field to sd_creds objectLennart Poettering
This is useful to print wall messages from logind with the right client tty. (to be added in a later patch)
2015-04-23sd-bus: when bus operations are to be executed on direct connections always failLennart Poettering
Also, don't consider this an loggable event, so that code that tries to read creds from a direct connection, doesn't generate logs.
2015-04-23sd-bus: don't inherit connection creds into message creds when we have a ↵Lennart Poettering
direct connection It's never a good idea, let's just not do it, not even on dierct connections.
2015-04-23core: explicitly specify credentials for direct connections, tooLennart Poettering
So far we authenticate direct connections primarily at connection time, but let's also do this for each method individually, by attaching the creds we need for that right away.
2015-04-22sd-bus: handle ppid=0 more gracefully (which happens for pid=1)Lennart Poettering
2015-04-21sd-bus: expose ppid fieldLennart Poettering
kdbus has been passing us the ppid file for a while, actually make use of it.
2015-04-21sd-bus: when augmenting creds, remember which ones were augmentedLennart Poettering
Also, when we do permissions checks using creds, verify that we don't do so based on augmented creds, as extra safety check.
2015-04-21sd-bus: augmenting cgroups-based creds when we have the cgroup path already ↵Lennart Poettering
is free